Feature Tip: Add private address tag to any address under My Name Tag !
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
Latest 10 from a total of 10 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Command | 20288166 | 179 days ago | IN | 0 ETH | 0.00055081 | ||||
Set Name | 20288129 | 179 days ago | IN | 0 ETH | 0.00009702 | ||||
Set Name | 20287714 | 179 days ago | IN | 0 ETH | 0.00014821 | ||||
Command | 20286309 | 179 days ago | IN | 0 ETH | 0.00059761 | ||||
Set Name | 20286287 | 179 days ago | IN | 0 ETH | 0.00017316 | ||||
Set Name | 20262102 | 183 days ago | IN | 0 ETH | 0.00017451 | ||||
Multi Command | 20262100 | 183 days ago | IN | 0.006 ETH | 0.00090685 | ||||
Command | 20262084 | 183 days ago | IN | 0.001 ETH | 0.00061545 | ||||
Command | 20260055 | 183 days ago | IN | 0.004 ETH | 0.00044341 | ||||
Multi Command | 20260054 | 183 days ago | IN | 0.001 ETH | 0.00058373 |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
IE_NANO_02
Compiler Version
v0.8.26+commit.8a97fa7a
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
//SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.20; import {SafeTransferLib} from "solady/src/utils/SafeTransferLib.sol"; import {MetadataReaderLib} from "solady/src/utils/MetadataReaderLib.sol"; //@inspired by nanitendiesVaultGuy //@dev draft multiswap cmd v3 contract IE_NANO_02 { using MetadataReaderLib for address; using SafeTransferLib for address; /// ======================= CUSTOM ERRORS ======================= /// error SlippageExceeded(); error SwapFailed(); /// @dev Bad math. error Overflow(); error Unauthorized(); error InvalidSwap(); /// @dev Invalid command. error InvalidSyntax(); error InvalidCharacter(); error InsufficientETHSent(); /// @dev Logs the registration of a token name. event NameSet(address indexed token, string name); /// ========================== STRUCTS ========================== /// struct SwapParams { address tokenIn; address tokenOut; uint256 amountIn; bool ETHIn; bool ETHOut; uint256 amountOutMinimum; } /// @dev The ERC4337 user operation (userOp) struct. struct UserOperation { address sender; uint256 nonce; bytes initCode; bytes callData; uint256 callGasLimit; uint256 verificationGasLimit; uint256 preVerificationGas; uint256 maxFeePerGas; uint256 maxPriorityFeePerGas; bytes paymasterAndData; bytes signature; } /// @dev The packed ERC4337 user operation (userOp) struct. struct PackedUserOperation { address sender; uint256 nonce; bytes initCode; bytes callData; bytes32 accountGasLimits; uint256 preVerificationGas; bytes32 gasFees; // `maxPriorityFee` and `maxFeePerGas`. bytes paymasterAndData; bytes signature; } /// @dev `ENSAsciiNormalizer` rules. enum Rule { DISALLOWED, VALID } /// ========================= CONSTANTS ========================= /// /// @dev The governing tendiesVaultGuy address. address internal constant tendiesVaultGuy = 0x6A111f7d28856385263Eedba7E12B37E4EED7997; address internal constant ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; address internal constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; address internal constant WBTC = 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599; address internal constant USDC = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48; address internal constant USDT = 0xdAC17F958D2ee523a2206206994597C13D831ec7; address internal constant DAI = 0x6B175474E89094C44Da98b954EedeAC495271d0F; address internal constant BASEDAI = 0x44971ABF0251958492FeE97dA3e5C5adA88B9185; address internal constant PEPECOIN = 0xA9E8aCf069C58aEc8825542845Fd754e41a9489A; IENSHelper internal constant ENS_REGISTRY = IENSHelper(0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e); IENSHelper internal constant ENS_WRAPPER = IENSHelper(0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401); address internal constant UNISWAP_V3_FACTORY = 0x1F98431c8aD98523631AE4a59f267346ea31F984; bytes32 internal constant UNISWAP_V3_POOL_INIT_CODE_HASH = 0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54; uint160 internal constant MIN_SQRT_RATIO_PLUS_ONE = 4295128740; uint160 internal constant MAX_SQRT_RATIO_MINUS_ONE = 1461446703485210103287273052203988822378723970341; bytes internal constant ASCII_MAP = hex"2d00020101000a010700016101620163016401650166016701680169016a016b016c016d016e016f0170017101720173017401750176017701780179017a06001a010500"; /// ========================== STORAGE ========================== /// mapping(string => address) public tokens; bytes1[] internal _idnamap; /// @dev Constructs this IE with `ASCII_MAP`. constructor() payable { unchecked { for (uint256 i; i != ASCII_MAP.length; i += 2) { bytes1 r = ASCII_MAP[i + 1]; for (uint8 j; j != uint8(ASCII_MAP[i]); ++j) { _idnamap.push(r); } } } } /// @dev Fallback setting `uniswapV3SwapCallback`. /// If ETH is swapped, WETH is forwarded. fallback() external payable virtual { SwapParams memory params; int256 amount0Delta; int256 amount1Delta; address payer; bool ethIn; bool ethOut; address tokenIn; address tokenOut; uint256 amountOutMinimum; assembly ( "memory-safe") { amount0Delta := calldataload(0x4) amount1Delta := calldataload(0x24) ethIn := byte(0, calldataload(0x84)) ethOut := byte(0, calldataload(add(0x84, 1))) payer := shr(96, calldataload(add(0x84, 2))) tokenIn := shr(96, calldataload(add(0x84, 22))) tokenOut := shr(96, calldataload(add(0x84, 42))) amountOutMinimum := calldataload(add(0x84, 62)) } params.ETHIn = ethIn; params.ETHOut = ethOut; params.tokenIn = tokenIn; params.tokenOut = tokenOut; params.amountOutMinimum = amountOutMinimum; if (amount0Delta <= 0 && amount1Delta <= 0) revert InvalidSwap(); (address pool, bool zeroForOne) = _computePoolAddress( params.tokenIn, params.tokenOut ); if (msg.sender != pool) revert Unauthorized(); // Only pair pool can call. uint256 amountOut = uint256( -(zeroForOne ? amount1Delta : amount0Delta) ); if (amountOut < params.amountOutMinimum) revert SlippageExceeded(); if (params.ETHIn) { _wrapETH(uint256(zeroForOne ? amount0Delta : amount1Delta)); } else { params.tokenIn.safeTransferFrom( payer, msg.sender, uint256(zeroForOne ? amount0Delta : amount1Delta) ); } if (params.ETHOut) { _unwrapETH(amountOut); payer.safeTransferETH(amountOut); } } /// ====================== COMMAND PREVIEW ====================== /// /// @notice Preview natural language smart contract command. /// The `send` syntax uses ENS naming: 'send vitalik 20 DAI'. /// `swap` syntax uses common format: 'swap 100 DAI for WETH'. function previewCommand(string calldata intent) public view virtual returns ( address to, // Receiver address. uint256 amount, // Formatted amount. address token, // Asset to send `to`. bytes memory callData, // Raw calldata for send transaction. bytes memory executeCallData // Anticipates common execute API. ) { string memory normalized = _lowercase(intent); bytes32 action = _extraction(normalized); if (action == "send" || action == "transfer") { ( string memory _to, string memory _amount, string memory _token ) = _extractSend(normalized); (to, amount, token, callData, executeCallData) = previewSend( _to, _amount, _token ); } else if (action == "swap" || action == "exchange") { ( string memory amountIn, string memory tokenIn, string memory tokenOut ) = _extractSwap(normalized); (amount, token, to) = previewSwap(amountIn, tokenIn, tokenOut); } else { revert InvalidSyntax(); // Invalid command format. } } /// @dev Previews a `send` command from the parts of a matched intent string. function previewSend( string memory to, string memory amount, string memory token ) public view virtual returns ( address _to, uint256 _amount, address _token, bytes memory callData, bytes memory executeCallData ) { _token = _returnTokenConstant(bytes32(bytes(token))); // Check constant. if (_token == address(0)) _token = tokens[token]; // Check storage. bool isETH = _token == ETH; // Memo whether the token is ETH or not. (, _to, ) = whatIsTheAddressOf(to); // Fetch receiver address from ENS. _amount = _stringToUint(amount, isETH ? 18 : _token.readDecimals()); if (!isETH) callData = abi.encodeCall(IToken.transfer, (_to, _amount)); executeCallData = abi.encodeCall( IExecutor.execute, (isETH ? _to : _token, isETH ? _amount : 0, callData) ); } /// @dev Previews a `swap` command from the parts of a matched intent string. function previewSwap( string memory amountIn, string memory tokenIn, string memory tokenOut ) public view virtual returns ( uint256 _amountIn, address _tokenIn, address _tokenOut ) { _tokenIn = _returnTokenConstant(bytes32(bytes(tokenIn))); if (_tokenIn == address(0)) _tokenIn = tokens[tokenIn]; _tokenOut = _returnTokenConstant(bytes32(bytes(tokenOut))); if (_tokenOut == address(0)) _tokenOut = tokens[tokenOut]; _amountIn = _stringToUint( amountIn, _tokenIn == ETH ? 18 : _tokenIn.readDecimals() ); } /// @dev Checks ERC4337 userOp against the output of the command intent. function checkUserOp(string calldata intent, UserOperation calldata userOp) public view virtual returns (bool) { (, , , , bytes memory executeCallData) = previewCommand(intent); if (executeCallData.length != userOp.callData.length) return false; return keccak256(executeCallData) == keccak256(userOp.callData); } /// @dev Checks packed ERC4337 userOp against the output of the command intent. function checkPackedUserOp( string calldata intent, PackedUserOperation calldata userOp ) public view virtual returns (bool) { (, , , , bytes memory executeCallData) = previewCommand(intent); if (executeCallData.length != userOp.callData.length) return false; return keccak256(executeCallData) == keccak256(userOp.callData); } /// @dev Checks and returns the canonical token address constant for a matched intent string. function _returnTokenConstant(bytes32 token) internal view virtual returns (address _token) { if (token == "eth" || token == "ether") return ETH; if (token == "usdc") return USDC; if (token == "usdt") return USDT; if (token == "dai") return DAI; if (token == "weth") return WETH; if (token == "pepecoin") return PEPECOIN; if (token == "basedai") return BASEDAI; if (token == "wbtc" || token == "btc" || token == "bitcoin") return WBTC; } /// ===================== COMMAND EXECUTION ===================== /// function command(string calldata intent, uint256 maxSlippageBps) public payable virtual { string memory normalized = _lowercase(intent); bytes32 action = _extraction(normalized); if (action == "send" || action == "transfer") { ( string memory to, string memory amount, string memory token ) = _extractSend(normalized); send(to, amount, token); } else if (action == "swap" || action == "exchange") { ( string memory amountIn, string memory tokenIn, string memory tokenOut ) = _extractSwap(normalized); swap(amountIn, tokenIn, tokenOut, maxSlippageBps); } else { revert InvalidSyntax(); // Invalid command format. } } /// @dev Executes a `send` command from the parts of a matched intent string. function send( string memory to, string memory amount, string memory token ) public payable virtual { address _token = _returnTokenConstant(bytes32(bytes(token))); if (_token == address(0)) _token = tokens[token]; (, address _to, ) = whatIsTheAddressOf(to); if (_token == ETH) { _to.safeTransferETH(_stringToUint(amount, 18)); } else { _token.safeTransferFrom( msg.sender, _to, _stringToUint(amount, _token.readDecimals()) ); } } function swap( string memory amountIn, string memory tokenIn, string memory tokenOut, uint256 maxSlippageBps ) public payable virtual { SwapParams memory params; params.tokenIn = _returnTokenConstant(bytes32(bytes(tokenIn))); if (params.tokenIn == address(0)) params.tokenIn = tokens[tokenIn]; params.tokenOut = _returnTokenConstant(bytes32(bytes(tokenOut))); if (params.tokenOut == address(0)) params.tokenOut = tokens[tokenOut]; params.ETHIn = params.tokenIn == ETH; params.ETHOut = params.tokenOut == ETH; if (params.ETHIn) params.tokenIn = WETH; if (params.ETHOut) params.tokenOut = WETH; params.amountIn = _stringToUint( amountIn, params.ETHIn ? 18 : params.tokenIn.readDecimals() ); if (params.amountIn >= 1 << 255) revert Overflow(); (address pool, bool zeroForOne) = _computePoolAddress( params.tokenIn, params.tokenOut ); params.amountOutMinimum = _calculateAmountOutMinimum( params.amountIn, maxSlippageBps ); _executeSwap(pool, zeroForOne, params); } function _executeSwap( address pool, bool zeroForOne, SwapParams memory params ) internal { ISwapRouter(pool).swap( !params.ETHOut ? msg.sender : address(this), zeroForOne, int256(params.amountIn), zeroForOne ? MIN_SQRT_RATIO_PLUS_ONE : MAX_SQRT_RATIO_MINUS_ONE, abi.encodePacked( params.ETHIn, params.ETHOut, msg.sender, params.tokenIn, params.tokenOut, params.amountOutMinimum ) ); } function _calculateAmountOutMinimum( uint256 amountIn, uint256 maxSlippageBps ) internal pure returns (uint256) { return (amountIn * (10000 - maxSlippageBps)) / 10000; } /// @dev Computes the create2 address for given token pair. function _computePoolAddress(address tokenA, address tokenB) internal view virtual returns (address pool, bool zeroForOne) { if (tokenA < tokenB) zeroForOne = true; else (tokenA, tokenB) = (tokenB, tokenA); pool = _computePairHash(tokenA, tokenB, 3000); // Mid fee. if (pool.code.length != 0) return (pool, zeroForOne); else pool = _computePairHash(tokenA, tokenB, 500); // Low fee. if (pool.code.length != 0) return (pool, zeroForOne); else pool = _computePairHash(tokenA, tokenB, 100); // Lowest fee. if (pool.code.length != 0) return (pool, zeroForOne); else pool = _computePairHash(tokenA, tokenB, 10000); // Highest fee. if (pool.code.length != 0) return (pool, zeroForOne); } /// @dev Computes the create2 deployment hash for given token pair. function _computePairHash( address token0, address token1, uint24 fee ) internal pure virtual returns (address pool) { bytes32 salt = keccak256(abi.encode(token0, token1, fee)); assembly ("memory-safe") { mstore8(0x00, 0xff) // Write the prefix. mstore(0x35, UNISWAP_V3_POOL_INIT_CODE_HASH) mstore(0x01, shl(96, UNISWAP_V3_FACTORY)) mstore(0x15, salt) pool := keccak256(0x00, 0x55) mstore(0x35, 0) // Restore overwritten. } } /// @dev Wraps an `amount` of ETH to WETH and funds pool caller for swap. function _wrapETH(uint256 amount) internal virtual { assembly ("memory-safe") { pop(call(gas(), WETH, amount, codesize(), 0x00, codesize(), 0x00)) mstore(0x14, caller()) // Store the `pool` argument. mstore(0x34, amount) // Store the `amount` argument. mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`. pop(call(gas(), WETH, 0, 0x10, 0x44, codesize(), 0x00)) mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Unwraps an `amount` of ETH from WETH for return. function _unwrapETH(uint256 amount) internal virtual { assembly ("memory-safe") { mstore(0x00, 0x2e1a7d4d) // `withdraw(uint256)`. mstore(0x20, amount) // Store the `amount` argument. pop(call(gas(), WETH, 0, 0x1c, 0x24, codesize(), 0x00)) } } /// @dev ETH receiver fallback. receive() external payable virtual { if (msg.sender != WETH) revert Unauthorized(); } /// ================== BALANCE & SUPPLY HELPERS ================== /// /// @dev Returns the balance of a named account in a named token. function whatIsTheBalanceOf( string calldata name, /*(bob)*/ /*in*/ string calldata token ) public view virtual returns (uint256 balance, uint256 balanceAdjusted) { (, address _name, ) = whatIsTheAddressOf(name); string memory normalized = _lowercase(token); address _token = _returnTokenConstant(bytes32(bytes(normalized))); if (_token == address(0)) _token = tokens[token]; bool isETH = _token == ETH; balance = isETH ? _name.balance : _token.balanceOf(_name); balanceAdjusted = balance / 10**(isETH ? 18 : _token.readDecimals()); } /// @dev Returns the total supply of a named token. function whatIsTheTotalSupplyOf(string calldata token) public view virtual returns (uint256 supply, uint256 supplyAdjusted) { address _token = _returnTokenConstant(bytes32(bytes(token))); if (_token == address(0)) _token = tokens[token]; if (_token == ETH) revert InvalidSyntax(); assembly ("memory-safe") { mstore(0x00, 0x18160ddd) // `totalSupply()`. if iszero(staticcall(gas(), _token, 0x1c, 0x04, 0x20, 0x20)) { revert(codesize(), 0x00) } supply := mload(0x20) } supplyAdjusted = supply / 10**_token.readDecimals(); } /// ====================== ENS VERIFICATION ====================== /// /// @dev Returns ENS name ownership details. function whatIsTheAddressOf(string memory name) public view virtual returns ( address owner, address receiver, bytes32 node ) { node = _namehash(string(abi.encodePacked(name, ".eth"))); owner = ENS_REGISTRY.owner(node); if (IENSHelper(owner) == ENS_WRAPPER) owner = ENS_WRAPPER.ownerOf(uint256(node)); receiver = IENSHelper(ENS_REGISTRY.resolver(node)).addr(node); // Fails on misname. } /// @dev Computes an ENS domain namehash. function _namehash(string memory domain) internal view virtual returns (bytes32 node) { // Process labels (in reverse order for namehash). uint256 i = bytes(domain).length; uint256 lastDot = i; unchecked { for (; i != 0; --i) { bytes1 c = bytes(domain)[i - 1]; if (c == ".") { node = keccak256( abi.encodePacked(node, _labelhash(domain, i, lastDot)) ); lastDot = i - 1; continue; } require(c < 0x80); bytes1 r = _idnamap[uint8(c)]; require(uint8(r) != uint8(Rule.DISALLOWED)); if (uint8(r) > 1) { bytes(domain)[i - 1] = r; } } } return keccak256(abi.encodePacked(node, _labelhash(domain, i, lastDot))); } /// @dev Computes an ENS domain labelhash given its start and end. function _labelhash( string memory domain, uint256 start, uint256 end ) internal pure virtual returns (bytes32 hash) { assembly ("memory-safe") { hash := keccak256(add(add(domain, 0x20), start), sub(end, start)) } } /// ========================= GOVERNANCE ========================= /// /// @dev Sets a public `name` tag for a given `token` address. Governed by tendiesVaultGuy. function setName(address token, string calldata name) public payable virtual { if (msg.sender != tendiesVaultGuy) revert Unauthorized(); string memory normalized = _lowercase(name); emit NameSet(tokens[normalized] = token, normalized); } /// @dev Sets a public name and ticker for a given `token` address. function setNameAndTicker(address token) public payable virtual { string memory normalizedName = _lowercase(token.readName()); string memory normalizedSymbol = _lowercase(token.readSymbol()); emit NameSet(tokens[normalizedName] = token, normalizedName); emit NameSet(tokens[normalizedSymbol] = token, normalizedSymbol); } /// ===================== STRING OPERATIONS ===================== /// /// @dev Returns copy of string in lowercase. /// Modified from Solady LibString `toCase`. function _lowercase(string memory subject) internal pure virtual returns (string memory result) { assembly ("memory-safe") { let length := mload(subject) if length { result := add(mload(0x40), 0x20) subject := add(subject, 1) let flags := shl(add(70, shl(5, 0)), 0x3ffffff) let w := not(0) for { let o := length } 1 { } { o := add(o, w) let b := and(0xff, mload(add(subject, o))) mstore8(add(result, o), xor(b, and(shr(b, flags), 0x20))) if iszero(o) { break } } result := mload(0x40) mstore(result, length) // Store the length. let last := add(add(result, 0x20), length) mstore(last, 0) // Zeroize the slot after the string. mstore(0x40, add(last, 0x20)) // Allocate the memory. } } } /// @dev Extracts the first word (action) as bytes32. function _extraction(string memory normalizedIntent) internal pure virtual returns (bytes32 result) { assembly ("memory-safe") { let str := add(normalizedIntent, 0x20) for { let i } lt(i, 0x20) { i := add(i, 1) } { let char := byte(0, mload(add(str, i))) if eq(char, 0x20) { break } result := or(result, shl(sub(248, mul(i, 8)), char)) } } } /// @dev Extract the key words of normalized `send` intent. function _extractSend(string memory normalizedIntent) internal pure virtual returns ( string memory to, string memory amount, string memory token ) { string[] memory parts = _split(normalizedIntent, " "); if (parts.length == 4) return (parts[1], parts[2], parts[3]); if (parts.length == 5) return (parts[4], parts[1], parts[2]); else revert InvalidSyntax(); // Command is not formatted. } /// @dev Extract the key words of normalized `swap` intent. function _extractSwap(string memory normalizedIntent) internal pure virtual returns ( string memory amountIn, string memory tokenIn, string memory tokenOut ) { string[] memory parts = _split(normalizedIntent, " "); if (parts.length == 5) return (parts[1], parts[2], parts[4]); else revert InvalidSyntax(); // Command is not formatted. } /// @dev Split the intent into an array of words. function _split(string memory base, string memory delimiter) internal pure virtual returns (string[] memory parts) { bytes memory baseBytes = bytes(base); bytes memory delimiterBytes = bytes(delimiter); uint256 count = 1; for ( uint256 i = 0; i < baseBytes.length - delimiterBytes.length + 1; i++ ) { bool isDelimiter = true; for (uint256 j = 0; j < delimiterBytes.length; j++) { if (baseBytes[i + j] != delimiterBytes[j]) { isDelimiter = false; break; } } if (isDelimiter) { count++; i += delimiterBytes.length - 1; } } parts = new string[](count); uint256 partIndex; uint256 start; for (uint256 i = 0; i <= baseBytes.length; i++) { if ( i == baseBytes.length || (i <= baseBytes.length - delimiterBytes.length && keccak256( abi.encodePacked( _slice(baseBytes, i, delimiterBytes.length) ) ) == keccak256(abi.encodePacked(delimiterBytes))) ) { parts[partIndex] = string(_slice(baseBytes, start, i - start)); partIndex++; start = i + delimiterBytes.length; i += delimiterBytes.length - 1; } } } function multiCommand(string calldata intent, uint256 maxSlippageBps) public payable virtual { string memory normalized = _lowercase(intent); string[] memory commands = _split(normalized, " and "); for (uint256 i = 0; i < commands.length; i++) { bytes32 action = _extraction(commands[i]); if (action == "swap" || action == "exchange") { ( string memory amountIn, string memory tokenIn, string memory tokenOut ) = _extractSwap(commands[i]); swap(amountIn, tokenIn, tokenOut, maxSlippageBps); } else if (action == "send" || action == "transfer") { ( string memory to, string memory amount, string memory token ) = _extractSend(commands[i]); send(to, amount, token); } else { revert InvalidSyntax(); // invalid command format. } } } function batchedSwap(string[] calldata swapCommands, uint256 maxSlippageBps) public payable virtual { uint256 totalETHIn = 0; uint256 initialETHBalance = address(this).balance; for (uint256 i = 0; i < swapCommands.length; i++) { string memory normalized = _lowercase(swapCommands[i]); (string memory amountIn, string memory tokenIn, ) = _extractSwap( normalized ); address _tokenIn = _returnTokenConstant(bytes32(bytes(tokenIn))); if (_tokenIn == ETH) { totalETHIn += _stringToUint(amountIn, 18); } } if (totalETHIn > 0) { if (msg.value < totalETHIn) revert InsufficientETHSent(); IWETH(WETH).deposit{value: totalETHIn}(); } for (uint256 i = 0; i < swapCommands.length; i++) { string memory normalized = _lowercase(swapCommands[i]); ( string memory amountIn, string memory tokenIn, string memory tokenOut ) = _extractSwap(normalized); try this.swap(amountIn, tokenIn, tokenOut, maxSlippageBps) { // succeeded } catch Error(string memory reason) { revert(string(abi.encodePacked("SwapFailed: ", reason))); } catch { revert SwapFailed(); } } // refund any excess ETH uint256 remainingETH = address(this).balance - initialETHBalance; if (remainingETH > 0) { payable(msg.sender).transfer(remainingETH); } } function _slice( bytes memory data, uint256 start, uint256 length ) internal pure returns (bytes memory) { bytes memory result = new bytes(length); for (uint256 i = 0; i < length; i++) { result[i] = data[start + i]; } return result; } /// @dev Convert string to decimalized numerical value. function _stringToUint(string memory s, uint8 decimals) internal pure virtual returns (uint256 result) { unchecked { bool hasDecimal; uint256 decimalPlaces; bytes memory b = bytes(s); for (uint256 i; i != b.length; ++i) { if (b[i] >= "0" && b[i] <= "9") { result = result * 10 + uint8(b[i]) - 48; if (hasDecimal) { ++decimalPlaces; if (decimalPlaces > decimals) { break; } } } else if (b[i] == "." && !hasDecimal) { hasDecimal = true; } else { revert InvalidCharacter(); } } if (decimalPlaces < decimals) { result *= 10**(decimals - decimalPlaces); } } } } /// @dev ENS name resolution helper contracts interface. interface IENSHelper { function addr(bytes32) external view returns (address); function owner(bytes32) external view returns (address); function ownerOf(uint256) external view returns (address); function resolver(bytes32) external view returns (address); } interface IWETH { function deposit() external payable; function withdraw(uint256) external; } /// @dev Simple token transfer interface. interface IToken { function transfer(address, uint256) external returns (bool); } /// @notice Simple calldata executor interface. interface IExecutor { function execute( address, uint256, bytes calldata ) external payable returns (bytes memory); } interface ISwapRouter { function swap( address recipient, bool zeroForOne, int256 amountSpecified, uint160 sqrtPriceLimitX96, bytes calldata data ) external returns (int256 amount0, int256 amount1); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Library for reading contract metadata robustly. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/MetadataReaderLib.sol) library MetadataReaderLib { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CONSTANTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Default gas stipend for contract reads. High enough for most practical use cases /// (able to SLOAD about 1000 bytes of data), but low enough to prevent griefing. uint256 internal constant GAS_STIPEND_NO_GRIEF = 100000; /// @dev Default string byte length limit. uint256 internal constant STRING_LIMIT_DEFAULT = 1000; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* METADATA READING OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ // Best-effort string reading operations. // Should NOT revert as long as sufficient gas is provided. // // Performs the following in order: // 1. Returns the empty string for the following cases: // - Reverts. // - No returndata (e.g. function returns nothing, EOA). // - Returns empty string. // 2. Attempts to `abi.decode` the returndata into a string. // 3. With any remaining gas, scans the returndata from start to end for the // null byte '\0', to interpret the returndata as a null-terminated string. /// @dev Equivalent to `readString(abi.encodeWithSignature("name()"))`. function readName(address target) internal view returns (string memory) { return _string(target, _ptr(0x06fdde03), STRING_LIMIT_DEFAULT, GAS_STIPEND_NO_GRIEF); } /// @dev Equivalent to `readString(abi.encodeWithSignature("name()"), limit)`. function readName(address target, uint256 limit) internal view returns (string memory) { return _string(target, _ptr(0x06fdde03), limit, GAS_STIPEND_NO_GRIEF); } /// @dev Equivalent to `readString(abi.encodeWithSignature("name()"), limit, gasStipend)`. function readName(address target, uint256 limit, uint256 gasStipend) internal view returns (string memory) { return _string(target, _ptr(0x06fdde03), limit, gasStipend); } /// @dev Equivalent to `readString(abi.encodeWithSignature("symbol()"))`. function readSymbol(address target) internal view returns (string memory) { return _string(target, _ptr(0x95d89b41), STRING_LIMIT_DEFAULT, GAS_STIPEND_NO_GRIEF); } /// @dev Equivalent to `readString(abi.encodeWithSignature("symbol()"), limit)`. function readSymbol(address target, uint256 limit) internal view returns (string memory) { return _string(target, _ptr(0x95d89b41), limit, GAS_STIPEND_NO_GRIEF); } /// @dev Equivalent to `readString(abi.encodeWithSignature("symbol()"), limit, gasStipend)`. function readSymbol(address target, uint256 limit, uint256 gasStipend) internal view returns (string memory) { return _string(target, _ptr(0x95d89b41), limit, gasStipend); } /// @dev Performs a best-effort string query on `target` with `data` as the calldata. /// The string will be truncated to `STRING_LIMIT_DEFAULT` (1000) bytes. function readString(address target, bytes memory data) internal view returns (string memory) { return _string(target, _ptr(data), STRING_LIMIT_DEFAULT, GAS_STIPEND_NO_GRIEF); } /// @dev Performs a best-effort string query on `target` with `data` as the calldata. /// The string will be truncated to `limit` bytes. function readString(address target, bytes memory data, uint256 limit) internal view returns (string memory) { return _string(target, _ptr(data), limit, GAS_STIPEND_NO_GRIEF); } /// @dev Performs a best-effort string query on `target` with `data` as the calldata. /// The string will be truncated to `limit` bytes. function readString(address target, bytes memory data, uint256 limit, uint256 gasStipend) internal view returns (string memory) { return _string(target, _ptr(data), limit, gasStipend); } // Best-effort unsigned integer reading operations. // Should NOT revert as long as sufficient gas is provided. // // Performs the following in order: // 1. Attempts to `abi.decode` the result into a uint256 // (equivalent across all Solidity uint types, downcast as needed). // 2. Returns zero for the following cases: // - Reverts. // - No returndata (e.g. function returns nothing, EOA). // - Returns zero. // - `abi.decode` failure. /// @dev Equivalent to `uint8(readUint(abi.encodeWithSignature("decimal()")))`. function readDecimals(address target) internal view returns (uint8) { return uint8(_uint(target, _ptr(0x313ce567), GAS_STIPEND_NO_GRIEF)); } /// @dev Equivalent to `uint8(readUint(abi.encodeWithSignature("decimal()"), gasStipend))`. function readDecimals(address target, uint256 gasStipend) internal view returns (uint8) { return uint8(_uint(target, _ptr(0x313ce567), gasStipend)); } /// @dev Performs a best-effort uint query on `target` with `data` as the calldata. function readUint(address target, bytes memory data) internal view returns (uint256) { return _uint(target, _ptr(data), GAS_STIPEND_NO_GRIEF); } /// @dev Performs a best-effort uint query on `target` with `data` as the calldata. function readUint(address target, bytes memory data, uint256 gasStipend) internal view returns (uint256) { return _uint(target, _ptr(data), gasStipend); } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PRIVATE HELPERS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Attempts to read and return a string at `target`. function _string(address target, bytes32 ptr, uint256 limit, uint256 gasStipend) private view returns (string memory result) { /// @solidity memory-safe-assembly assembly { function min(x_, y_) -> _z { _z := xor(x_, mul(xor(x_, y_), lt(y_, x_))) } for {} staticcall(gasStipend, target, add(ptr, 0x20), mload(ptr), 0x00, 0x20) {} { let m := mload(0x40) // Grab the free memory pointer. let s := add(0x20, m) // Start of the string's bytes in memory. // Attempt to `abi.decode` if the returndatasize is greater or equal to 64. if iszero(lt(returndatasize(), 0x40)) { let o := mload(0x00) // Load the string's offset in the returndata. // If the string's offset is within bounds. if iszero(gt(o, sub(returndatasize(), 0x20))) { returndatacopy(m, o, 0x20) // Copy the string's length. // If the full string's end is within bounds. // Note: If the full string doesn't fit, the `abi.decode` must be aborted // for compliance purposes, regardless if the truncated string can fit. if iszero(gt(mload(m), sub(returndatasize(), add(o, 0x20)))) { let n := min(mload(m), limit) // Truncate if needed. mstore(m, n) // Overwrite the length. returndatacopy(s, add(o, 0x20), n) // Copy the string's bytes. mstore(add(s, n), 0) // Zeroize the slot after the string. mstore(0x40, add(0x20, add(s, n))) // Allocate memory for the string. result := m break } } } // Try interpreting as a null-terminated string. let n := min(returndatasize(), limit) // Truncate if needed. returndatacopy(s, 0, n) // Copy the string's bytes. mstore8(add(s, n), 0) // Place a '\0' at the end. let i := s // Pointer to the next byte to scan. for {} byte(0, mload(i)) { i := add(i, 1) } {} // Scan for '\0'. mstore(m, sub(i, s)) // Store the string's length. mstore(i, 0) // Zeroize the slot after the string. mstore(0x40, add(0x20, i)) // Allocate memory for the string. result := m break } } } /// @dev Attempts to read and return a uint at `target`. function _uint(address target, bytes32 ptr, uint256 gasStipend) private view returns (uint256 result) { /// @solidity memory-safe-assembly assembly { result := mul( mload(0x20), and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x1f), // At least 32 bytes returned. staticcall(gasStipend, target, add(ptr, 0x20), mload(ptr), 0x20, 0x20) ) ) } } /// @dev Casts the function selector `s` into a pointer. function _ptr(uint256 s) private pure returns (bytes32 result) { /// @solidity memory-safe-assembly assembly { // Layout the calldata in the scratch space for temporary usage. mstore(0x04, s) // Store the function selector. mstore(result, 4) // Store the length. } } /// @dev Casts the `data` into a pointer. function _ptr(bytes memory data) private pure returns (bytes32 result) { /// @solidity memory-safe-assembly assembly { result := data } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/SafeTransferLib.sol) /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol) /// @author Permit2 operations from (https://github.com/Uniswap/permit2/blob/main/src/libraries/Permit2Lib.sol) /// /// @dev Note: /// - For ETH transfers, please use `forceSafeTransferETH` for DoS protection. /// - For ERC20s, this implementation won't check that a token has code, /// responsibility is delegated to the caller. library SafeTransferLib { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The ETH transfer has failed. error ETHTransferFailed(); /// @dev The ERC20 `transferFrom` has failed. error TransferFromFailed(); /// @dev The ERC20 `transfer` has failed. error TransferFailed(); /// @dev The ERC20 `approve` has failed. error ApproveFailed(); /// @dev The Permit2 operation has failed. error Permit2Failed(); /// @dev The Permit2 amount must be less than `2**160 - 1`. error Permit2AmountOverflow(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CONSTANTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Suggested gas stipend for contract receiving ETH that disallows any storage writes. uint256 internal constant GAS_STIPEND_NO_STORAGE_WRITES = 2300; /// @dev Suggested gas stipend for contract receiving ETH to perform a few /// storage reads and writes, but low enough to prevent griefing. uint256 internal constant GAS_STIPEND_NO_GRIEF = 100000; /// @dev The unique EIP-712 domain domain separator for the DAI token contract. bytes32 internal constant DAI_DOMAIN_SEPARATOR = 0xdbb8cf42e1ecb028be3f3dbc922e1d878b963f411dc388ced501601c60f7c6f7; /// @dev The address for the WETH9 contract on Ethereum mainnet. address internal constant WETH9 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; /// @dev The canonical Permit2 address. /// [Github](https://github.com/Uniswap/permit2) /// [Etherscan](https://etherscan.io/address/0x000000000022D473030F116dDEE9F6B43aC78BA3) address internal constant PERMIT2 = 0x000000000022D473030F116dDEE9F6B43aC78BA3; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ETH OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ // If the ETH transfer MUST succeed with a reasonable gas budget, use the force variants. // // The regular variants: // - Forwards all remaining gas to the target. // - Reverts if the target reverts. // - Reverts if the current contract has insufficient balance. // // The force variants: // - Forwards with an optional gas stipend // (defaults to `GAS_STIPEND_NO_GRIEF`, which is sufficient for most cases). // - If the target reverts, or if the gas stipend is exhausted, // creates a temporary contract to force send the ETH via `SELFDESTRUCT`. // Future compatible with `SENDALL`: https://eips.ethereum.org/EIPS/eip-4758. // - Reverts if the current contract has insufficient balance. // // The try variants: // - Forwards with a mandatory gas stipend. // - Instead of reverting, returns whether the transfer succeeded. /// @dev Sends `amount` (in wei) ETH to `to`. function safeTransferETH(address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { if iszero(call(gas(), to, amount, codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } } } /// @dev Sends all the ETH in the current contract to `to`. function safeTransferAllETH(address to) internal { /// @solidity memory-safe-assembly assembly { // Transfer all the ETH and check if it succeeded or not. if iszero(call(gas(), to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } } } /// @dev Force sends `amount` (in wei) ETH to `to`, with a `gasStipend`. function forceSafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal { /// @solidity memory-safe-assembly assembly { if lt(selfbalance(), amount) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } if iszero(call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. } } } /// @dev Force sends all the ETH in the current contract to `to`, with a `gasStipend`. function forceSafeTransferAllETH(address to, uint256 gasStipend) internal { /// @solidity memory-safe-assembly assembly { if iszero(call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. } } } /// @dev Force sends `amount` (in wei) ETH to `to`, with `GAS_STIPEND_NO_GRIEF`. function forceSafeTransferETH(address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { if lt(selfbalance(), amount) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } if iszero(call(GAS_STIPEND_NO_GRIEF, to, amount, codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. } } } /// @dev Force sends all the ETH in the current contract to `to`, with `GAS_STIPEND_NO_GRIEF`. function forceSafeTransferAllETH(address to) internal { /// @solidity memory-safe-assembly assembly { // forgefmt: disable-next-item if iszero(call(GAS_STIPEND_NO_GRIEF, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. } } } /// @dev Sends `amount` (in wei) ETH to `to`, with a `gasStipend`. function trySafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal returns (bool success) { /// @solidity memory-safe-assembly assembly { success := call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00) } } /// @dev Sends all the ETH in the current contract to `to`, with a `gasStipend`. function trySafeTransferAllETH(address to, uint256 gasStipend) internal returns (bool success) { /// @solidity memory-safe-assembly assembly { success := call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ERC20 OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Sends `amount` of ERC20 `token` from `from` to `to`. /// Reverts upon failure. /// /// The `from` account must have at least `amount` approved for /// the current contract to manage. function safeTransferFrom(address token, address from, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) // Cache the free memory pointer. mstore(0x60, amount) // Store the `amount` argument. mstore(0x40, to) // Store the `to` argument. mstore(0x2c, shl(96, from)) // Store the `from` argument. mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`. // Perform the transfer, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20) ) ) { mstore(0x00, 0x7939f424) // `TransferFromFailed()`. revert(0x1c, 0x04) } mstore(0x60, 0) // Restore the zero slot to zero. mstore(0x40, m) // Restore the free memory pointer. } } /// @dev Sends `amount` of ERC20 `token` from `from` to `to`. /// /// The `from` account must have at least `amount` approved for the current contract to manage. function trySafeTransferFrom(address token, address from, address to, uint256 amount) internal returns (bool success) { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) // Cache the free memory pointer. mstore(0x60, amount) // Store the `amount` argument. mstore(0x40, to) // Store the `to` argument. mstore(0x2c, shl(96, from)) // Store the `from` argument. mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`. success := and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20) ) mstore(0x60, 0) // Restore the zero slot to zero. mstore(0x40, m) // Restore the free memory pointer. } } /// @dev Sends all of ERC20 `token` from `from` to `to`. /// Reverts upon failure. /// /// The `from` account must have their entire balance approved for the current contract to manage. function safeTransferAllFrom(address token, address from, address to) internal returns (uint256 amount) { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) // Cache the free memory pointer. mstore(0x40, to) // Store the `to` argument. mstore(0x2c, shl(96, from)) // Store the `from` argument. mstore(0x0c, 0x70a08231000000000000000000000000) // `balanceOf(address)`. // Read the balance, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x1f), // At least 32 bytes returned. staticcall(gas(), token, 0x1c, 0x24, 0x60, 0x20) ) ) { mstore(0x00, 0x7939f424) // `TransferFromFailed()`. revert(0x1c, 0x04) } mstore(0x00, 0x23b872dd) // `transferFrom(address,address,uint256)`. amount := mload(0x60) // The `amount` is already at 0x60. We'll need to return it. // Perform the transfer, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20) ) ) { mstore(0x00, 0x7939f424) // `TransferFromFailed()`. revert(0x1c, 0x04) } mstore(0x60, 0) // Restore the zero slot to zero. mstore(0x40, m) // Restore the free memory pointer. } } /// @dev Sends `amount` of ERC20 `token` from the current contract to `to`. /// Reverts upon failure. function safeTransfer(address token, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { mstore(0x14, to) // Store the `to` argument. mstore(0x34, amount) // Store the `amount` argument. mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`. // Perform the transfer, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x00, 0x90b8ec18) // `TransferFailed()`. revert(0x1c, 0x04) } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Sends all of ERC20 `token` from the current contract to `to`. /// Reverts upon failure. function safeTransferAll(address token, address to) internal returns (uint256 amount) { /// @solidity memory-safe-assembly assembly { mstore(0x00, 0x70a08231) // Store the function selector of `balanceOf(address)`. mstore(0x20, address()) // Store the address of the current contract. // Read the balance, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x1f), // At least 32 bytes returned. staticcall(gas(), token, 0x1c, 0x24, 0x34, 0x20) ) ) { mstore(0x00, 0x90b8ec18) // `TransferFailed()`. revert(0x1c, 0x04) } mstore(0x14, to) // Store the `to` argument. amount := mload(0x34) // The `amount` is already at 0x34. We'll need to return it. mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`. // Perform the transfer, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x00, 0x90b8ec18) // `TransferFailed()`. revert(0x1c, 0x04) } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract. /// Reverts upon failure. function safeApprove(address token, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { mstore(0x14, to) // Store the `to` argument. mstore(0x34, amount) // Store the `amount` argument. mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. // Perform the approval, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`. revert(0x1c, 0x04) } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract. /// If the initial attempt to approve fails, attempts to reset the approved amount to zero, /// then retries the approval again (some tokens, e.g. USDT, requires this). /// Reverts upon failure. function safeApproveWithRetry(address token, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { mstore(0x14, to) // Store the `to` argument. mstore(0x34, amount) // Store the `amount` argument. mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. // Perform the approval, retrying upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x34, 0) // Store 0 for the `amount`. mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. pop(call(gas(), token, 0, 0x10, 0x44, codesize(), 0x00)) // Reset the approval. mstore(0x34, amount) // Store back the original `amount`. // Retry the approval, reverting upon failure. if iszero( and( or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`. revert(0x1c, 0x04) } } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Returns the amount of ERC20 `token` owned by `account`. /// Returns zero if the `token` does not exist. function balanceOf(address token, address account) internal view returns (uint256 amount) { /// @solidity memory-safe-assembly assembly { mstore(0x14, account) // Store the `account` argument. mstore(0x00, 0x70a08231000000000000000000000000) // `balanceOf(address)`. amount := mul( // The arguments of `mul` are evaluated from right to left. mload(0x20), and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x1f), // At least 32 bytes returned. staticcall(gas(), token, 0x10, 0x24, 0x20, 0x20) ) ) } } /// @dev Sends `amount` of ERC20 `token` from `from` to `to`. /// If the initial attempt fails, try to use Permit2 to transfer the token. /// Reverts upon failure. /// /// The `from` account must have at least `amount` approved for the current contract to manage. function safeTransferFrom2(address token, address from, address to, uint256 amount) internal { if (!trySafeTransferFrom(token, from, to, amount)) { permit2TransferFrom(token, from, to, amount); } } /// @dev Sends `amount` of ERC20 `token` from `from` to `to` via Permit2. /// Reverts upon failure. function permit2TransferFrom(address token, address from, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) mstore(add(m, 0x74), shr(96, shl(96, token))) mstore(add(m, 0x54), amount) mstore(add(m, 0x34), to) mstore(add(m, 0x20), shl(96, from)) // `transferFrom(address,address,uint160,address)`. mstore(m, 0x36c78516000000000000000000000000) let p := PERMIT2 let exists := eq(chainid(), 1) if iszero(exists) { exists := iszero(iszero(extcodesize(p))) } if iszero(and(call(gas(), p, 0, add(m, 0x10), 0x84, codesize(), 0x00), exists)) { mstore(0x00, 0x7939f4248757f0fd) // `TransferFromFailed()` or `Permit2AmountOverflow()`. revert(add(0x18, shl(2, iszero(iszero(shr(160, amount))))), 0x04) } } } /// @dev Permit a user to spend a given amount of /// another user's tokens via native EIP-2612 permit if possible, falling /// back to Permit2 if native permit fails or is not implemented on the token. function permit2( address token, address owner, address spender, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { bool success; /// @solidity memory-safe-assembly assembly { for {} shl(96, xor(token, WETH9)) {} { mstore(0x00, 0x3644e515) // `DOMAIN_SEPARATOR()`. if iszero( and( // The arguments of `and` are evaluated from right to left. lt(iszero(mload(0x00)), eq(returndatasize(), 0x20)), // Returns 1 non-zero word. // Gas stipend to limit gas burn for tokens that don't refund gas when // an non-existing function is called. 5K should be enough for a SLOAD. staticcall(5000, token, 0x1c, 0x04, 0x00, 0x20) ) ) { break } // After here, we can be sure that token is a contract. let m := mload(0x40) mstore(add(m, 0x34), spender) mstore(add(m, 0x20), shl(96, owner)) mstore(add(m, 0x74), deadline) if eq(mload(0x00), DAI_DOMAIN_SEPARATOR) { mstore(0x14, owner) mstore(0x00, 0x7ecebe00000000000000000000000000) // `nonces(address)`. mstore(add(m, 0x94), staticcall(gas(), token, 0x10, 0x24, add(m, 0x54), 0x20)) mstore(m, 0x8fcbaf0c000000000000000000000000) // `IDAIPermit.permit`. // `nonces` is already at `add(m, 0x54)`. // `1` is already stored at `add(m, 0x94)`. mstore(add(m, 0xb4), and(0xff, v)) mstore(add(m, 0xd4), r) mstore(add(m, 0xf4), s) success := call(gas(), token, 0, add(m, 0x10), 0x104, codesize(), 0x00) break } mstore(m, 0xd505accf000000000000000000000000) // `IERC20Permit.permit`. mstore(add(m, 0x54), amount) mstore(add(m, 0x94), and(0xff, v)) mstore(add(m, 0xb4), r) mstore(add(m, 0xd4), s) success := call(gas(), token, 0, add(m, 0x10), 0xe4, codesize(), 0x00) break } } if (!success) simplePermit2(token, owner, spender, amount, deadline, v, r, s); } /// @dev Simple permit on the Permit2 contract. function simplePermit2( address token, address owner, address spender, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) mstore(m, 0x927da105) // `allowance(address,address,address)`. { let addressMask := shr(96, not(0)) mstore(add(m, 0x20), and(addressMask, owner)) mstore(add(m, 0x40), and(addressMask, token)) mstore(add(m, 0x60), and(addressMask, spender)) mstore(add(m, 0xc0), and(addressMask, spender)) } let p := mul(PERMIT2, iszero(shr(160, amount))) if iszero( and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x5f), // Returns 3 words: `amount`, `expiration`, `nonce`. staticcall(gas(), p, add(m, 0x1c), 0x64, add(m, 0x60), 0x60) ) ) { mstore(0x00, 0x6b836e6b8757f0fd) // `Permit2Failed()` or `Permit2AmountOverflow()`. revert(add(0x18, shl(2, iszero(p))), 0x04) } mstore(m, 0x2b67b570) // `Permit2.permit` (PermitSingle variant). // `owner` is already `add(m, 0x20)`. // `token` is already at `add(m, 0x40)`. mstore(add(m, 0x60), amount) mstore(add(m, 0x80), 0xffffffffffff) // `expiration = type(uint48).max`. // `nonce` is already at `add(m, 0xa0)`. // `spender` is already at `add(m, 0xc0)`. mstore(add(m, 0xe0), deadline) mstore(add(m, 0x100), 0x100) // `signature` offset. mstore(add(m, 0x120), 0x41) // `signature` length. mstore(add(m, 0x140), r) mstore(add(m, 0x160), s) mstore(add(m, 0x180), shl(248, v)) if iszero(call(gas(), p, 0, add(m, 0x1c), 0x184, codesize(), 0x00)) { mstore(0x00, 0x6b836e6b) // `Permit2Failed()`. revert(0x1c, 0x04) } } } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"payable","type":"constructor"},{"inputs":[],"name":"InsufficientETHSent","type":"error"},{"inputs":[],"name":"InvalidCharacter","type":"error"},{"inputs":[],"name":"InvalidSwap","type":"error"},{"inputs":[],"name":"InvalidSyntax","type":"error"},{"inputs":[],"name":"Overflow","type":"error"},{"inputs":[],"name":"SlippageExceeded","type":"error"},{"inputs":[],"name":"SwapFailed","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"string","name":"name","type":"string"}],"name":"NameSet","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[{"internalType":"string[]","name":"swapCommands","type":"string[]"},{"internalType":"uint256","name":"maxSlippageBps","type":"uint256"}],"name":"batchedSwap","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"intent","type":"string"},{"components":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"bytes","name":"initCode","type":"bytes"},{"internalType":"bytes","name":"callData","type":"bytes"},{"internalType":"bytes32","name":"accountGasLimits","type":"bytes32"},{"internalType":"uint256","name":"preVerificationGas","type":"uint256"},{"internalType":"bytes32","name":"gasFees","type":"bytes32"},{"internalType":"bytes","name":"paymasterAndData","type":"bytes"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct IE_NANO_02.PackedUserOperation","name":"userOp","type":"tuple"}],"name":"checkPackedUserOp","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"intent","type":"string"},{"components":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"bytes","name":"initCode","type":"bytes"},{"internalType":"bytes","name":"callData","type":"bytes"},{"internalType":"uint256","name":"callGasLimit","type":"uint256"},{"internalType":"uint256","name":"verificationGasLimit","type":"uint256"},{"internalType":"uint256","name":"preVerificationGas","type":"uint256"},{"internalType":"uint256","name":"maxFeePerGas","type":"uint256"},{"internalType":"uint256","name":"maxPriorityFeePerGas","type":"uint256"},{"internalType":"bytes","name":"paymasterAndData","type":"bytes"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct IE_NANO_02.UserOperation","name":"userOp","type":"tuple"}],"name":"checkUserOp","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"intent","type":"string"},{"internalType":"uint256","name":"maxSlippageBps","type":"uint256"}],"name":"command","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"intent","type":"string"},{"internalType":"uint256","name":"maxSlippageBps","type":"uint256"}],"name":"multiCommand","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"intent","type":"string"}],"name":"previewCommand","outputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"token","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"},{"internalType":"bytes","name":"executeCallData","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"to","type":"string"},{"internalType":"string","name":"amount","type":"string"},{"internalType":"string","name":"token","type":"string"}],"name":"previewSend","outputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"},{"internalType":"bytes","name":"executeCallData","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"amountIn","type":"string"},{"internalType":"string","name":"tokenIn","type":"string"},{"internalType":"string","name":"tokenOut","type":"string"}],"name":"previewSwap","outputs":[{"internalType":"uint256","name":"_amountIn","type":"uint256"},{"internalType":"address","name":"_tokenIn","type":"address"},{"internalType":"address","name":"_tokenOut","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"to","type":"string"},{"internalType":"string","name":"amount","type":"string"},{"internalType":"string","name":"token","type":"string"}],"name":"send","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"string","name":"name","type":"string"}],"name":"setName","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"setNameAndTicker","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"amountIn","type":"string"},{"internalType":"string","name":"tokenIn","type":"string"},{"internalType":"string","name":"tokenOut","type":"string"},{"internalType":"uint256","name":"maxSlippageBps","type":"uint256"}],"name":"swap","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"","type":"string"}],"name":"tokens","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"}],"name":"whatIsTheAddressOf","outputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"bytes32","name":"node","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"token","type":"string"}],"name":"whatIsTheBalanceOf","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"balanceAdjusted","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"token","type":"string"}],"name":"whatIsTheTotalSupplyOf","outputs":[{"internalType":"uint256","name":"supply","type":"uint256"},{"internalType":"uint256","name":"supplyAdjusted","type":"uint256"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60806040525f5b604051806080016040528060448152602001612fce6044913951811461011e575f604051806080016040528060448152602001612fce60449139826001018151811061005457610054610124565b01602001517fff000000000000000000000000000000000000000000000000000000000000001690505f5b604051806080016040528060448152602001612fce6044913983815181106100a9576100a9610124565b60209101015160f81c60ff821614610114576001805480820182555f829052602081047fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf601805460f886901c601f9093166101000a92830260ff90930219169190911790550161007f565b5050600201610006565b50610138565b634e487b7160e01b5f52603260045260245ffd5b612e89806101455f395ff3fe6080604052600436106100f6575f3560e01c80638b9c93d411610089578063bf0213cd11610058578063bf0213cd1461046f578063bfe6867614610489578063c47d04e2146104a8578063ffec1028146104ed57610130565b80638b9c93d4146103d65780638ecdfcf914610405578063aa3aa14214610418578063b9395c1e1461045c57610130565b80632d8f63db116100c55780632d8f63db146103615780633121db1c146103805780633e704385146103935780635615264d146103c357610130565b806304c2320b146102ab578063109fe41f14610307578063258cbaf11461033b5780632c5b55c11461034e57610130565b36610130573373c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21461012e576040516282b42960e81b815260040160405180910390fd5b005b6040805160c0810182525f918101829052608435821a801515606080840191909152608535841a8015156080850152609a35821c80855260ae35831c6020860181905260c23560a087018190529596600435966024359660863590961c959493929188138015906101a157505f8713155b156101bf57604051631115766760e01b815260040160405180910390fd5b5f806101d28b5f01518c60200151610500565b9092509050336001600160a01b038316146101ff576040516282b42960e81b815260040160405180910390fd5b5f8161020b578a61020d565b895b610216906124b8565b90508b60a0015181101561023d57604051638199f5f360e01b815260040160405180910390fd5b8b60600151156102605761025b82610255578a61059e565b8b61059e565b610285565b610285893384610270578c610272565b8d5b8f516001600160a01b03169291906105f3565b8b608001511561012e5761029881610642565b61012e6001600160a01b038a168261066f565b3480156102b6575f80fd5b506102ea6102c5366004612581565b80516020818301810180515f825292820191909301209152546001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b348015610312575f80fd5b506103266103213660046125ef565b61068c565b604080519283526020830191909152016102fe565b61012e610349366004612644565b61076b565b61012e61035c36600461265f565b610889565b34801561036c575f80fd5b5061032661037b3660046126a6565b610a0b565b61012e61038e366004612710565b610b69565b34801561039e575f80fd5b506103b26103ad366004612760565b610c55565b6040516102fe959493929190612819565b61012e6103d1366004612760565b610dad565b3480156103e1575f80fd5b506103f56103f0366004612869565b610e7f565b60405190151581526020016102fe565b61012e6104133660046128d7565b610eea565b348015610423575f80fd5b50610437610432366004612760565b6110b4565b604080519384526001600160a01b0392831660208501529116908201526060016102fe565b61012e61046a36600461265f565b61118a565b34801561047a575f80fd5b506103f56103f036600461296a565b348015610494575f80fd5b506103b26104a33660046125ef565b611262565b3480156104b3575f80fd5b506104c76104c2366004612581565b611368565b604080516001600160a01b039485168152939092166020840152908201526060016102fe565b61012e6104fb3660046129cd565b611581565b5f80826001600160a01b0316846001600160a01b0316101561052457506001610528565b9192915b6105358484610bb8611845565b9150816001600160a01b03163b5f036105975761055584846101f4611845565b9150816001600160a01b03163b5f036105975761057484846064611845565b9150816001600160a01b03163b5f03610597576105948484612710611845565b91505b9250929050565b5f385f388473c02aaa39b223fe8d0a0e5c4f27ead9083c756cc25af150336014528060345263a9059cbb60601b5f525f38604460105f73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc25af1505f60345250565b60405181606052826040528360601b602c526323b872dd60601b600c5260205f6064601c5f895af13d1560015f5114171661063557637939f4245f526004601cfd5b5f60605260405250505050565b632e1a7d4d5f52806020525f386024601c5f73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc25af15050565b5f385f3884865af16106885763b12d13eb5f526004601cfd5b5050565b5f80806106a161069c8587612a40565b6118e5565b90506001600160a01b0381166106de575f85856040516106c2929190612a5d565b908152604051908190036020019020546001600160a01b031690505b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b0382160161071c57604051631e3382cb60e01b815260040160405180910390fd5b6318160ddd5f526020806004601c845afa610735575f38fd5b602051925061074c816001600160a01b0316611a70565b61075790600a612b4f565b6107619084612b5d565b9150509250929050565b5f610786610781836001600160a01b0316611a92565b611ab8565b90505f61079e610781846001600160a01b0316611b20565b9050825f836040516107b09190612b93565b90815260405190819003602001812080546001600160a01b03939093166001600160a01b0319909316831790557fa4cea56cd77acc2291276688ddfb9e3144c5dc056ada99eed3cd0460fbeda1759061080a908590612b9e565b60405180910390a2825f826040516108229190612b93565b90815260405190819003602001812080546001600160a01b03939093166001600160a01b0319909316831790557fa4cea56cd77acc2291276688ddfb9e3144c5dc056ada99eed3cd0460fbeda1759061087c908490612b9e565b60405180910390a2505050565b5f6108c884848080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250611ab892505050565b90505f6108f2826040518060400160405280600581526020016401030b732160dd1b815250611b3a565b90505f5b8151811015610a03575f61092283838151811061091557610915612bb0565b6020026020010151611d75565b905080630737761760e41b14806109435750806765786368616e676560c01b145b15610987575f805f61096d86868151811061096057610960612bb0565b6020026020010151611db5565b92509250925061097f8383838b610eea565b5050506109fa565b80631cd95b9960e21b14806109a6575080673a3930b739b332b960c11b145b156109e1575f805f6109d08686815181106109c3576109c3612bb0565b6020026020010151611e48565b92509250925061097f838383610dad565b604051631e3382cb60e01b815260040160405180910390fd5b506001016108f6565b505050505050565b5f805f610a4c87878080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525061136892505050565b509150505f610a8f86868080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250611ab892505050565b90505f610a9e61069c83612bc4565b90506001600160a01b038116610adb575f8787604051610abf929190612a5d565b908152604051908190036020019020546001600160a01b031690505b6001600160a01b03811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1480610b1857610b136001600160a01b03831685611f17565b610b24565b836001600160a01b0316315b955080610b4257610b3d826001600160a01b0316611a70565b610b45565b60125b610b5090600a612b4f565b610b5a9087612b5d565b94505050505094509492505050565b33736a111f7d28856385263eedba7e12b37e4eed799714610b9c576040516282b42960e81b815260040160405180910390fd5b5f610bdb83838080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250611ab892505050565b9050835f82604051610bed9190612b93565b90815260405190819003602001812080546001600160a01b03939093166001600160a01b0319909316831790557fa4cea56cd77acc2291276688ddfb9e3144c5dc056ada99eed3cd0460fbeda17590610c47908490612b9e565b60405180910390a250505050565b5f8080606080610c6761069c87612bc4565b92506001600160a01b038316610ca2575f86604051610c869190612b93565b908152604051908190036020019020546001600160a01b031692505b6001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14610ccb89611368565b509650610cf790508882610cf057610ceb866001600160a01b0316611a70565b611f41565b6012611f41565b945080610d47576040516001600160a01b03871660248201526044810186905260640160408051601f198184030181529190526020810180516001600160e01b031663a9059cbb60e01b17905292505b80610d525783610d54565b855b81610d5f575f610d61565b855b84604051602401610d7493929190612be7565b60408051601f198184030181529190526020810180516001600160e01b0316635b0e93fb60e11b17905295999498509296509094505050565b5f610dba61069c83612bc4565b90506001600160a01b038116610df5575f82604051610dd99190612b93565b908152604051908190036020019020546001600160a01b031690505b5f610dff85611368565b5091505073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b03831601610e4b57610e46610e36856012611f41565b6001600160a01b0383169061066f565b610e78565b610e783382610e6687610ceb876001600160a01b0316611a70565b6001600160a01b0386169291906105f3565b5050505050565b5f80610e8b8585611262565b945050505050828060600190610ea19190612c16565b9050815114610eb3575f915050610ee3565b610ec06060840184612c16565b604051610ece929190612a5d565b60405180910390208180519060200120149150505b9392505050565b6040805160c0810182525f80825260208201819052918101829052606081018290526080810182905260a0810191909152610f2761069c85612bc4565b6001600160a01b0316808252610f62575f84604051610f469190612b93565b908152604051908190036020019020546001600160a01b031681525b610f6e61069c84612bc4565b6001600160a01b031660208201819052610fb0575f83604051610f919190612b93565b90815260405160209181900382019020546001600160a01b0316908201525b805173eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b039182168114606084018190526020840151909216146080830152156110065773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281525b80608001511561102b5773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc260208201525b61104c858260600151610cf0578251610ceb906001600160a01b0316611a70565b60408201819052600160ff1b1161107657604051631a93c68960e11b815260040160405180910390fd5b5f80611089835f01518460200151610500565b9150915061109b836040015185612079565b60a08401526110ab82828561209b565b50505050505050565b5f80806110c361069c86612bc4565b91506001600160a01b0382166110fe575f856040516110e29190612b93565b908152604051908190036020019020546001600160a01b031691505b61110a61069c85612bc4565b90506001600160a01b038116611145575f846040516111299190612b93565b908152604051908190036020019020546001600160a01b031690505b61117f866001600160a01b03841673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14610cf057610ceb846001600160a01b0316611a70565b925093509350939050565b5f6111c984848080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250611ab892505050565b90505f6111d582611d75565b905080631cd95b9960e21b14806111f6575080673a3930b739b332b960c11b145b15611220575f805f61120785611e48565b925092509250611218838383610dad565b505050610e78565b80630737761760e41b148061123f5750806765786368616e676560c01b145b156109e1575f805f61125085611db5565b92509250925061121883838389610eea565b5f805f6060805f6112a788888080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250611ab892505050565b90505f6112b382611d75565b905080631cd95b9960e21b14806112d4575080673a3930b739b332b960c11b145b1561130b575f805f6112e585611e48565b9250925092506112f6838383610c55565b939d50919b5099509750955061135c92505050565b80630737761760e41b148061132a5750806765786368616e676560c01b145b156109e1575f805f61133b85611db5565b92509250925061134c8383836110b4565b9b50909950975061135c92505050565b50509295509295909350565b5f805f6113938460405160200161137f9190612c58565b6040516020818303038152906040526121c3565b6040516302571be360e01b8152600481018290529091506e0c2e074ec69a0dfb2997ba6c7d2e1e906302571be390602401602060405180830381865afa1580156113df573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114039190612c77565b925073d4416b13d2b3a9abae7acd5d6c2bbdbe25686400196001600160a01b0384160161149f576040516331a9108f60e11b81526004810182905273d4416b13d2b3a9abae7acd5d6c2bbdbe2568640190636352211e90602401602060405180830381865afa158015611478573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061149c9190612c77565b92505b604051630178b8bf60e01b8152600481018290526e0c2e074ec69a0dfb2997ba6c7d2e1e90630178b8bf90602401602060405180830381865afa1580156114e8573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061150c9190612c77565b6001600160a01b0316633b3b57de826040518263ffffffff1660e01b815260040161153991815260200190565b602060405180830381865afa158015611554573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906115789190612c77565b91509193909250565b5f47815b8481101561165d575f6115ee8787848181106115a3576115a3612bb0565b90506020028101906115b59190612c16565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250611ab892505050565b90505f806115fb83611db5565b50915091505f61160e8261069c90612bc4565b905073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b0382160161164d57611640836012611f41565b61164a9088612c92565b96505b5050600190920191506115859050565b5081156116ea57813410156116855760405163311c9fd160e01b815260040160405180910390fd5b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004015f604051808303818588803b1580156116d2575f80fd5b505af11580156116e4573d5f803e3d5ffd5b50505050505b5f5b84811015611807575f61170a8787848181106115a3576115a3612bb0565b90505f805f61171884611db5565b604051638ecdfcf960e01b815292955090935091503090638ecdfcf990611749908690869086908e90600401612ca5565b5f604051808303815f87803b158015611760575f80fd5b505af1925050508015611771575060015b6117f75761177d612cef565b806308c379a0036117dc5750611791612d08565b8061179c57506117de565b806040516020016117ad9190612d8a565b60408051601f198184030181529082905262461bcd60e51b82526117d391600401612b9e565b60405180910390fd5b505b60405163081ceff360e41b815260040160405180910390fd5b5050600190920191506116ec9050565b505f6118138247612daa565b90508015610a0357604051339082156108fc029083905f818181858888f193505050501580156110ab573d5f803e3d5ffd5b604080516001600160a01b03808616602083015284169181019190915262ffffff821660608201525f90819060800160405160208183030381529060405280519060200120905060ff5f537fe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54603552731f98431c8ad98523631ae4a59f267346ea31f98460601b6001528060155260555f2091505f603552509392505050565b5f81620cae8d60eb1b14806119015750816432ba3432b960d91b145b15611921575073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee919050565b81637573646360e01b0361194a575073a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48919050565b81631d5cd91d60e21b03611973575073dac17f958d2ee523a2206206994597c13d831ec7919050565b816264616960e81b0361199b5750736b175474e89094c44da98b954eedeac495271d0f919050565b81630eecae8d60e31b036119c4575073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2919050565b81673832b832b1b7b4b760c11b036119f1575073a9e8acf069c58aec8825542845fd754e41a9489a919050565b81666261736564616960c81b03611a1d57507344971abf0251958492fee97da3e5c5ada88b9185919050565b81637762746360e01b1480611a375750816262746360e81b145b80611a4b575081663134ba31b7b4b760c91b145b15611a6b5750732260fac5e5542a773aa44fbcfedf7c193bc2c599919050565b919050565b63313ce56760049081525f908152611a8c8282620186a061232b565b92915050565b6060611a8c82611aac6306fdde0360049081525f90815290565b6103e8620186a061234a565b606081518015611b1a576040516001939093019260200191506bffffffc000000000000000005f19825b81018581015160ff1683811c6020168118868301535080611ae25750505060405191508082528060208301015f815260208101604052505b50919050565b6060611a8c82611aac6395d89b4160049081525f90815290565b6060828260015f5b82518451611b509190612daa565b611b5b906001612c92565b811015611c115760015f5b8451811015611bcf57848181518110611b8157611b81612bb0565b01602001516001600160f81b03191686611b9b8386612c92565b81518110611bab57611bab612bb0565b01602001516001600160f81b03191614611bc7575f9150611bcf565b600101611b66565b508015611bfe5782611be081612dbd565b93505060018451611bf19190612daa565b611bfb9083612c92565b91505b5080611c0981612dbd565b915050611b42565b50806001600160401b03811115611c2a57611c2a6124d2565b604051908082528060200260200182016040528015611c5d57816020015b6060815260200190600190039081611c485790505b5093505f805f5b85518111611d69578551811480611ce9575084518651611c849190612daa565b8111158015611ce9575084604051602001611c9f9190612b93565b60405160208183030381529060405280519060200120611cc1878388516123f3565b604051602001611cd19190612b93565b60405160208183030381529060405280519060200120145b15611d5757611d028683611cfd8185612daa565b6123f3565b878481518110611d1457611d14612bb0565b60200260200101819052508280611d2a90612dbd565b935050845181611d3a9190612c92565b915060018551611d4a9190612daa565b611d549082612c92565b90505b80611d6181612dbd565b915050611c64565b50505050505092915050565b5f602082015f5b6020811015611dae57808201515f1a60208103611d995750611dae565b6008820260f8031b9290921791600101611d7c565b5050919050565b60608060605f611dde85604051806040016040528060018152602001600160fd1b815250611b3a565b905080516005036109e15780600181518110611dfc57611dfc612bb0565b602002602001015181600281518110611e1757611e17612bb0565b602002602001015182600481518110611e3257611e32612bb0565b6020026020010151935093509350509193909250565b60608060605f611e7185604051806040016040528060018152602001600160fd1b815250611b3a565b90508051600403611ec55780600181518110611e8f57611e8f612bb0565b602002602001015181600281518110611eaa57611eaa612bb0565b602002602001015182600381518110611e3257611e32612bb0565b80516005036109e15780600481518110611ee157611ee1612bb0565b602002602001015181600181518110611efc57611efc612bb0565b602002602001015182600281518110611e3257611e32612bb0565b5f816014526370a0823160601b5f5260208060246010865afa601f3d111660205102905092915050565b5f808084815b8151811461205657600360fc1b828281518110611f6657611f66612bb0565b01602001516001600160f81b03191610801590611fa75750603960f81b828281518110611f9557611f95612bb0565b01602001516001600160f81b03191611155b15611ff5576030828281518110611fc057611fc0612bb0565b602001015160f81c60f81b60f81c60ff1686600a02010394508315611ff0578260010192508560ff168311612056575b61204e565b81818151811061200757612007612bb0565b6020910101516001600160f81b031916601760f91b148015612027575083155b15612035576001935061204e565b6040516318954fab60e11b815260040160405180910390fd5b600101611f47565b508460ff1682101561207057818560ff1603600a0a840293505b50505092915050565b5f6127106120878382612daa565b6120919085612dd5565b610ee39190612b5d565b826001600160a01b031663128acb088260800151156120ba57306120bc565b335b848460400151866120e15773fffd8963efd1fc6a506488495d951d5263988d256120e8565b6401000276a45b606087810151608089015189516020808c015160a08d015160405195151560f890811b9387019390935293151590911b60218501526bffffffffffffffffffffffff1933861b8116602286015291851b8216603685015290931b909216604a820152605e810191909152607e016040516020818303038152906040526040518663ffffffff1660e01b8152600401612184959493929190612dec565b60408051808303815f875af115801561219f573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e789190612e31565b80515f90805b81156122ee575f8460018403815181106121e5576121e5612bb0565b01602001516001600160f81b0319169050601760f91b81900361224457828203602084870101208490604080516020810193909352820152606001604051602081830303815290604052805190602001209350600183039150506122e3565b600160ff1b6001600160f81b031982161061225d575f80fd5b5f60018260f81c60ff168154811061227757612277612bb0565b5f91825260208083209082040154601f9091166101000a900460f81b915060ff1660f882901c036122a6575f80fd5b600160f882901c11156122e057808660018603815181106122c9576122c9612bb0565b60200101906001600160f81b03191690815f1a9053505b50505b5f19909101906121c9565b8181036020838601012083906040805160208101939093528201526060016040516020818303038152906040528051906020012092505050919050565b5f6020808451602086018786fa601f3d11166020510290509392505050565b606060205f8551602087018886fa156123eb576040518060200160403d106123b4575f5160203d0381116123b257602081843e602081013d038351116123b257825186811181881802188084528060208301843e5f92019182525060200160405290506123eb565b505b3d8581118187180218805f833e5f8183015350805b80515f1a156123da576001016123c9565b90810382525f815260200160405290505b949350505050565b60605f826001600160401b0381111561240e5761240e6124d2565b6040519080825280601f01601f191660200182016040528015612438576020820181803683370190505b5090505f5b8381101561249b57856124508287612c92565b8151811061246057612460612bb0565b602001015160f81c60f81b82828151811061247d5761247d612bb0565b60200101906001600160f81b03191690815f1a90535060010161243d565b50949350505050565b634e487b7160e01b5f52601160045260245ffd5b5f600160ff1b82016124cc576124cc6124a4565b505f0390565b634e487b7160e01b5f52604160045260245ffd5b601f8201601f191681016001600160401b038111828210171561250b5761250b6124d2565b6040525050565b5f82601f830112612521575f80fd5b81356001600160401b0381111561253a5761253a6124d2565b604051612551601f8301601f1916602001826124e6565b818152846020838601011115612565575f80fd5b816020850160208301375f918101602001919091529392505050565b5f60208284031215612591575f80fd5b81356001600160401b038111156125a6575f80fd5b6123eb84828501612512565b5f8083601f8401126125c2575f80fd5b5081356001600160401b038111156125d8575f80fd5b602083019150836020828501011115610597575f80fd5b5f8060208385031215612600575f80fd5b82356001600160401b03811115612615575f80fd5b612621858286016125b2565b90969095509350505050565b6001600160a01b0381168114612641575f80fd5b50565b5f60208284031215612654575f80fd5b8135610ee38161262d565b5f805f60408486031215612671575f80fd5b83356001600160401b03811115612686575f80fd5b612692868287016125b2565b909790965060209590950135949350505050565b5f805f80604085870312156126b9575f80fd5b84356001600160401b038111156126ce575f80fd5b6126da878288016125b2565b90955093505060208501356001600160401b038111156126f8575f80fd5b612704878288016125b2565b95989497509550505050565b5f805f60408486031215612722575f80fd5b833561272d8161262d565b925060208401356001600160401b03811115612747575f80fd5b612753868287016125b2565b9497909650939450505050565b5f805f60608486031215612772575f80fd5b83356001600160401b03811115612787575f80fd5b61279386828701612512565b93505060208401356001600160401b038111156127ae575f80fd5b6127ba86828701612512565b92505060408401356001600160401b038111156127d5575f80fd5b6127e186828701612512565b9150509250925092565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b6001600160a01b038681168252602082018690528416604082015260a0606082018190525f9061284b908301856127eb565b828103608084015261285d81856127eb565b98975050505050505050565b5f805f6040848603121561287b575f80fd5b83356001600160401b03811115612890575f80fd5b61289c868287016125b2565b90945092505060208401356001600160401b038111156128ba575f80fd5b840161012081870312156128cc575f80fd5b809150509250925092565b5f805f80608085870312156128ea575f80fd5b84356001600160401b038111156128ff575f80fd5b61290b87828801612512565b94505060208501356001600160401b03811115612926575f80fd5b61293287828801612512565b93505060408501356001600160401b0381111561294d575f80fd5b61295987828801612512565b949793965093946060013593505050565b5f805f6040848603121561297c575f80fd5b83356001600160401b03811115612991575f80fd5b61299d868287016125b2565b90945092505060208401356001600160401b038111156129bb575f80fd5b840161016081870312156128cc575f80fd5b5f805f604084860312156129df575f80fd5b83356001600160401b038111156129f4575f80fd5b8401601f81018613612a04575f80fd5b80356001600160401b03811115612a19575f80fd5b8660208260051b8401011115612a2d575f80fd5b6020918201979096509401359392505050565b80356020831015611a8c575f19602084900360031b1b1692915050565b818382375f9101908152919050565b6001815b6001841115612aa757808504811115612a8b57612a8b6124a4565b6001841615612a9957908102905b60019390931c928002612a70565b935093915050565b5f82612abd57506001611a8c565b81612ac957505f611a8c565b8160018114612adf5760028114612ae957612b05565b6001915050611a8c565b60ff841115612afa57612afa6124a4565b50506001821b611a8c565b5060208310610133831016604e8410600b8410161715612b28575081810a611a8c565b612b345f198484612a6c565b805f1904821115612b4757612b476124a4565b029392505050565b5f610ee360ff841683612aaf565b5f82612b7757634e487b7160e01b5f52601260045260245ffd5b500490565b5f81518060208401855e5f93019283525090919050565b5f610ee38284612b7c565b602081525f610ee360208301846127eb565b634e487b7160e01b5f52603260045260245ffd5b80516020808301519190811015611b1a575f1960209190910360031b1b16919050565b60018060a01b0384168152826020820152606060408201525f612c0d60608301846127eb565b95945050505050565b5f808335601e19843603018112612c2b575f80fd5b8301803591506001600160401b03821115612c44575f80fd5b602001915036819003821315610597575f80fd5b5f612c638284612b7c565b6305ccae8d60e31b81526004019392505050565b5f60208284031215612c87575f80fd5b8151610ee38161262d565b80820180821115611a8c57611a8c6124a4565b608081525f612cb760808301876127eb565b8281036020840152612cc981876127eb565b90508281036040840152612cdd81866127eb565b91505082606083015295945050505050565b5f60033d1115612d055760045f803e505f5160e01c5b90565b5f60443d1015612d155790565b6040513d600319016004823e80513d60248201116001600160401b0382111715612d3e57505090565b80820180516001600160401b03811115612d59575050505090565b3d8401600319018282016020011115612d73575050505090565b612d82602082850101856124e6565b509392505050565b6b029bbb0b82330b4b632b21d160a51b81525f610ee3600c830184612b7c565b81810381811115611a8c57611a8c6124a4565b5f60018201612dce57612dce6124a4565b5060010190565b8082028115828204841417611a8c57611a8c6124a4565b6001600160a01b0386811682528515156020830152604082018590528316606082015260a0608082018190525f90612e26908301846127eb565b979650505050505050565b5f8060408385031215612e42575f80fd5b50508051602090910151909290915056fea26469706673582212202a6335d5532aafe3204ed4b450744e78a96f88fdb0d5761cce1a791434e021b364736f6c634300081a00332d00020101000a010700016101620163016401650166016701680169016a016b016c016d016e016f0170017101720173017401750176017701780179017a06001a010500
Deployed Bytecode
0x6080604052600436106100f6575f3560e01c80638b9c93d411610089578063bf0213cd11610058578063bf0213cd1461046f578063bfe6867614610489578063c47d04e2146104a8578063ffec1028146104ed57610130565b80638b9c93d4146103d65780638ecdfcf914610405578063aa3aa14214610418578063b9395c1e1461045c57610130565b80632d8f63db116100c55780632d8f63db146103615780633121db1c146103805780633e704385146103935780635615264d146103c357610130565b806304c2320b146102ab578063109fe41f14610307578063258cbaf11461033b5780632c5b55c11461034e57610130565b36610130573373c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21461012e576040516282b42960e81b815260040160405180910390fd5b005b6040805160c0810182525f918101829052608435821a801515606080840191909152608535841a8015156080850152609a35821c80855260ae35831c6020860181905260c23560a087018190529596600435966024359660863590961c959493929188138015906101a157505f8713155b156101bf57604051631115766760e01b815260040160405180910390fd5b5f806101d28b5f01518c60200151610500565b9092509050336001600160a01b038316146101ff576040516282b42960e81b815260040160405180910390fd5b5f8161020b578a61020d565b895b610216906124b8565b90508b60a0015181101561023d57604051638199f5f360e01b815260040160405180910390fd5b8b60600151156102605761025b82610255578a61059e565b8b61059e565b610285565b610285893384610270578c610272565b8d5b8f516001600160a01b03169291906105f3565b8b608001511561012e5761029881610642565b61012e6001600160a01b038a168261066f565b3480156102b6575f80fd5b506102ea6102c5366004612581565b80516020818301810180515f825292820191909301209152546001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b348015610312575f80fd5b506103266103213660046125ef565b61068c565b604080519283526020830191909152016102fe565b61012e610349366004612644565b61076b565b61012e61035c36600461265f565b610889565b34801561036c575f80fd5b5061032661037b3660046126a6565b610a0b565b61012e61038e366004612710565b610b69565b34801561039e575f80fd5b506103b26103ad366004612760565b610c55565b6040516102fe959493929190612819565b61012e6103d1366004612760565b610dad565b3480156103e1575f80fd5b506103f56103f0366004612869565b610e7f565b60405190151581526020016102fe565b61012e6104133660046128d7565b610eea565b348015610423575f80fd5b50610437610432366004612760565b6110b4565b604080519384526001600160a01b0392831660208501529116908201526060016102fe565b61012e61046a36600461265f565b61118a565b34801561047a575f80fd5b506103f56103f036600461296a565b348015610494575f80fd5b506103b26104a33660046125ef565b611262565b3480156104b3575f80fd5b506104c76104c2366004612581565b611368565b604080516001600160a01b039485168152939092166020840152908201526060016102fe565b61012e6104fb3660046129cd565b611581565b5f80826001600160a01b0316846001600160a01b0316101561052457506001610528565b9192915b6105358484610bb8611845565b9150816001600160a01b03163b5f036105975761055584846101f4611845565b9150816001600160a01b03163b5f036105975761057484846064611845565b9150816001600160a01b03163b5f03610597576105948484612710611845565b91505b9250929050565b5f385f388473c02aaa39b223fe8d0a0e5c4f27ead9083c756cc25af150336014528060345263a9059cbb60601b5f525f38604460105f73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc25af1505f60345250565b60405181606052826040528360601b602c526323b872dd60601b600c5260205f6064601c5f895af13d1560015f5114171661063557637939f4245f526004601cfd5b5f60605260405250505050565b632e1a7d4d5f52806020525f386024601c5f73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc25af15050565b5f385f3884865af16106885763b12d13eb5f526004601cfd5b5050565b5f80806106a161069c8587612a40565b6118e5565b90506001600160a01b0381166106de575f85856040516106c2929190612a5d565b908152604051908190036020019020546001600160a01b031690505b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b0382160161071c57604051631e3382cb60e01b815260040160405180910390fd5b6318160ddd5f526020806004601c845afa610735575f38fd5b602051925061074c816001600160a01b0316611a70565b61075790600a612b4f565b6107619084612b5d565b9150509250929050565b5f610786610781836001600160a01b0316611a92565b611ab8565b90505f61079e610781846001600160a01b0316611b20565b9050825f836040516107b09190612b93565b90815260405190819003602001812080546001600160a01b03939093166001600160a01b0319909316831790557fa4cea56cd77acc2291276688ddfb9e3144c5dc056ada99eed3cd0460fbeda1759061080a908590612b9e565b60405180910390a2825f826040516108229190612b93565b90815260405190819003602001812080546001600160a01b03939093166001600160a01b0319909316831790557fa4cea56cd77acc2291276688ddfb9e3144c5dc056ada99eed3cd0460fbeda1759061087c908490612b9e565b60405180910390a2505050565b5f6108c884848080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250611ab892505050565b90505f6108f2826040518060400160405280600581526020016401030b732160dd1b815250611b3a565b90505f5b8151811015610a03575f61092283838151811061091557610915612bb0565b6020026020010151611d75565b905080630737761760e41b14806109435750806765786368616e676560c01b145b15610987575f805f61096d86868151811061096057610960612bb0565b6020026020010151611db5565b92509250925061097f8383838b610eea565b5050506109fa565b80631cd95b9960e21b14806109a6575080673a3930b739b332b960c11b145b156109e1575f805f6109d08686815181106109c3576109c3612bb0565b6020026020010151611e48565b92509250925061097f838383610dad565b604051631e3382cb60e01b815260040160405180910390fd5b506001016108f6565b505050505050565b5f805f610a4c87878080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525061136892505050565b509150505f610a8f86868080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250611ab892505050565b90505f610a9e61069c83612bc4565b90506001600160a01b038116610adb575f8787604051610abf929190612a5d565b908152604051908190036020019020546001600160a01b031690505b6001600160a01b03811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1480610b1857610b136001600160a01b03831685611f17565b610b24565b836001600160a01b0316315b955080610b4257610b3d826001600160a01b0316611a70565b610b45565b60125b610b5090600a612b4f565b610b5a9087612b5d565b94505050505094509492505050565b33736a111f7d28856385263eedba7e12b37e4eed799714610b9c576040516282b42960e81b815260040160405180910390fd5b5f610bdb83838080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250611ab892505050565b9050835f82604051610bed9190612b93565b90815260405190819003602001812080546001600160a01b03939093166001600160a01b0319909316831790557fa4cea56cd77acc2291276688ddfb9e3144c5dc056ada99eed3cd0460fbeda17590610c47908490612b9e565b60405180910390a250505050565b5f8080606080610c6761069c87612bc4565b92506001600160a01b038316610ca2575f86604051610c869190612b93565b908152604051908190036020019020546001600160a01b031692505b6001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14610ccb89611368565b509650610cf790508882610cf057610ceb866001600160a01b0316611a70565b611f41565b6012611f41565b945080610d47576040516001600160a01b03871660248201526044810186905260640160408051601f198184030181529190526020810180516001600160e01b031663a9059cbb60e01b17905292505b80610d525783610d54565b855b81610d5f575f610d61565b855b84604051602401610d7493929190612be7565b60408051601f198184030181529190526020810180516001600160e01b0316635b0e93fb60e11b17905295999498509296509094505050565b5f610dba61069c83612bc4565b90506001600160a01b038116610df5575f82604051610dd99190612b93565b908152604051908190036020019020546001600160a01b031690505b5f610dff85611368565b5091505073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b03831601610e4b57610e46610e36856012611f41565b6001600160a01b0383169061066f565b610e78565b610e783382610e6687610ceb876001600160a01b0316611a70565b6001600160a01b0386169291906105f3565b5050505050565b5f80610e8b8585611262565b945050505050828060600190610ea19190612c16565b9050815114610eb3575f915050610ee3565b610ec06060840184612c16565b604051610ece929190612a5d565b60405180910390208180519060200120149150505b9392505050565b6040805160c0810182525f80825260208201819052918101829052606081018290526080810182905260a0810191909152610f2761069c85612bc4565b6001600160a01b0316808252610f62575f84604051610f469190612b93565b908152604051908190036020019020546001600160a01b031681525b610f6e61069c84612bc4565b6001600160a01b031660208201819052610fb0575f83604051610f919190612b93565b90815260405160209181900382019020546001600160a01b0316908201525b805173eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b039182168114606084018190526020840151909216146080830152156110065773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281525b80608001511561102b5773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc260208201525b61104c858260600151610cf0578251610ceb906001600160a01b0316611a70565b60408201819052600160ff1b1161107657604051631a93c68960e11b815260040160405180910390fd5b5f80611089835f01518460200151610500565b9150915061109b836040015185612079565b60a08401526110ab82828561209b565b50505050505050565b5f80806110c361069c86612bc4565b91506001600160a01b0382166110fe575f856040516110e29190612b93565b908152604051908190036020019020546001600160a01b031691505b61110a61069c85612bc4565b90506001600160a01b038116611145575f846040516111299190612b93565b908152604051908190036020019020546001600160a01b031690505b61117f866001600160a01b03841673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14610cf057610ceb846001600160a01b0316611a70565b925093509350939050565b5f6111c984848080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250611ab892505050565b90505f6111d582611d75565b905080631cd95b9960e21b14806111f6575080673a3930b739b332b960c11b145b15611220575f805f61120785611e48565b925092509250611218838383610dad565b505050610e78565b80630737761760e41b148061123f5750806765786368616e676560c01b145b156109e1575f805f61125085611db5565b92509250925061121883838389610eea565b5f805f6060805f6112a788888080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250611ab892505050565b90505f6112b382611d75565b905080631cd95b9960e21b14806112d4575080673a3930b739b332b960c11b145b1561130b575f805f6112e585611e48565b9250925092506112f6838383610c55565b939d50919b5099509750955061135c92505050565b80630737761760e41b148061132a5750806765786368616e676560c01b145b156109e1575f805f61133b85611db5565b92509250925061134c8383836110b4565b9b50909950975061135c92505050565b50509295509295909350565b5f805f6113938460405160200161137f9190612c58565b6040516020818303038152906040526121c3565b6040516302571be360e01b8152600481018290529091506e0c2e074ec69a0dfb2997ba6c7d2e1e906302571be390602401602060405180830381865afa1580156113df573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114039190612c77565b925073d4416b13d2b3a9abae7acd5d6c2bbdbe25686400196001600160a01b0384160161149f576040516331a9108f60e11b81526004810182905273d4416b13d2b3a9abae7acd5d6c2bbdbe2568640190636352211e90602401602060405180830381865afa158015611478573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061149c9190612c77565b92505b604051630178b8bf60e01b8152600481018290526e0c2e074ec69a0dfb2997ba6c7d2e1e90630178b8bf90602401602060405180830381865afa1580156114e8573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061150c9190612c77565b6001600160a01b0316633b3b57de826040518263ffffffff1660e01b815260040161153991815260200190565b602060405180830381865afa158015611554573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906115789190612c77565b91509193909250565b5f47815b8481101561165d575f6115ee8787848181106115a3576115a3612bb0565b90506020028101906115b59190612c16565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250611ab892505050565b90505f806115fb83611db5565b50915091505f61160e8261069c90612bc4565b905073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeed196001600160a01b0382160161164d57611640836012611f41565b61164a9088612c92565b96505b5050600190920191506115859050565b5081156116ea57813410156116855760405163311c9fd160e01b815260040160405180910390fd5b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004015f604051808303818588803b1580156116d2575f80fd5b505af11580156116e4573d5f803e3d5ffd5b50505050505b5f5b84811015611807575f61170a8787848181106115a3576115a3612bb0565b90505f805f61171884611db5565b604051638ecdfcf960e01b815292955090935091503090638ecdfcf990611749908690869086908e90600401612ca5565b5f604051808303815f87803b158015611760575f80fd5b505af1925050508015611771575060015b6117f75761177d612cef565b806308c379a0036117dc5750611791612d08565b8061179c57506117de565b806040516020016117ad9190612d8a565b60408051601f198184030181529082905262461bcd60e51b82526117d391600401612b9e565b60405180910390fd5b505b60405163081ceff360e41b815260040160405180910390fd5b5050600190920191506116ec9050565b505f6118138247612daa565b90508015610a0357604051339082156108fc029083905f818181858888f193505050501580156110ab573d5f803e3d5ffd5b604080516001600160a01b03808616602083015284169181019190915262ffffff821660608201525f90819060800160405160208183030381529060405280519060200120905060ff5f537fe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54603552731f98431c8ad98523631ae4a59f267346ea31f98460601b6001528060155260555f2091505f603552509392505050565b5f81620cae8d60eb1b14806119015750816432ba3432b960d91b145b15611921575073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee919050565b81637573646360e01b0361194a575073a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48919050565b81631d5cd91d60e21b03611973575073dac17f958d2ee523a2206206994597c13d831ec7919050565b816264616960e81b0361199b5750736b175474e89094c44da98b954eedeac495271d0f919050565b81630eecae8d60e31b036119c4575073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2919050565b81673832b832b1b7b4b760c11b036119f1575073a9e8acf069c58aec8825542845fd754e41a9489a919050565b81666261736564616960c81b03611a1d57507344971abf0251958492fee97da3e5c5ada88b9185919050565b81637762746360e01b1480611a375750816262746360e81b145b80611a4b575081663134ba31b7b4b760c91b145b15611a6b5750732260fac5e5542a773aa44fbcfedf7c193bc2c599919050565b919050565b63313ce56760049081525f908152611a8c8282620186a061232b565b92915050565b6060611a8c82611aac6306fdde0360049081525f90815290565b6103e8620186a061234a565b606081518015611b1a576040516001939093019260200191506bffffffc000000000000000005f19825b81018581015160ff1683811c6020168118868301535080611ae25750505060405191508082528060208301015f815260208101604052505b50919050565b6060611a8c82611aac6395d89b4160049081525f90815290565b6060828260015f5b82518451611b509190612daa565b611b5b906001612c92565b811015611c115760015f5b8451811015611bcf57848181518110611b8157611b81612bb0565b01602001516001600160f81b03191686611b9b8386612c92565b81518110611bab57611bab612bb0565b01602001516001600160f81b03191614611bc7575f9150611bcf565b600101611b66565b508015611bfe5782611be081612dbd565b93505060018451611bf19190612daa565b611bfb9083612c92565b91505b5080611c0981612dbd565b915050611b42565b50806001600160401b03811115611c2a57611c2a6124d2565b604051908082528060200260200182016040528015611c5d57816020015b6060815260200190600190039081611c485790505b5093505f805f5b85518111611d69578551811480611ce9575084518651611c849190612daa565b8111158015611ce9575084604051602001611c9f9190612b93565b60405160208183030381529060405280519060200120611cc1878388516123f3565b604051602001611cd19190612b93565b60405160208183030381529060405280519060200120145b15611d5757611d028683611cfd8185612daa565b6123f3565b878481518110611d1457611d14612bb0565b60200260200101819052508280611d2a90612dbd565b935050845181611d3a9190612c92565b915060018551611d4a9190612daa565b611d549082612c92565b90505b80611d6181612dbd565b915050611c64565b50505050505092915050565b5f602082015f5b6020811015611dae57808201515f1a60208103611d995750611dae565b6008820260f8031b9290921791600101611d7c565b5050919050565b60608060605f611dde85604051806040016040528060018152602001600160fd1b815250611b3a565b905080516005036109e15780600181518110611dfc57611dfc612bb0565b602002602001015181600281518110611e1757611e17612bb0565b602002602001015182600481518110611e3257611e32612bb0565b6020026020010151935093509350509193909250565b60608060605f611e7185604051806040016040528060018152602001600160fd1b815250611b3a565b90508051600403611ec55780600181518110611e8f57611e8f612bb0565b602002602001015181600281518110611eaa57611eaa612bb0565b602002602001015182600381518110611e3257611e32612bb0565b80516005036109e15780600481518110611ee157611ee1612bb0565b602002602001015181600181518110611efc57611efc612bb0565b602002602001015182600281518110611e3257611e32612bb0565b5f816014526370a0823160601b5f5260208060246010865afa601f3d111660205102905092915050565b5f808084815b8151811461205657600360fc1b828281518110611f6657611f66612bb0565b01602001516001600160f81b03191610801590611fa75750603960f81b828281518110611f9557611f95612bb0565b01602001516001600160f81b03191611155b15611ff5576030828281518110611fc057611fc0612bb0565b602001015160f81c60f81b60f81c60ff1686600a02010394508315611ff0578260010192508560ff168311612056575b61204e565b81818151811061200757612007612bb0565b6020910101516001600160f81b031916601760f91b148015612027575083155b15612035576001935061204e565b6040516318954fab60e11b815260040160405180910390fd5b600101611f47565b508460ff1682101561207057818560ff1603600a0a840293505b50505092915050565b5f6127106120878382612daa565b6120919085612dd5565b610ee39190612b5d565b826001600160a01b031663128acb088260800151156120ba57306120bc565b335b848460400151866120e15773fffd8963efd1fc6a506488495d951d5263988d256120e8565b6401000276a45b606087810151608089015189516020808c015160a08d015160405195151560f890811b9387019390935293151590911b60218501526bffffffffffffffffffffffff1933861b8116602286015291851b8216603685015290931b909216604a820152605e810191909152607e016040516020818303038152906040526040518663ffffffff1660e01b8152600401612184959493929190612dec565b60408051808303815f875af115801561219f573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e789190612e31565b80515f90805b81156122ee575f8460018403815181106121e5576121e5612bb0565b01602001516001600160f81b0319169050601760f91b81900361224457828203602084870101208490604080516020810193909352820152606001604051602081830303815290604052805190602001209350600183039150506122e3565b600160ff1b6001600160f81b031982161061225d575f80fd5b5f60018260f81c60ff168154811061227757612277612bb0565b5f91825260208083209082040154601f9091166101000a900460f81b915060ff1660f882901c036122a6575f80fd5b600160f882901c11156122e057808660018603815181106122c9576122c9612bb0565b60200101906001600160f81b03191690815f1a9053505b50505b5f19909101906121c9565b8181036020838601012083906040805160208101939093528201526060016040516020818303038152906040528051906020012092505050919050565b5f6020808451602086018786fa601f3d11166020510290509392505050565b606060205f8551602087018886fa156123eb576040518060200160403d106123b4575f5160203d0381116123b257602081843e602081013d038351116123b257825186811181881802188084528060208301843e5f92019182525060200160405290506123eb565b505b3d8581118187180218805f833e5f8183015350805b80515f1a156123da576001016123c9565b90810382525f815260200160405290505b949350505050565b60605f826001600160401b0381111561240e5761240e6124d2565b6040519080825280601f01601f191660200182016040528015612438576020820181803683370190505b5090505f5b8381101561249b57856124508287612c92565b8151811061246057612460612bb0565b602001015160f81c60f81b82828151811061247d5761247d612bb0565b60200101906001600160f81b03191690815f1a90535060010161243d565b50949350505050565b634e487b7160e01b5f52601160045260245ffd5b5f600160ff1b82016124cc576124cc6124a4565b505f0390565b634e487b7160e01b5f52604160045260245ffd5b601f8201601f191681016001600160401b038111828210171561250b5761250b6124d2565b6040525050565b5f82601f830112612521575f80fd5b81356001600160401b0381111561253a5761253a6124d2565b604051612551601f8301601f1916602001826124e6565b818152846020838601011115612565575f80fd5b816020850160208301375f918101602001919091529392505050565b5f60208284031215612591575f80fd5b81356001600160401b038111156125a6575f80fd5b6123eb84828501612512565b5f8083601f8401126125c2575f80fd5b5081356001600160401b038111156125d8575f80fd5b602083019150836020828501011115610597575f80fd5b5f8060208385031215612600575f80fd5b82356001600160401b03811115612615575f80fd5b612621858286016125b2565b90969095509350505050565b6001600160a01b0381168114612641575f80fd5b50565b5f60208284031215612654575f80fd5b8135610ee38161262d565b5f805f60408486031215612671575f80fd5b83356001600160401b03811115612686575f80fd5b612692868287016125b2565b909790965060209590950135949350505050565b5f805f80604085870312156126b9575f80fd5b84356001600160401b038111156126ce575f80fd5b6126da878288016125b2565b90955093505060208501356001600160401b038111156126f8575f80fd5b612704878288016125b2565b95989497509550505050565b5f805f60408486031215612722575f80fd5b833561272d8161262d565b925060208401356001600160401b03811115612747575f80fd5b612753868287016125b2565b9497909650939450505050565b5f805f60608486031215612772575f80fd5b83356001600160401b03811115612787575f80fd5b61279386828701612512565b93505060208401356001600160401b038111156127ae575f80fd5b6127ba86828701612512565b92505060408401356001600160401b038111156127d5575f80fd5b6127e186828701612512565b9150509250925092565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b6001600160a01b038681168252602082018690528416604082015260a0606082018190525f9061284b908301856127eb565b828103608084015261285d81856127eb565b98975050505050505050565b5f805f6040848603121561287b575f80fd5b83356001600160401b03811115612890575f80fd5b61289c868287016125b2565b90945092505060208401356001600160401b038111156128ba575f80fd5b840161012081870312156128cc575f80fd5b809150509250925092565b5f805f80608085870312156128ea575f80fd5b84356001600160401b038111156128ff575f80fd5b61290b87828801612512565b94505060208501356001600160401b03811115612926575f80fd5b61293287828801612512565b93505060408501356001600160401b0381111561294d575f80fd5b61295987828801612512565b949793965093946060013593505050565b5f805f6040848603121561297c575f80fd5b83356001600160401b03811115612991575f80fd5b61299d868287016125b2565b90945092505060208401356001600160401b038111156129bb575f80fd5b840161016081870312156128cc575f80fd5b5f805f604084860312156129df575f80fd5b83356001600160401b038111156129f4575f80fd5b8401601f81018613612a04575f80fd5b80356001600160401b03811115612a19575f80fd5b8660208260051b8401011115612a2d575f80fd5b6020918201979096509401359392505050565b80356020831015611a8c575f19602084900360031b1b1692915050565b818382375f9101908152919050565b6001815b6001841115612aa757808504811115612a8b57612a8b6124a4565b6001841615612a9957908102905b60019390931c928002612a70565b935093915050565b5f82612abd57506001611a8c565b81612ac957505f611a8c565b8160018114612adf5760028114612ae957612b05565b6001915050611a8c565b60ff841115612afa57612afa6124a4565b50506001821b611a8c565b5060208310610133831016604e8410600b8410161715612b28575081810a611a8c565b612b345f198484612a6c565b805f1904821115612b4757612b476124a4565b029392505050565b5f610ee360ff841683612aaf565b5f82612b7757634e487b7160e01b5f52601260045260245ffd5b500490565b5f81518060208401855e5f93019283525090919050565b5f610ee38284612b7c565b602081525f610ee360208301846127eb565b634e487b7160e01b5f52603260045260245ffd5b80516020808301519190811015611b1a575f1960209190910360031b1b16919050565b60018060a01b0384168152826020820152606060408201525f612c0d60608301846127eb565b95945050505050565b5f808335601e19843603018112612c2b575f80fd5b8301803591506001600160401b03821115612c44575f80fd5b602001915036819003821315610597575f80fd5b5f612c638284612b7c565b6305ccae8d60e31b81526004019392505050565b5f60208284031215612c87575f80fd5b8151610ee38161262d565b80820180821115611a8c57611a8c6124a4565b608081525f612cb760808301876127eb565b8281036020840152612cc981876127eb565b90508281036040840152612cdd81866127eb565b91505082606083015295945050505050565b5f60033d1115612d055760045f803e505f5160e01c5b90565b5f60443d1015612d155790565b6040513d600319016004823e80513d60248201116001600160401b0382111715612d3e57505090565b80820180516001600160401b03811115612d59575050505090565b3d8401600319018282016020011115612d73575050505090565b612d82602082850101856124e6565b509392505050565b6b029bbb0b82330b4b632b21d160a51b81525f610ee3600c830184612b7c565b81810381811115611a8c57611a8c6124a4565b5f60018201612dce57612dce6124a4565b5060010190565b8082028115828204841417611a8c57611a8c6124a4565b6001600160a01b0386811682528515156020830152604082018590528316606082015260a0608082018190525f90612e26908301846127eb565b979650505050505050565b5f8060408385031215612e42575f80fd5b50508051602090910151909290915056fea26469706673582212202a6335d5532aafe3204ed4b450744e78a96f88fdb0d5761cce1a791434e021b364736f6c634300081a0033
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.