![ads](/images/gen/moonpay_20.png)
20M+ users trust MoonPay worldwide. Checkout with your preferred payment method.
![ads](/images/gen/cons_20.png)
Ready to onboard to Ethereum? With MetaMask Portfolio, you're in control.
![ads](/images/gen/nexo.png)
Get up to 0.5% cashback per purchase and receive daily interest.
![ads](/images/gen/cons_20.png)
Ready to simplify your web3 experience? Try the all-in-one web3 app trusted by millions worldwide.
Purchase 100+ cryptocurrencies instantly, with Visa/Mastercard, Google/Apple Pay, and a variety of other funding methods.
![ads](/images/gen/coinsgame_20a.png)
Everyday giveaways up to 100 ETH, Lucky Spins. Deposit BONUS 300% and Cashbacks!
![ads](/images/gen/celsiuscasino_20.png)
9 years old Licensed Crypto Casino, Instant Withdraw 24/7, 6000+ Slots available, Paypal Deposit, Instant Live Support 24/7, 30% Rakeback.
![ads](/images/gen/bcgames_20.png)
5000+ Slots & Live Casino Games, 50+cryptos. Register with Etherscan and get 760% deposit bonus. Win Big$, withdraw it fast.
![ads](/images/gen/bcgames_20.png)
5000+ Slots & Live Casino Games, 50+cryptos. Register with Etherscan and get 760% deposit bonus. Win Big$, withdraw it fast.
![ads](/images/gen/cw_20.png)
Play 100s of games anonymously with all major cryptos. Join CryptoWins & start winning!
![ads](/images/gen/cryptoslots.png)
Anonymous play on awesome games - sign up now for 25 free jackpot spins - worth $100s!
Overview
ETH Balance
Eth Value
Less Than $0.01 (@ $2,673.70/ETH)Token Holdings
Could not find any matches!
- ERC-20 Tokens (1)0.00000507 stETHstETH (stETH)$0.01@2,670.42NFT Tokens (9)ipfseth.com Withdrawal NFTipfseth.com Withdrawal NFTERC-1155
More Info
Private Name Tags
ContractCreator
Multichain Info
1 address found via- Transactions
- Internal Transactions
- Token Transfers (ERC-20)
- NFT Transfers
- Contract
- Events
- Analytics
- Multichain Portfolio
Advanced Filter- Filter by Tx Type:
- Tx
- Internal Tx
- ERC-20
- NFTs
Latest 25 from a total of 178 transactions
Transaction Hash MethodBlockFromToContract Call 20547527 2024-08-17 9:43:59 5 days ago 1723887839 IN 0 ETH$0.00 0.00114381 1.09783399 Contract Call 20518126 2024-08-13 7:10:59 10 days ago 1723533059 IN 0 ETH$0.00 0.0015452 1.63703631 Set Max Partner ... 20487638 2024-08-09 1:04:47 14 days ago 1723165487 IN 0 ETH$0.00 0.00011772 3.94504854 Contract Call 20476749 2024-08-07 12:39:23 15 days ago 1723034363 IN 0.5 ETH$1,336.85 0.00077066 4.24049132 Contract Call 20464448 2024-08-05 19:26:59 17 days ago 1722886019 IN 0 ETH$0.00 0.01064659 9.69460028 Contract Call 20425465 2024-07-31 8:53:23 22 days ago 1722416003 IN 13.4326 ETH$35,914.74 0.0010758 5.02565032 Contract Call 20407774 2024-07-28 21:35:11 25 days ago 1722202511 IN 0.01151 ETH$30.77 0.00020655 1.15673851 Contract Call 20380433 2024-07-25 1:59:59 29 days ago 1721872799 IN 0 ETH$0.00 0.00523674 5.17526534 Contract Call 20372077 2024-07-23 21:59:23 30 days ago 1721771963 IN 0.001 ETH$2.67 0.00072157 5.95332258 Contract Call 20371816 2024-07-23 21:06:59 30 days ago 1721768819 IN 0 ETH$0.00 0.00118999 5.53139942 Contract Call 20365276 2024-07-22 23:13:11 31 days ago 1721689991 IN 0 ETH$0.00 0.00178009 4.68417042 Contract Call 20353582 2024-07-21 8:01:11 33 days ago 1721548871 IN 1 ETH$2,673.70 0.00343018 2.48047166 Contract Call 20345781 2024-07-20 5:53:59 34 days ago 1721454839 IN 0.00246 ETH$6.58 0.00048105 2.97097774 Contract Call 20342934 2024-07-19 20:21:35 34 days ago 1721420495 IN 0.005 ETH$13.37 0.00213718 5.73708347 Contract Call 20336264 2024-07-18 22:02:23 35 days ago 1721340143 IN 0.001 ETH$2.67 0.00318855 7.28598761 Contract Call 20335712 2024-07-18 20:11:35 35 days ago 1721333495 IN 1 ETH$2,673.70 0.00234869 13.11905046 Contract Call 20319362 2024-07-16 13:26:35 37 days ago 1721136395 IN 0.73974 ETH$1,977.84 0.0014989 8.37127261 Contract Call 20312573 2024-07-15 14:41:11 38 days ago 1721054471 IN 0 ETH$0.00 0.01419596 7.96135033 Contract Call 20312429 2024-07-15 14:12:11 38 days ago 1721052731 IN 5 ETH$13,368.50 0.00205424 9.49846113 Contract Call 20312364 2024-07-15 13:59:11 38 days ago 1721051951 IN 0.1 ETH$267.37 0.00150839 6.97457274 Contract Call 20311905 2024-07-15 12:26:59 38 days ago 1721046419 IN 0 ETH$0.00 0.00799742 4.39647489 Contract Call 20311016 2024-07-15 9:27:59 38 days ago 1721035679 IN 5 ETH$13,368.50 0.00125106 5.78469179 Contract Call 20310588 2024-07-15 8:01:59 39 days ago 1721030519 IN 0.001 ETH$2.67 0.00088502 4.44354886 Contract Call 20298968 2024-07-13 17:07:11 40 days ago 1720890431 IN 0 ETH$0.00 0.00131888 1.97492563 Contract Call 20298804 2024-07-13 16:34:23 40 days ago 1720888463 IN 10 ETH$26,737.00 0.00070491 3.25959011 Latest 25 internal transactions (View All)
Advanced mode:Parent Transaction Hash Block From To 20476749 2024-08-07 12:39:23 15 days ago 1723034363 0.5 ETH$1,336.85 20425465 2024-07-31 8:53:23 22 days ago 1722416003 13.4326 ETH$35,914.74 20407774 2024-07-28 21:35:11 25 days ago 1722202511 0.01151 ETH$30.77 20372077 2024-07-23 21:59:23 30 days ago 1721771963 0.001 ETH$2.67 20353582 2024-07-21 8:01:11 33 days ago 1721548871 0.999 ETH$2,671.03 20353582 2024-07-21 8:01:11 33 days ago 1721548871 0.001 ETH$2.67 20345781 2024-07-20 5:53:59 34 days ago 1721454839 0.00246 ETH$6.58 20342934 2024-07-19 20:21:35 34 days ago 1721420495 0.005 ETH$13.37 20336264 2024-07-18 22:02:23 35 days ago 1721340143 0.001 ETH$2.67 20335712 2024-07-18 20:11:35 35 days ago 1721333495 1 ETH$2,673.70 20319362 2024-07-16 13:26:35 37 days ago 1721136395 0.73974 ETH$1,977.84 20312429 2024-07-15 14:12:11 38 days ago 1721052731 5 ETH$13,368.50 20312364 2024-07-15 13:59:11 38 days ago 1721051951 0.1 ETH$267.37 20311016 2024-07-15 9:27:59 38 days ago 1721035679 5 ETH$13,368.50 20310588 2024-07-15 8:01:59 39 days ago 1721030519 0.001 ETH$2.67 20298804 2024-07-13 16:34:23 40 days ago 1720888463 10 ETH$26,737.00 20291257 2024-07-12 15:15:59 41 days ago 1720797359 0.001 ETH$2.67 20291194 2024-07-12 15:03:23 41 days ago 1720796603 0.001 ETH$2.67 20290916 2024-07-12 14:07:47 41 days ago 1720793267 0.0001 ETH$0.27 20290895 2024-07-12 14:03:35 41 days ago 1720793015 0.0001 ETH$0.27 20283289 2024-07-11 12:33:11 42 days ago 1720701191 0.001 ETH$2.67 20283043 2024-07-11 11:43:59 42 days ago 1720698239 0.001 ETH$2.67 20282979 2024-07-11 11:31:11 42 days ago 1720697471 0.001 ETH$2.67 20282816 2024-07-11 10:58:23 42 days ago 1720695503 0.001 ETH$2.67 20274797 2024-07-10 8:06:59 44 days ago 1720598819 0.001 ETH$2.67 Loading...LoadingContract Name:SwitchContractCall
Compiler Versionv0.8.9+commit.e5eed63a
Optimization Enabled:Yes with 200 runs
Other Settings:default evmVersionContract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity >=0.8.9; import "../dexs/Switch.sol"; import { ICallDataExecutor } from "../interfaces/ICallDataExecutor.sol"; import "../lib/DataTypes.sol"; contract SwitchContractCall is Switch { address public callDataExecutor; using UniversalERC20 for IERC20; using SafeERC20 for IERC20; event CallDataExecutorSet(address callDataExecutor); struct ContractCallArgs { address fromToken; address callToken; uint256 amount; uint256 callAmount; uint256 minReturn; address recipient; uint256[] distribution; address partner; uint256 partnerFeeRate; bytes32 id; bytes srcParaswapData; DataTypes.ParaswapUsageStatus paraswapUsageStatus; DataTypes.ContractCallInfo callInfo; } constructor( address _weth, address _otherToken, uint256[] memory _pathCountAndSplit, address[] memory _factories, address _switchViewAddress, address _switchEventAddress, address _paraswapProxy, address _augustusSwapper, address _callDataExecutor, address _feeCollector ) Switch( _weth, _otherToken, _pathCountAndSplit[0], _pathCountAndSplit[1], _factories, _switchViewAddress, _switchEventAddress, _paraswapProxy, _augustusSwapper, _feeCollector ) public { callDataExecutor = _callDataExecutor; } function setCallDataExecutor(address _newCallDataExecutor) external onlyOwner { callDataExecutor = _newCallDataExecutor; emit CallDataExecutorSet(_newCallDataExecutor); } function contractCall( ContractCallArgs calldata callArgs ) external payable nonReentrant { IERC20(callArgs.fromToken).universalTransferFrom(msg.sender, address(this), callArgs.amount); uint256 returnAmount = 0; uint256 amountAfterFee = _getAmountAfterFee(IERC20(callArgs.fromToken), callArgs.amount, callArgs.partner, callArgs.partnerFeeRate); if (callArgs.fromToken == callArgs.callToken) { _executeCallData( callArgs.fromToken, callArgs.callInfo.toContractAddress, callArgs.callInfo.toApprovalAddress, callArgs.callInfo.contractOutputsToken, callArgs.recipient, callArgs.callAmount, callArgs.callInfo.toContractGasLimit, callArgs.callInfo.toContractCallData ); _sendToRecipient(callArgs.fromToken, callArgs.recipient, amountAfterFee - callArgs.callAmount); } else { if (callArgs.paraswapUsageStatus == DataTypes.ParaswapUsageStatus.OnSrcChain) { // swap token through paraswap _executeCallData( callArgs.fromToken, augustusSwapper, paraswapProxy, callArgs.callInfo.contractOutputsToken, callArgs.recipient, amountAfterFee, 0, callArgs.srcParaswapData ); // execute calldata for contract call ICallDataExecutor(callDataExecutor).execute( IERC20(callArgs.callToken), callArgs.callInfo.toContractAddress, callArgs.callInfo.toApprovalAddress, callArgs.callInfo.contractOutputsToken, callArgs.recipient, callArgs.callAmount, callArgs.callInfo.toContractGasLimit, callArgs.callInfo.toContractCallData ); } else { returnAmount = _executeWithDistribution(callArgs, amountAfterFee); require(returnAmount >= callArgs.callAmount, "failed swapping from dex"); // execute calldata for contract call _executeCallData( callArgs.callToken, callArgs.callInfo.toContractAddress, callArgs.callInfo.toApprovalAddress, callArgs.callInfo.contractOutputsToken, callArgs.recipient, callArgs.callAmount, callArgs.callInfo.toContractGasLimit, callArgs.callInfo.toContractCallData ); // send the remain amount to the recipient. _sendToRecipient(callArgs.callToken, callArgs.recipient, returnAmount - callArgs.callAmount); } } _emitSingleChainContractCallDone( callArgs, amountAfterFee, callArgs.callAmount, DataTypes.ContractCallStatus.Succeeded ); } function _sendToRecipient( address token, address recipient, uint256 amount ) internal { if (IERC20(token).isETH()) { if (address(this).balance >= amount) payable(recipient).transfer(amount); } else { if (IERC20(token).balanceOf(address(this)) >= amount) IERC20(token).universalTransfer(recipient, amount); } } function _emitSingleChainContractCallDone( ContractCallArgs memory callArgs, uint256 fromAmount, uint256 callAmount, DataTypes.ContractCallStatus status ) internal { switchEvent.emitSingleChainContractCallDone( callArgs.recipient, callArgs.callInfo.toContractAddress, callArgs.callInfo.toApprovalAddress, callArgs.fromToken, callArgs.callToken, fromAmount, callAmount, status ); } function _executeCallData( address token, address callTo, address toApprovalAddress, address contractOutputsToken, address recipient, uint256 amount, uint256 toContractGasLimit, bytes memory callData ) internal { if (IERC20(token).isETH()) { IERC20(token).universalTransfer(callDataExecutor, amount); } else { IERC20(token).universalTransfer(callDataExecutor, amount); } ICallDataExecutor(callDataExecutor).execute( IERC20(token), callTo, toApprovalAddress, contractOutputsToken, recipient, amount, toContractGasLimit, callData ); } function _executeWithDistribution( ContractCallArgs calldata callArgs, uint256 amount ) internal returns ( uint256 dstAmount ) { DataTypes.SwapStatus status = DataTypes.SwapStatus.Succeeded; uint256 parts = 0; uint256 lastNonZeroIndex = 0; for (uint i = 0; i < callArgs.distribution.length; i++) { if (callArgs.distribution[i] > 0) { parts += callArgs.distribution[i]; lastNonZeroIndex = i; } } require(parts > 0, "invalid distribution param"); dstAmount = _swapInternal(amount, parts, lastNonZeroIndex, callArgs); } function _swapInternal( uint256 amount, uint256 parts, uint256 lastNonZeroIndex, ContractCallArgs memory callArgs ) internal returns ( uint256 returnAmount ) { returnAmount = _swapInternalForSingleSwap( callArgs.distribution, amount, parts, lastNonZeroIndex, IERC20(callArgs.fromToken), IERC20(callArgs.callToken) ); require(returnAmount >= callArgs.minReturn, 'The amount too small'); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == _ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.9; import "../interfaces/IUniswapFactory.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; abstract contract ISwitchView { struct ReturnArgs { IERC20 fromToken; IERC20 destToken; uint256 amount; uint256 parts; } struct CalculateArgs { IERC20 fromToken; IERC20 destToken; IUniswapFactory factory; uint256 amount; uint256 parts; } function getExpectedReturn( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts ) public virtual view returns ( uint256 returnAmount, uint256[] memory distribution ); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.9; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; abstract contract IWETH is IERC20 { function deposit() external virtual payable; function withdraw(uint256 amount) virtual external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.9; import "./ISwitchView.sol"; import "./IWETH.sol"; import "../lib/DisableFlags.sol"; import "../lib/UniversalERC20.sol"; import "../interfaces/IUniswapFactory.sol"; import "../lib/UniswapExchangeLib.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; abstract contract SwitchRoot is Ownable, ISwitchView { using DisableFlags for uint256; using UniversalERC20 for IERC20; using UniversalERC20 for IWETH; using UniswapExchangeLib for IUniswapExchange; address public ETH_ADDRESS = address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE); address public ZERO_ADDRESS = address(0); uint256 public dexCount; uint256 public pathCount; uint256 public pathSplit; IWETH public weth; // chain's native token IWETH public otherToken; //could be weth on a non-eth chain or other mid token(like busd) address[] public factories; int256 internal constant VERY_NEGATIVE_VALUE = -1e72; constructor(address _weth, address _otherToken, uint256 _pathCount, uint256 _pathSplit, address[] memory _factories) { weth = IWETH(_weth); otherToken = IWETH(_otherToken); pathCount = _pathCount; pathSplit = _pathSplit; dexCount = _factories.length; for (uint256 i = 0; i < _factories.length; i++) { factories.push(_factories[i]); } } event WETHSet(address _weth); event OtherTokenSet(address _otherToken); event PathCountSet(uint256 _pathCount); event PathSplitSet(uint256 _pathSplit); event FactoriesSet(address[] _factories); function setWETH(address _weth) external onlyOwner { weth = IWETH(_weth); emit WETHSet(_weth); } function setOtherToken(address _otherToken) external onlyOwner { otherToken = IWETH(_otherToken); emit OtherTokenSet(_otherToken); } function setPathCount(uint256 _pathCount) external onlyOwner { pathCount = _pathCount; emit PathCountSet(_pathCount); } function setPathSplit(uint256 _pathSplit) external onlyOwner { pathSplit = _pathSplit; emit PathSplitSet(_pathSplit); } function setFactories(address[] memory _factories) external onlyOwner { dexCount = _factories.length; for (uint256 i = 0; i < _factories.length; i++) { factories.push(_factories[i]); } emit FactoriesSet(_factories); } function _findBestDistribution( uint256 s, // parts int256[][] memory amounts // exchangesReturns ) internal view returns ( int256 returnAmount, uint256[] memory distribution ) { uint256 n = amounts.length; int256[][] memory answer = new int256[][](n); // int[n][s+1] uint256[][] memory parent = new uint256[][](n); // int[n][s+1] for (uint i = 0; i < n; i++) { answer[i] = new int256[](s + 1); parent[i] = new uint256[](s + 1); } for (uint j = 0; j <= s; j++) { answer[0][j] = amounts[0][j]; for (uint i = 1; i < n; i++) { answer[i][j] = -1e72; } parent[0][j] = 0; } for (uint i = 1; i < n; i++) { for (uint j = 0; j <= s; j++) { answer[i][j] = answer[i - 1][j]; parent[i][j] = j; for (uint k = 1; k <= j; k++) { if (answer[i - 1][j - k] + amounts[i][k] > answer[i][j]) { answer[i][j] = answer[i - 1][j - k] + amounts[i][k]; parent[i][j] = j - k; } } } } distribution = new uint256[](dexCount*pathCount*pathSplit); uint256 partsLeft = s; unchecked { for (uint curExchange = n - 1; partsLeft > 0; curExchange--) { distribution[curExchange] = partsLeft - parent[curExchange][partsLeft]; partsLeft = parent[curExchange][partsLeft]; } } returnAmount = (answer[n - 1][s] == VERY_NEGATIVE_VALUE) ? int256(0) : answer[n - 1][s]; } function _linearInterpolation( uint256 value, uint256 parts ) internal pure returns (uint256[] memory rets) { rets = new uint256[](parts); for (uint i = 0; i < parts; i++) { rets[i] = value * (i + 1) / parts; } } function _tokensEqual( IERC20 tokenA, IERC20 tokenB ) internal pure returns (bool) { return ((tokenA.isETH() && tokenB.isETH()) || tokenA == tokenB); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.9; import "../core/ISwitchView.sol"; import "../core/SwitchRoot.sol"; import "../interfaces/ISwitchEvent.sol"; import "../interfaces/IFeeCollector.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; contract Switch is Ownable, SwitchRoot, ReentrancyGuard { using UniswapExchangeLib for IUniswapExchange; using UniversalERC20 for IERC20; using SafeERC20 for IERC20; ISwitchView public switchView; ISwitchEvent public switchEvent; address public reward; address public paraswapProxy; address public augustusSwapper; address public feeCollector; uint256 public maxPartnerFeeRate = 1000; // max partner fee rate is 10% uint256 public defaultSwingCut = 1500; // swing takes a cut of 15% from partner fee by default uint256 public constant FEE_BASE = 10000; struct SwapArgs { IERC20 fromToken; IERC20 destToken; uint256 amount; uint256 expectedReturn; uint256 minReturn; address partner; uint256 partnerFeeRate; address recipient; uint256[] distribution; } event RewardSet(address reward); event FeeCollectorSet(address feeCollector); event MaxPartnerFeeRateSet(uint256 maxPartnerFeeRate); event DefaultSwingCutSet(uint256 defaultSwingCut); event SwitchEventSet(ISwitchEvent switchEvent); event ParaswapProxySet(address paraswapProxy); event AugustusSwapperSet(address augustusSwapper); constructor( address _weth, address _otherToken, uint256 _pathCount, uint256 _pathSplit, address[] memory _factories, address _switchViewAddress, address _switchEventAddress, address _paraswapProxy, address _augustusSwapper, address _feeCollector ) SwitchRoot(_weth, _otherToken, _pathCount, _pathSplit, _factories) public { switchView = ISwitchView(_switchViewAddress); switchEvent = ISwitchEvent(_switchEventAddress); paraswapProxy = _paraswapProxy; augustusSwapper = _augustusSwapper; feeCollector = _feeCollector; reward = msg.sender; } fallback() external payable { // solium-disable-next-line security/no-tx-origin require(msg.sender != tx.origin); } function setReward(address _reward) external onlyOwner { reward = _reward; emit RewardSet(_reward); } function setFeeCollector(address _feeCollector) external onlyOwner { feeCollector = _feeCollector; emit FeeCollectorSet(_feeCollector); } function setMaxPartnerFeeRate(uint256 _maxPartnerFeeRate) external onlyOwner { require(_maxPartnerFeeRate <= 5000, "too large"); maxPartnerFeeRate = _maxPartnerFeeRate; emit MaxPartnerFeeRateSet(_maxPartnerFeeRate); } function setDefaultSwingCut(uint256 _defaultSwingCut) external onlyOwner { defaultSwingCut = _defaultSwingCut; emit DefaultSwingCutSet(_defaultSwingCut); } function setSwitchEvent(ISwitchEvent _switchEvent) external onlyOwner { switchEvent = _switchEvent; emit SwitchEventSet(_switchEvent); } function setParaswapProxy(address _paraswapProxy) external onlyOwner { paraswapProxy = _paraswapProxy; emit ParaswapProxySet(_paraswapProxy); } function setAugustusSwapper(address _augustusSwapper) external onlyOwner { augustusSwapper = _augustusSwapper; emit AugustusSwapperSet(_augustusSwapper); } function getTokenBalance(address token) external view onlyOwner returns(uint256 amount) { amount = IERC20(token).universalBalanceOf(address(this)); } function transferToken(address token, uint256 amount, address recipient) external onlyOwner { IERC20(token).universalTransfer(recipient, amount); } function getExpectedReturn( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts ) public override view returns ( uint256 returnAmount, uint256[] memory distribution ) { (returnAmount, distribution) = switchView.getExpectedReturn(fromToken, destToken, amount, parts); } function swap( SwapArgs calldata swapArgs ) public payable nonReentrant returns (uint256 returnAmount) { require(swapArgs.expectedReturn >= swapArgs.minReturn, "expectedReturn must be equal or larger than minReturn"); if (swapArgs.fromToken == swapArgs.destToken) { revert("it's not allowed to swap with same token"); } uint256 parts = 0; uint256 lastNonZeroIndex = 0; for (uint i = 0; i < swapArgs.distribution.length; i++) { if (swapArgs.distribution[i] > 0) { parts += swapArgs.distribution[i]; lastNonZeroIndex = i; } } if (parts == 0) { if (swapArgs.fromToken.isETH()) { payable(msg.sender).transfer(msg.value); return msg.value; } return swapArgs.amount; } swapArgs.fromToken.universalTransferFrom(msg.sender, address(this), swapArgs.amount); uint256 amountAfterFee = _getAmountAfterFee(swapArgs.fromToken, swapArgs.amount, swapArgs.partner, swapArgs.partnerFeeRate); returnAmount = _swapInternalForSingleSwap(swapArgs.distribution, amountAfterFee, parts, lastNonZeroIndex, swapArgs.fromToken, swapArgs.destToken); if (returnAmount > 0) { require(returnAmount >= swapArgs.minReturn, "Switch: Return amount was not enough"); if (returnAmount > swapArgs.expectedReturn) { swapArgs.destToken.universalTransfer(swapArgs.recipient, swapArgs.expectedReturn); swapArgs.destToken.universalTransfer(reward, returnAmount - swapArgs.expectedReturn); switchEvent.emitSwapped(msg.sender, swapArgs.recipient, swapArgs.fromToken, swapArgs.destToken, swapArgs.amount, swapArgs.expectedReturn, returnAmount - swapArgs.expectedReturn); } else { swapArgs.destToken.universalTransfer(swapArgs.recipient, returnAmount); switchEvent.emitSwapped(msg.sender, swapArgs.recipient, swapArgs.fromToken, swapArgs.destToken, swapArgs.amount, returnAmount, 0); } } else { if (swapArgs.fromToken.universalBalanceOf(address(this)) > swapArgs.amount) { swapArgs.fromToken.universalTransfer(msg.sender, swapArgs.amount); } else { swapArgs.fromToken.universalTransfer(msg.sender, swapArgs.fromToken.universalBalanceOf(address(this))); } } } function swapWithParaswap( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 destAmount, address partner, uint256 partnerFeeRate, address recipient, bytes memory callData ) public payable nonReentrant { if (fromToken == destToken) { revert("it's not allowed to swap with same token"); } fromToken.universalTransferFrom(msg.sender, address(this), amount); uint256 amountAfterFee = _getAmountAfterFee(IERC20(fromToken), amount, partner, partnerFeeRate); _swapInternalWithParaSwap(fromToken, destToken, amountAfterFee, callData); } function getFeeInfo( uint256 amount, address partner, uint256 partnerFeeRate ) public view returns ( uint256 partnerFee, uint256 remainAmount ) { partnerFee = partnerFeeRate * amount / FEE_BASE; remainAmount = amount - partnerFee; } function _swapInternalWithParaSwap( IERC20 fromToken, IERC20 destToken, uint256 amount, bytes memory callData ) internal returns ( uint256 totalAmount ) { if (fromToken == destToken) { revert("it's not allowed to swap with same token"); } _callParaswap(fromToken, amount, callData); totalAmount = destToken.universalBalanceOf(address(this)); switchEvent.emitSwapped(msg.sender, address(this), fromToken, destToken, amount, totalAmount, 0); } function _callParaswap( IERC20 token, uint256 amount, bytes memory callData ) internal { uint256 ethAmountToTransfert = 0; if (token.isETH()) { require(address(this).balance >= amount, "ETH balance is insufficient"); ethAmountToTransfert = amount; } else { token.universalApprove(paraswapProxy, amount); } (bool success,) = augustusSwapper.call{ value: ethAmountToTransfert }(callData); require(success, "Paraswap execution failed"); } function _swapInternalForSingleSwap( uint256[] memory distribution, uint256 amount, uint256 parts, uint256 lastNonZeroIndex, IERC20 fromToken, IERC20 destToken ) internal returns ( uint256 totalAmount ) { require(distribution.length <= dexCount*pathCount, "Switch: Distribution array should not exceed factories array size"); uint256 remainingAmount = amount; uint256 swappedAmount = 0; for (uint i = 0; i < distribution.length; i++) { if (distribution[i] == 0) { continue; } uint256 swapAmount = amount * distribution[i] / parts; if (i == lastNonZeroIndex) { swapAmount = remainingAmount; } remainingAmount -= swapAmount; if (i % pathCount == 0) { swappedAmount = _swap(fromToken, destToken, swapAmount, IUniswapFactory(factories[i/pathCount])); } else if (i % pathCount == 1) { swappedAmount = _swapETH(fromToken, destToken, swapAmount, IUniswapFactory(factories[i/pathCount])); } else { swappedAmount = _swapOtherToken(fromToken, destToken, swapAmount, IUniswapFactory(factories[i/pathCount])); } totalAmount += swappedAmount; } } function _getAmountAfterFee( IERC20 token, uint256 amount, address partner, uint256 partnerFeeRate ) internal returns ( uint256 amountAfterFee ) { require(partnerFeeRate <= maxPartnerFeeRate, "partnerFeeRate too large"); amountAfterFee = amount; if (partnerFeeRate > 0) { uint256 swingCut = IFeeCollector(feeCollector).getPartnerSwingCut(partner) == 0 ? defaultSwingCut : IFeeCollector(feeCollector).getPartnerSwingCut(partner); uint256 swingFee = partnerFeeRate * amount * defaultSwingCut / (FEE_BASE * FEE_BASE); uint256 partnerFee = partnerFeeRate * amount / FEE_BASE - swingFee; if (IERC20(token).isETH()) { IFeeCollector(feeCollector).collectTokenFees{ value: partnerFee + swingFee }(address(token), partnerFee, swingFee, partner); } else { IERC20(token).safeApprove(feeCollector, 0); IERC20(token).safeApprove(feeCollector, partnerFee + swingFee); IFeeCollector(feeCollector).collectTokenFees(address(token), partnerFee, swingFee, partner); } amountAfterFee = amount - partnerFeeRate * amount / FEE_BASE; } } // Swap helpers function _swapInternal( IERC20 fromToken, IERC20 destToken, uint256 amount, IUniswapFactory factory ) internal returns ( uint256 returnAmount ) { if (fromToken.isETH()) { weth.deposit{value: amount}(); } IERC20 fromTokenReal = fromToken.isETH() ? weth : fromToken; IERC20 toTokenReal = destToken.isETH() ? weth : destToken; IUniswapExchange exchange = factory.getPair(fromTokenReal, toTokenReal); bool needSync; bool needSkim; (returnAmount, needSync, needSkim) = exchange.getReturn(fromTokenReal, toTokenReal, amount); if (needSync) { exchange.sync(); } else if (needSkim) { exchange.skim(0x46Fd07da395799F113a7584563b8cB886F33c2bc); } fromTokenReal.universalTransfer(address(exchange), amount); if (uint160(address(fromTokenReal)) < uint160(address(toTokenReal))) { exchange.swap(0, returnAmount, address(this), ""); } else { exchange.swap(returnAmount, 0, address(this), ""); } if (destToken.isETH()) { weth.withdraw(weth.balanceOf(address(this))); } } function _swapOverMid( IERC20 fromToken, IERC20 midToken, IERC20 destToken, uint256 amount, IUniswapFactory factory ) internal returns ( uint256 returnAmount ) { returnAmount = _swapInternal( midToken, destToken, _swapInternal( fromToken, midToken, amount, factory ), factory ); } function _swap( IERC20 fromToken, IERC20 destToken, uint256 amount, IUniswapFactory factory ) internal returns ( uint256 returnAmount ) { returnAmount = _swapInternal( fromToken, destToken, amount, factory ); } function _swapETH( IERC20 fromToken, IERC20 destToken, uint256 amount, IUniswapFactory factory ) internal returns ( uint256 returnAmount ) { returnAmount = _swapOverMid( fromToken, weth, destToken, amount, factory ); } function _swapOtherToken( IERC20 fromToken, IERC20 destToken, uint256 amount, IUniswapFactory factory ) internal returns ( uint256 returnAmount ) { returnAmount = _swapOverMid( fromToken, otherToken, destToken, amount, factory ); } }
pragma solidity >=0.8.9; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface ICallDataExecutor { function execute( IERC20 token, address addr, address approveAddress, address contractOutputsToken, address recipient, uint256 amount, uint256 gasLimit, bytes memory payload ) external payable; function sendNativeAndExecute( IERC20 token, address callTo, address approveAddress, address contractOutputsToken, address recipient, uint256 amount, uint256 gasLimit, bytes memory payload ) external payable; function sendAndExecute( IERC20 token, address callTo, address approveAddress, address contractOutputsToken, address recipient, uint256 amount, uint256 gasLimit, bytes memory payload ) external payable; }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.9; interface IFeeCollector { function collectTokenFees( address tokenAddress, uint256 partnerFee, uint256 swingFee, address partnerAddress ) payable external; function getPartnerSwingCut(address partnerAddress) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.9; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../lib/DataTypes.sol"; interface ISwitchEvent { function emitSwapped( address from, address recipient, IERC20 fromToken, IERC20 destToken, uint256 fromAmount, uint256 destAmount, uint256 reward ) external; function emitParaswapSwapped( address from, IERC20 fromToken, uint256 fromAmount ) external; function emitCrosschainSwapRequest( bytes32 id, bytes32 bridgeTransferId, bytes32 bridge, // bridge slug address from, // user address address fromToken, // source token on sending chain address bridgeToken, // bridge token on sending chain address destToken, // dest token on receiving chain uint256 fromAmount, // source token amount on sending chain uint256 bridgeAmount, // swapped amount on sending chain uint256 dstAmount, // estimated amount of dest token on receiving chain DataTypes.SwapStatus status ) external; function emitCrosschainContractCallRequest( bytes32 id, bytes32 bridgeTransferId, bytes32 bridge, // bridge slug address from, // user address address toContractAddress, // The address of the contract to interact with address toApprovalAddress, // the approval address for contract call address fromToken, // source token on sending chain address callToken, // contract call token on receiving chain uint256 fromAmount, // source token amount on sending chain uint256 estimatedCallAmount, // estimated amount of contract call token on receiving chain DataTypes.ContractCallStatus status ) external; function emitCrosschainSwapDone( bytes32 id, bytes32 bridge, address from, // user address address bridgeToken, // source token on receiving chain address destToken, // dest token on receiving chain uint256 bridgeAmount, // bridge token amount on receiving chain uint256 destAmount, //dest token amount on receiving chain DataTypes.SwapStatus status ) external; function emitCrosschainContractCallDone( bytes32 id, bytes32 bridge, address from, // user address address toContractAddress, // The address of the contract to interact with address toApprovalAddress, // the approval address for contract call address bridgeToken, // source token on receiving chain address callToken, // call token on receiving chain uint256 bridgeAmount, // bridge token amount on receiving chain uint256 estimatedCallAmount, //dest token amount on receiving chain DataTypes.ContractCallStatus status ) external; function emitSingleChainContractCallDone( address from, // user address address toContractAddress, // The address of the contract to interact with address toApprovalAddress, // the approval address for contract call address fromToken, // source token on receiving chain address callToken, // call token on receiving chain uint256 fromAmount, // from token amount on receiving chain uint256 callAmount, //dest token amount on receiving chain DataTypes.ContractCallStatus status ) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.9; interface IUniswapExchange { function getReserves() external view returns(uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.9; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./IUniswapExchange.sol"; interface IUniswapFactory { function getPair(IERC20 tokenA, IERC20 tokenB) external view returns (IUniswapExchange pair); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.9; /** * @title DataTypes * @dev Definition of shared types */ library DataTypes { /// @notice Type for representing a swapping status type enum SwapStatus { Null, Succeeded, Failed, Fallback } enum ContractCallStatus { Null, Succeeded, Failed, Fallback } /// @notice Type for representing a paraswap usage status enum ParaswapUsageStatus { None, OnSrcChain, OnDestChain, Both } /// @notice Split Swap params struct SplitSwapInfo { uint256 amount; address swapContract; address spender; bytes swapData; } /// @notice Swap params struct SwapInfo { address srcToken; address dstToken; } struct ContractCallInfo { address toContractAddress; // The address of the contract to interact with. address toApprovalAddress; // the approval address for contract call address contractOutputsToken; // Some contract interactions will output a token (e.g. staking) uint32 toContractGasLimit; // The estimated gas used by the destination call. bytes toContractCallData; // The callData to be sent to the contract for the interaction on the destination chain. } struct ContractCallRequest { bytes32 id; bytes32 bridge; address srcToken; address bridgeToken; address callToken; address recipient; uint256 srcAmount; uint256 bridgeDstAmount; uint256 estimatedCallAmount; uint256[] dstDistribution; bytes dstParaswapData; ContractCallInfo callInfo; ParaswapUsageStatus paraswapUsageStatus; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.9; library DisableFlags { function check( uint256 flags, uint256 flag ) internal pure returns (bool) { return (flags & flag) != 0; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.9; library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow, so we distribute return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.9; import "../interfaces/IUniswapExchange.sol"; import "./Math.sol"; import "./UniversalERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; library UniswapExchangeLib { using Math for uint256; using UniversalERC20 for IERC20; function getReturn( IUniswapExchange exchange, IERC20 fromToken, IERC20 destToken, uint amountIn ) internal view returns (uint256 result, bool needSync, bool needSkim) { uint256 reserveIn = fromToken.universalBalanceOf(address(exchange)); uint256 reserveOut = destToken.universalBalanceOf(address(exchange)); (uint112 reserve0, uint112 reserve1,) = exchange.getReserves(); if (fromToken > destToken) { (reserve0, reserve1) = (reserve1, reserve0); } needSync = (reserveIn < reserve0 || reserveOut < reserve1); needSkim = !needSync && (reserveIn > reserve0 || reserveOut > reserve1); uint256 amountInWithFee = amountIn * 997; uint256 numerator = amountInWithFee * Math.min(reserveOut, reserve1); uint256 denominator = Math.min(reserveIn, reserve0) * 1000 + amountInWithFee; result = (denominator == 0) ? 0 : numerator / denominator; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.9; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; library UniversalERC20 { using SafeERC20 for IERC20; address private constant ZERO_ADDRESS = address(0x0000000000000000000000000000000000000000); address private constant ETH_ADDRESS = address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE); function universalTransfer( IERC20 token, address to, uint256 amount ) internal returns (bool) { if (amount == 0) { return true; } if (isETH(token)) { payable(to).transfer(amount); return true; } else { token.safeTransfer(to, amount); return true; } } function universalTransferFrom( IERC20 token, address from, address to, uint256 amount ) internal { if (amount == 0) { return; } if (isETH(token)) { require(from == msg.sender && msg.value >= amount, "Wrong useage of ETH.universalTransferFrom()"); if (to != address(this)) { payable(to).transfer(amount); } // commented following lines for passing celer fee properly. // if (msg.value > amount) { // payable(msg.sender).transfer(msg.value - amount); // } } else { token.safeTransferFrom(from, to, amount); } } function universalTransferFromSenderToThis( IERC20 token, uint256 amount ) internal { if (amount == 0) { return; } if (isETH(token)) { if (msg.value > amount) { // Return remainder if exist payable(msg.sender).transfer(msg.value - amount); } } else { token.safeTransferFrom(msg.sender, address(this), amount); } } function universalApprove( IERC20 token, address to, uint256 amount ) internal { if (!isETH(token)) { if (amount == 0) { token.safeApprove(to, 0); return; } uint256 approvedAmount = token.allowance(address(this), to); if (approvedAmount > 0) { token.safeApprove(to, 0); } token.safeApprove(to, amount); } } function universalBalanceOf(IERC20 token, address who) internal view returns (uint256) { if (isETH(token)) { return who.balance; } else { return token.balanceOf(who); } } function isETH(IERC20 token) internal pure returns(bool) { return (address(token) == address(ZERO_ADDRESS) || address(token) == address(ETH_ADDRESS)); } // function notExist(IERC20 token) internal pure returns(bool) { // return (address(token) == address(-1)); // } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
[{"inputs":[{"internalType":"address","name":"_weth","type":"address"},{"internalType":"address","name":"_otherToken","type":"address"},{"internalType":"uint256[]","name":"_pathCountAndSplit","type":"uint256[]"},{"internalType":"address[]","name":"_factories","type":"address[]"},{"internalType":"address","name":"_switchViewAddress","type":"address"},{"internalType":"address","name":"_switchEventAddress","type":"address"},{"internalType":"address","name":"_paraswapProxy","type":"address"},{"internalType":"address","name":"_augustusSwapper","type":"address"},{"internalType":"address","name":"_callDataExecutor","type":"address"},{"internalType":"address","name":"_feeCollector","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"augustusSwapper","type":"address"}],"name":"AugustusSwapperSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"callDataExecutor","type":"address"}],"name":"CallDataExecutorSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"defaultSwingCut","type":"uint256"}],"name":"DefaultSwingCutSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"_factories","type":"address[]"}],"name":"FactoriesSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"feeCollector","type":"address"}],"name":"FeeCollectorSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"maxPartnerFeeRate","type":"uint256"}],"name":"MaxPartnerFeeRateSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_otherToken","type":"address"}],"name":"OtherTokenSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"paraswapProxy","type":"address"}],"name":"ParaswapProxySet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_pathCount","type":"uint256"}],"name":"PathCountSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_pathSplit","type":"uint256"}],"name":"PathSplitSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"reward","type":"address"}],"name":"RewardSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract ISwitchEvent","name":"switchEvent","type":"address"}],"name":"SwitchEventSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_weth","type":"address"}],"name":"WETHSet","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"ETH_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FEE_BASE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ZERO_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"augustusSwapper","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"callDataExecutor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"fromToken","type":"address"},{"internalType":"address","name":"callToken","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"callAmount","type":"uint256"},{"internalType":"uint256","name":"minReturn","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256[]","name":"distribution","type":"uint256[]"},{"internalType":"address","name":"partner","type":"address"},{"internalType":"uint256","name":"partnerFeeRate","type":"uint256"},{"internalType":"bytes32","name":"id","type":"bytes32"},{"internalType":"bytes","name":"srcParaswapData","type":"bytes"},{"internalType":"enum DataTypes.ParaswapUsageStatus","name":"paraswapUsageStatus","type":"uint8"},{"components":[{"internalType":"address","name":"toContractAddress","type":"address"},{"internalType":"address","name":"toApprovalAddress","type":"address"},{"internalType":"address","name":"contractOutputsToken","type":"address"},{"internalType":"uint32","name":"toContractGasLimit","type":"uint32"},{"internalType":"bytes","name":"toContractCallData","type":"bytes"}],"internalType":"struct DataTypes.ContractCallInfo","name":"callInfo","type":"tuple"}],"internalType":"struct SwitchContractCall.ContractCallArgs","name":"callArgs","type":"tuple"}],"name":"contractCall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"defaultSwingCut","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dexCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"factories","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeCollector","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"fromToken","type":"address"},{"internalType":"contract IERC20","name":"destToken","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"parts","type":"uint256"}],"name":"getExpectedReturn","outputs":[{"internalType":"uint256","name":"returnAmount","type":"uint256"},{"internalType":"uint256[]","name":"distribution","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"partner","type":"address"},{"internalType":"uint256","name":"partnerFeeRate","type":"uint256"}],"name":"getFeeInfo","outputs":[{"internalType":"uint256","name":"partnerFee","type":"uint256"},{"internalType":"uint256","name":"remainAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getTokenBalance","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxPartnerFeeRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"otherToken","outputs":[{"internalType":"contract IWETH","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paraswapProxy","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pathCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pathSplit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reward","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_augustusSwapper","type":"address"}],"name":"setAugustusSwapper","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newCallDataExecutor","type":"address"}],"name":"setCallDataExecutor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_defaultSwingCut","type":"uint256"}],"name":"setDefaultSwingCut","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_factories","type":"address[]"}],"name":"setFactories","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeCollector","type":"address"}],"name":"setFeeCollector","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxPartnerFeeRate","type":"uint256"}],"name":"setMaxPartnerFeeRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_otherToken","type":"address"}],"name":"setOtherToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_paraswapProxy","type":"address"}],"name":"setParaswapProxy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pathCount","type":"uint256"}],"name":"setPathCount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pathSplit","type":"uint256"}],"name":"setPathSplit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_reward","type":"address"}],"name":"setReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ISwitchEvent","name":"_switchEvent","type":"address"}],"name":"setSwitchEvent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_weth","type":"address"}],"name":"setWETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"contract IERC20","name":"fromToken","type":"address"},{"internalType":"contract IERC20","name":"destToken","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"expectedReturn","type":"uint256"},{"internalType":"uint256","name":"minReturn","type":"uint256"},{"internalType":"address","name":"partner","type":"address"},{"internalType":"uint256","name":"partnerFeeRate","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256[]","name":"distribution","type":"uint256[]"}],"internalType":"struct Switch.SwapArgs","name":"swapArgs","type":"tuple"}],"name":"swap","outputs":[{"internalType":"uint256","name":"returnAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"fromToken","type":"address"},{"internalType":"contract IERC20","name":"destToken","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"destAmount","type":"uint256"},{"internalType":"address","name":"partner","type":"address"},{"internalType":"uint256","name":"partnerFeeRate","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"}],"name":"swapWithParaswap","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"switchEvent","outputs":[{"internalType":"contract ISwitchEvent","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"switchView","outputs":[{"internalType":"contract ISwitchView","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"transferToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"weth","outputs":[{"internalType":"contract IWETH","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
6080604052600180546001600160a01b031990811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee179091556002805490911690556103e86010556105dc6011553480156200004f57600080fd5b506040516200433b3803806200433b8339810160408190526200007291620003e0565b8989896000815181106200008a576200008a620004e2565b60200260200101518a600181518110620000a857620000a8620004e2565b60200260200101518a8a8a8a8a898989898989620000d5620000cf6200022260201b60201c565b62000226565b600680546001600160a01b038088166001600160a01b031992831617909255600780549287169290911691909117905560048390556005829055805160035560005b815181101562000188576008828281518110620001385762000138620004e2565b60209081029190910181015182546001810184556000938452919092200180546001600160a01b0319166001600160a01b03909216919091179055806200017f81620004f8565b91505062000117565b505060016009555050600a80546001600160a01b03199081166001600160a01b03998a1617909155600b80548216978916979097179096555050600d8054851693861693909317909255600e80548416918516919091179055600f80548316918416919091179055600c80543390831617905560128054909116989091169790971790965550620005229c50505050505050505050505050565b3390565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146200028e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715620002d457620002d462000293565b604052919050565b60006001600160401b03821115620002f857620002f862000293565b5060051b60200190565b600082601f8301126200031457600080fd5b815160206200032d6200032783620002dc565b620002a9565b82815260059290921b840181019181810190868411156200034d57600080fd5b8286015b848110156200036a578051835291830191830162000351565b509695505050505050565b600082601f8301126200038757600080fd5b815160206200039a6200032783620002dc565b82815260059290921b84018101918181019086841115620003ba57600080fd5b8286015b848110156200036a57620003d28162000276565b8352918301918301620003be565b6000806000806000806000806000806101408b8d0312156200040157600080fd5b6200040c8b62000276565b99506200041c60208c0162000276565b60408c01519099506001600160401b03808211156200043a57600080fd5b620004488e838f0162000302565b995060608d01519150808211156200045f57600080fd5b506200046e8d828e0162000375565b9750506200047f60808c0162000276565b95506200048f60a08c0162000276565b94506200049f60c08c0162000276565b9350620004af60e08c0162000276565b9250620004c06101008c0162000276565b9150620004d16101208c0162000276565b90509295989b9194979a5092959850565b634e487b7160e01b600052603260045260246000fd5b60006000198214156200051b57634e487b7160e01b600052601160045260246000fd5b5060010190565b613e0980620005326000396000f3fe6080604052600436106102465760003560e01c80638c821e9011610139578063c415b95c116100b6578063e8984c5f1161007a578063e8984c5f1461069d578063ea15afc3146106bd578063ecefc705146106dd578063ee06d977146106f3578063f2fde38b14610713578063f640d5081461073357610246565b8063c415b95c146105ff578063c93d732d1461061f578063d6821ed814610632578063e37c425014610667578063e5932c401461067d57610246565b8063a85f3298116100fd578063a85f329814610569578063ab30469514610589578063ae551c661461059f578063b4c76fe0146105bf578063b9d52d3c146105df57610246565b80638c821e90146104df5780638da5cb5b146104f557806390f3f20814610513578063a42dce8014610529578063a734f06e1461054957610246565b806352b721f8116101c75780635c3d258f1161018b5780635c3d258f146104495780636076a0b414610469578063672383c414610497578063715018a6146104b75780638928a29f146104cc57610246565b806352b721f8146103b3578063538ba4f9146103c957806353fd7bf1146103e95780635b18075e146104095780635b769f3c1461042957610246565b80633aecd0e31161020e5780633aecd0e3146103055780633fc8cef314610333578063433b3c05146103535780634399fa561461037357806348c4d7811461039357610246565b8063116400781461025557806314f30bc214610275578063228cb7331461028857806323a9495e146102c557806331428a87146102e5575b3332141561025357600080fd5b005b34801561026157600080fd5b506102536102703660046131b7565b610753565b6102536102833660046131d4565b6107b0565b34801561029457600080fd5b50600c546102a8906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156102d157600080fd5b506102536102e036600461320f565b610c02565b3480156102f157600080fd5b50600a546102a8906001600160a01b031681565b34801561031157600080fd5b506103256103203660046131b7565b610c3f565b6040519081526020016102bc565b34801561033f57600080fd5b506006546102a8906001600160a01b031681565b34801561035f57600080fd5b506007546102a8906001600160a01b031681565b34801561037f57600080fd5b50600b546102a8906001600160a01b031681565b34801561039f57600080fd5b506102536103ae36600461320f565b610c62565b3480156103bf57600080fd5b5061032560115481565b3480156103d557600080fd5b506002546102a8906001600160a01b031681565b3480156103f557600080fd5b506102536104043660046131b7565b610cdd565b34801561041557600080fd5b50600d546102a8906001600160a01b031681565b34801561043557600080fd5b506102536104443660046131b7565b610d33565b34801561045557600080fd5b5061025361046436600461320f565b610d89565b34801561047557600080fd5b50610489610484366004613228565b610dc6565b6040516102bc92919061326e565b3480156104a357600080fd5b506102a86104b236600461320f565b610e6f565b3480156104c357600080fd5b50610253610e99565b6102536104da36600461339a565b610ead565b3480156104eb57600080fd5b5061032560045481565b34801561050157600080fd5b506000546001600160a01b03166102a8565b34801561051f57600080fd5b5061032560055481565b34801561053557600080fd5b506102536105443660046131b7565b610f2e565b34801561055557600080fd5b506001546102a8906001600160a01b031681565b34801561057557600080fd5b5061025361058436600461320f565b610f84565b34801561059557600080fd5b5061032560035481565b3480156105ab57600080fd5b50600e546102a8906001600160a01b031681565b3480156105cb57600080fd5b506102536105da3660046131b7565b610fc1565b3480156105eb57600080fd5b506102536105fa3660046131b7565b611017565b34801561060b57600080fd5b50600f546102a8906001600160a01b031681565b61032561062d36600461343e565b61106d565b34801561063e57600080fd5b5061065261064d366004613479565b611585565b604080519283526020830191909152016102bc565b34801561067357600080fd5b5061032560105481565b34801561068957600080fd5b506102536106983660046131b7565b6115b5565b3480156106a957600080fd5b506102536106b83660046131b7565b61160b565b3480156106c957600080fd5b506102536106d83660046134d4565b611661565b3480156106e957600080fd5b5061032561271081565b3480156106ff57600080fd5b506012546102a8906001600160a01b031681565b34801561071f57600080fd5b5061025361072e3660046131b7565b61170b565b34801561073f57600080fd5b5061025361074e366004613567565b611781565b61075b6117a3565b601280546001600160a01b0319166001600160a01b0383169081179091556040519081527f18dcb7d948e71f663c851d90e4df772a77de47691049183356fef763546a789f906020015b60405180910390a150565b6107b86117fd565b6107e0333060408401356107cf60208601866131b7565b6001600160a01b0316929190611857565b6000806108146107f360208501856131b7565b6040850135610809610100870160e088016131b7565b866101000135611949565b905061082660408401602085016131b7565b6001600160a01b031661083c60208501856131b7565b6001600160a01b0316141561097d5761094561085b60208501856131b7565b6108696101808601866135a9565b6108779060208101906131b7565b6108856101808701876135a9565b6108969060408101906020016131b7565b6108a46101808801886135a9565b6108b59060608101906040016131b7565b6108c560c0890160a08a016131b7565b60608901356108d86101808b018b6135a9565b6108e99060808101906060016135db565b63ffffffff166108fd6101808c018c6135a9565b61090b9060808101906135f8565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611c9792505050565b61097861095560208501856131b7565b61096560c0860160a087016131b7565b61097360608701358561365b565b611d64565b610bda565b600161099161018085016101608601613697565b60038111156109a2576109a2613672565b1415610b3157610a0b6109b860208501856131b7565b600e54600d546001600160a01b0391821691166109d96101808801886135a9565b6109ea9060608101906040016131b7565b6109fa60c0890160a08a016131b7565b86600061090b6101408c018c6135f8565b6012546001600160a01b03166328c1d569610a2c60408601602087016131b7565b610a3a6101808701876135a9565b610a489060208101906131b7565b610a566101808801886135a9565b610a679060408101906020016131b7565b610a756101808901896135a9565b610a869060608101906040016131b7565b610a9660c08a0160a08b016131b7565b60608a0135610aa96101808c018c6135a9565b610aba9060808101906060016135db565b610ac86101808d018d6135a9565b610ad69060808101906135f8565b6040518a63ffffffff1660e01b8152600401610afa999897969594939291906136b2565b600060405180830381600087803b158015610b1457600080fd5b505af1158015610b28573d6000803e3d6000fd5b50505050610bda565b610b3b8382611e4f565b91508260600135821015610b965760405162461bcd60e51b815260206004820152601860248201527f6661696c6564207377617070696e672066726f6d20646578000000000000000060448201526064015b60405180910390fd5b610ba961085b60408501602086016131b7565b610bda610bbc60408501602086016131b7565b610bcc60c0860160a087016131b7565b61097360608701358661365b565b610bf3610be684613850565b8285606001356001611f4f565b5050610bff6001600955565b50565b610c0a6117a3565b60058190556040518181527f11e8ee12d79dc7314b845f4e82465af5bd3d2214081526061af36de8364eaa2e906020016107a5565b6000610c496117a3565b610c5c6001600160a01b03831630611fd0565b92915050565b610c6a6117a3565b611388811115610ca85760405162461bcd60e51b8152602060048201526009602482015268746f6f206c6172676560b81b6044820152606401610b8d565b60108190556040518181527fa28aac6f4ba79029a647ee085b0ae88419c6aa87bae5dcf77d303dba45b3681b906020016107a5565b610ce56117a3565b600b80546001600160a01b0319166001600160a01b0383169081179091556040519081527f35e63b7fefc2b1fb2ed78adeed6688b187514d96c2d7d56222e52f3e41c2fb2f906020016107a5565b610d3b6117a3565b600680546001600160a01b0319166001600160a01b0383169081179091556040519081527f41408be49f75701fe4bb8484ce88d68f1d82e03cb4eb44263b6682ce2dbd32f0906020016107a5565b610d916117a3565b60118190556040518181527f8f817f25bf47abe304b519d80d1a633064758c57d280731736fe82ad20816c55906020016107a5565b600a5460405163181da82d60e21b81526001600160a01b03868116600483015285811660248301526044820185905260648201849052600092606092911690636076a0b49060840160006040518083038186803b158015610e2657600080fd5b505afa158015610e3a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610e629190810190613975565b9097909650945050505050565b60088181548110610e7f57600080fd5b6000918252602090912001546001600160a01b0316905081565b610ea16117a3565b610eab6000612071565b565b610eb56117fd565b866001600160a01b0316886001600160a01b03161415610ee75760405162461bcd60e51b8152600401610b8d90613a11565b610efc6001600160a01b038916333089611857565b6000610f0a89888787611949565b9050610f18898983856120c1565b5050610f246001600955565b5050505050505050565b610f366117a3565b600f80546001600160a01b0319166001600160a01b0383169081179091556040519081527f12e1d17016b94668449f97876f4a8d5cc2c19f314db337418894734037cc19d4906020016107a5565b610f8c6117a3565b60048190556040518181527f70f24e12a9db25e0d80cbcde19ffef47d6a7c52c1089db4c71e53ce1856577fc906020016107a5565b610fc96117a3565b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527f17780f3919f73af11f29e4157534858a06c91294d64b679fe4e49340122cd322906020016107a5565b61101f6117a3565b600e80546001600160a01b0319166001600160a01b0383169081179091556040519081527fe0209b1ff5892dc27d9ffb30000e308317645f928d78a0a018dd2e9289ecc292906020016107a5565b60006110776117fd565b8160800135826060013510156110ed5760405162461bcd60e51b815260206004820152603560248201527f657870656374656452657475726e206d75737420626520657175616c206f72206044820152743630b933b2b9103a3430b71036b4b72932ba3ab93760591b6064820152608401610b8d565b6110fd60408301602084016131b7565b6001600160a01b031661111360208401846131b7565b6001600160a01b0316141561113a5760405162461bcd60e51b8152600401610b8d90613a11565b60008060005b61114e610100860186613a59565b90508110156111cc576000611167610100870187613a59565b8381811061117757611177613aa2565b9050602002013511156111ba57611192610100860186613a59565b828181106111a2576111a2613aa2565b90506020020135836111b49190613ab8565b92508091505b806111c481613ad0565b915050611140565b5081611239576111f06111e260208601866131b7565b6001600160a01b031661218b565b1561122c5760405133903480156108fc02916000818181858888f19350505050158015611221573d6000803e3d6000fd5b503492505050611576565b5050506040810135611576565b611250333060408701356107cf60208901896131b7565b600061128161126260208701876131b7565b604087013561127760c0890160a08a016131b7565b8860c00135611949565b90506112ed611294610100870187613a59565b808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508592508791508690506112d860208b018b6131b7565b6112e860408c0160208d016131b7565b6121c4565b935083156115075784608001358410156113555760405162461bcd60e51b8152602060048201526024808201527f5377697463683a2052657475726e20616d6f756e7420776173206e6f7420656e6044820152630deeaced60e31b6064820152608401610b8d565b84606001358411156114775761139a611375610100870160e088016131b7565b606087013561138a6040890160208a016131b7565b6001600160a01b031691906123f4565b50600c546113c9906001600160a01b03166113b960608801358761365b565b61138a6040890160208a016131b7565b50600b546001600160a01b031663391fdc24336113ed610100890160e08a016131b7565b6113fa60208a018a6131b7565b61140a60408b0160208c016131b7565b60408b013560608c013561141e818d61365b565b6040518863ffffffff1660e01b81526004016114409796959493929190613aeb565b600060405180830381600087803b15801561145a57600080fd5b505af115801561146e573d6000803e3d6000fd5b50505050611572565b61149c61148b610100870160e088016131b7565b8561138a6040890160208a016131b7565b50600b546001600160a01b031663391fdc24336114c0610100890160e08a016131b7565b6114cd60208a018a6131b7565b6114dd60408b0160208c016131b7565b8a604001358a60006040518863ffffffff1660e01b81526004016114409796959493929190613aeb565b604085013561152c3061151d60208901896131b7565b6001600160a01b031690611fd0565b111561154e5761154833604087013561138a60208901896131b7565b50611572565b611570336115633061151d60208a018a6131b7565b61138a60208901896131b7565b505b5050505b6115806001600955565b919050565b6000806127106115958685613b2f565b61159f9190613b64565b91506115ab828661365b565b9050935093915050565b6115bd6117a3565b600c80546001600160a01b0319166001600160a01b0383169081179091556040519081527f53a596d7be747a5a4f4d39a6a36476d2eed407c93f6f2ba8a96c8b971240d5cd906020016107a5565b6116136117a3565b600d80546001600160a01b0319166001600160a01b0383169081179091556040519081527f4528d04696417deba6006cd6c7e5bbb56b9874ac9d954a956e14b8d74f08d72b906020016107a5565b6116696117a3565b805160035560005b81518110156116db57600882828151811061168e5761168e613aa2565b60209081029190910181015182546001810184556000938452919092200180546001600160a01b0319166001600160a01b03909216919091179055806116d381613ad0565b915050611671565b507fbbc63a7f378af7e269ef19f3fe0d08f044c91ee72930c0d045a58be58580f3d3816040516107a59190613b78565b6117136117a3565b6001600160a01b0381166117785760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610b8d565b610bff81612071565b6117896117a3565b61179d6001600160a01b03841682846123f4565b50505050565b6000546001600160a01b03163314610eab5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b8d565b600260095414156118505760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610b8d565b6002600955565b806118615761179d565b61186a8461218b565b15611934576001600160a01b038316331480156118875750803410155b6118e75760405162461bcd60e51b815260206004820152602b60248201527f57726f6e6720757365616765206f66204554482e756e6976657273616c54726160448201526a6e7366657246726f6d282960a81b6064820152608401610b8d565b6001600160a01b038216301461192f576040516001600160a01b0383169082156108fc029083906000818181858888f1935050505015801561192d573d6000803e3d6000fd5b505b61179d565b61179d6001600160a01b03851684848461246f565b600060105482111561199d5760405162461bcd60e51b815260206004820152601860248201527f706172746e65724665655261746520746f6f206c6172676500000000000000006044820152606401610b8d565b50828115611c8f57600f54604051637b8c4cdf60e01b81526001600160a01b0385811660048301526000921690637b8c4cdf9060240160206040518083038186803b1580156119eb57600080fd5b505afa1580156119ff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a239190613bc5565b15611aaa57600f54604051637b8c4cdf60e01b81526001600160a01b03868116600483015290911690637b8c4cdf9060240160206040518083038186803b158015611a6d57600080fd5b505afa158015611a81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aa59190613bc5565b611aae565b6011545b90506000611abe61271080613b2f565b601154611acb8887613b2f565b611ad59190613b2f565b611adf9190613b64565b9050600081612710611af18988613b2f565b611afb9190613b64565b611b05919061365b565b9050611b19886001600160a01b031661218b565b15611bac57600f546001600160a01b031663eedd56e1611b398484613ab8565b6040516001600160e01b031960e084901b1681526001600160a01b03808d16600483015260248201869052604482018790528a1660648201526084016000604051808303818588803b158015611b8e57600080fd5b505af1158015611ba2573d6000803e3d6000fd5b5050505050611c68565b600f54611bc7906001600160a01b038a8116911660006124da565b600f54611bf2906001600160a01b0316611be18484613ab8565b6001600160a01b038b1691906124da565b600f5460405163eedd56e160e01b81526001600160a01b038a81166004830152602482018490526044820185905288811660648301529091169063eedd56e190608401600060405180830381600087803b158015611c4f57600080fd5b505af1158015611c63573d6000803e3d6000fd5b505050505b612710611c758887613b2f565b611c7f9190613b64565b611c89908861365b565b93505050505b949350505050565b611ca9886001600160a01b031661218b565b15611cce57601254611cc8906001600160a01b038a81169116856123f4565b50611cea565b601254611ce8906001600160a01b038a81169116856123f4565b505b6012546040516328c1d56960e01b81526001600160a01b03909116906328c1d56990611d28908b908b908b908b908b908b908b908b90600401613c36565b600060405180830381600087803b158015611d4257600080fd5b505af1158015611d56573d6000803e3d6000fd5b505050505050505050505050565b611d76836001600160a01b031661218b565b15611dbd57804710611db8576040516001600160a01b0383169082156108fc029083906000818181858888f1935050505015801561179d573d6000803e3d6000fd5b505050565b6040516370a0823160e01b815230600482015281906001600160a01b038516906370a082319060240160206040518083038186803b158015611dfe57600080fd5b505afa158015611e12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e369190613bc5565b10611db85761179d6001600160a01b03841683836123f4565b600060018180805b611e6460c0880188613a59565b9050811015611ee0576000611e7c60c0890189613a59565b83818110611e8c57611e8c613aa2565b905060200201351115611ece57611ea660c0880188613a59565b82818110611eb657611eb6613aa2565b9050602002013583611ec89190613ab8565b92508091505b80611ed881613ad0565b915050611e57565b5060008211611f315760405162461bcd60e51b815260206004820152601a60248201527f696e76616c696420646973747269627574696f6e20706172616d0000000000006044820152606401610b8d565b611f45858383611f408a613850565b6125fe565b9695505050505050565b600b5460a08501516101808601518051602091820151885192890151604051637faf101560e01b81526001600160a01b0390961695637faf101595611fa2959094939290918b908b908b90600401613c98565b600060405180830381600087803b158015611fbc57600080fd5b505af1158015610f24573d6000803e3d6000fd5b6000611fdb8361218b565b15611ff157506001600160a01b03811631610c5c565b6040516370a0823160e01b81526001600160a01b0383811660048301528416906370a082319060240160206040518083038186803b15801561203257600080fd5b505afa158015612046573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061206a9190613bc5565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000836001600160a01b0316856001600160a01b031614156120f55760405162461bcd60e51b8152600401610b8d90613a11565b612100858484612667565b6121136001600160a01b03851630611fd0565b600b54604051630e47f70960e21b81529192506001600160a01b03169063391fdc249061215190339030908a908a908a908990600090600401613aeb565b600060405180830381600087803b15801561216b57600080fd5b505af115801561217f573d6000803e3d6000fd5b50505050949350505050565b60006001600160a01b0382161580610c5c57506001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1492915050565b60006004546003546121d69190613b2f565b875111156122565760405162461bcd60e51b815260206004820152604160248201527f5377697463683a20446973747269627574696f6e2061727261792073686f756c60448201527f64206e6f742065786365656420666163746f726965732061727261792073697a6064820152606560f81b608482015260a401610b8d565b856000805b89518110156123e75789818151811061227657612276613aa2565b60200260200101516000141561228b576123d5565b6000888b83815181106122a0576122a0613aa2565b60200260200101518b6122b39190613b2f565b6122bd9190613b64565b9050878214156122ca5750825b6122d4818561365b565b9350600454826122e49190613d08565b61232f576123288787836008600454876122fe9190613b64565b8154811061230e5761230e613aa2565b6000918252602090912001546001600160a01b03166127ab565b92506123c7565b60045461233c9083613d08565b600114156123845761232887878360086004548761235a9190613b64565b8154811061236a5761236a613aa2565b6000918252602090912001546001600160a01b03166127c2565b6123c487878360086004548761239a9190613b64565b815481106123aa576123aa613aa2565b6000918252602090912001546001600160a01b03166127df565b92505b6123d18386613ab8565b9450505b806123df81613ad0565b91505061225b565b5050509695505050505050565b6000816124035750600161206a565b61240c8461218b565b15612451576040516001600160a01b0384169083156108fc029084906000818181858888f19350505050158015612447573d6000803e3d6000fd5b506001905061206a565b6124656001600160a01b03851684846127fc565b5060019392505050565b6040516001600160a01b038085166024830152831660448201526064810182905261179d9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261282c565b8015806125635750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561252957600080fd5b505afa15801561253d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125619190613bc5565b155b6125ce5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610b8d565b6040516001600160a01b038316602482015260448101829052611db890849063095ea7b360e01b906064016124a3565b600061261a8260c00151868686866000015187602001516121c4565b90508160800151811015611c8f5760405162461bcd60e51b8152602060048201526014602482015273151a1948185b5bdd5b9d081d1bdbc81cdb585b1b60621b6044820152606401610b8d565b600061267b846001600160a01b031661218b565b156126d757824710156126d05760405162461bcd60e51b815260206004820152601b60248201527f4554482062616c616e636520697320696e73756666696369656e7400000000006044820152606401610b8d565b50816126f1565b600d546126f1906001600160a01b03868116911685612901565b600e546040516000916001600160a01b0316908390612711908690613d1c565b60006040518083038185875af1925050503d806000811461274e576040519150601f19603f3d011682016040523d82523d6000602084013e612753565b606091505b50509050806127a45760405162461bcd60e51b815260206004820152601960248201527f506172617377617020657865637574696f6e206661696c6564000000000000006044820152606401610b8d565b5050505050565b60006127b9858585856129dc565b95945050505050565b6006546000906127b99086906001600160a01b0316868686612e48565b6007546000906127b99086906001600160a01b0316868686612e48565b6040516001600160a01b038316602482015260448101829052611db890849063a9059cbb60e01b906064016124a3565b6000612881826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612e619092919063ffffffff16565b90508051600014806128a25750808060200190518101906128a29190613d2e565b611db85760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610b8d565b61290a8361218b565b611db8578061292857611db86001600160a01b0384168360006124da565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e9060440160206040518083038186803b15801561297357600080fd5b505afa158015612987573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129ab9190613bc5565b905080156129c8576129c86001600160a01b0385168460006124da565b61179d6001600160a01b03851684846124da565b60006129f0856001600160a01b031661218b565b15612a5f57600660009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0846040518263ffffffff1660e01b81526004016000604051808303818588803b158015612a4557600080fd5b505af1158015612a59573d6000803e3d6000fd5b50505050505b6000612a73866001600160a01b031661218b565b612a7d5785612a8a565b6006546001600160a01b03165b90506000612aa0866001600160a01b031661218b565b612aaa5785612ab7565b6006546001600160a01b03165b60405163e6a4390560e01b81526001600160a01b038481166004830152808316602483015291925060009186169063e6a439059060440160206040518083038186803b158015612b0657600080fd5b505afa158015612b1a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b3e9190613d50565b9050600080612b586001600160a01b03841686868b612e70565b919750925090508115612bbd57826001600160a01b031663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b158015612ba057600080fd5b505af1158015612bb4573d6000803e3d6000fd5b50505050612c31565b8015612c315760405163bc25cf7760e01b81527346fd07da395799f113a7584563b8cb886f33c2bc60048201526001600160a01b0384169063bc25cf7790602401600060405180830381600087803b158015612c1857600080fd5b505af1158015612c2c573d6000803e3d6000fd5b505050505b612c456001600160a01b038616848a6123f4565b50836001600160a01b0316856001600160a01b03161015612cda5760405163022c0d9f60e01b8152600060048201819052602482018890523060448301526080606483015260848201526001600160a01b0384169063022c0d9f9060a401600060405180830381600087803b158015612cbd57600080fd5b505af1158015612cd1573d6000803e3d6000fd5b50505050612d50565b60405163022c0d9f60e01b8152600481018790526000602482018190523060448301526080606483015260848201526001600160a01b0384169063022c0d9f9060a401600060405180830381600087803b158015612d3757600080fd5b505af1158015612d4b573d6000803e3d6000fd5b505050505b612d62896001600160a01b031661218b565b15612e3b576006546040516370a0823160e01b81523060048201526001600160a01b0390911690632e1a7d4d9082906370a082319060240160206040518083038186803b158015612db257600080fd5b505afa158015612dc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612dea9190613bc5565b6040518263ffffffff1660e01b8152600401612e0891815260200190565b600060405180830381600087803b158015612e2257600080fd5b505af1158015612e36573d6000803e3d6000fd5b505050505b5050505050949350505050565b6000611f458585612e5b898988886129dc565b856129dc565b6060611c8f848460008561300b565b6000808080612e886001600160a01b03881689611fd0565b90506000612e9f6001600160a01b0388168a611fd0565b90506000808a6001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015612edd57600080fd5b505afa158015612ef1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f159190613d84565b5091509150886001600160a01b03168a6001600160a01b03161115612f3657905b816001600160701b0316841080612f555750806001600160701b031683105b955085158015612f7f5750816001600160701b0316841180612f7f5750806001600160701b031683115b94506000612f8f896103e5613b2f565b90506000612fa685846001600160701b03166130e6565b612fb09083613b2f565b9050600082612fc888876001600160701b03166130e6565b612fd4906103e8613b2f565b612fde9190613ab8565b90508015612ff557612ff08183613b64565b612ff8565b60005b9950505050505050509450945094915050565b60608247101561306c5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610b8d565b600080866001600160a01b031685876040516130889190613d1c565b60006040518083038185875af1925050503d80600081146130c5576040519150601f19603f3d011682016040523d82523d6000602084013e6130ca565b606091505b50915091506130db878383876130fc565b979650505050505050565b60008183106130f5578161206a565b5090919050565b60608315613168578251613161576001600160a01b0385163b6131615760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610b8d565b5081611c8f565b611c8f838381511561317d5781518083602001fd5b8060405162461bcd60e51b8152600401610b8d9190613dc0565b6001600160a01b0381168114610bff57600080fd5b803561158081613197565b6000602082840312156131c957600080fd5b813561206a81613197565b6000602082840312156131e657600080fd5b81356001600160401b038111156131fc57600080fd5b82016101a0818503121561206a57600080fd5b60006020828403121561322157600080fd5b5035919050565b6000806000806080858703121561323e57600080fd5b843561324981613197565b9350602085013561325981613197565b93969395505050506040820135916060013590565b6000604082018483526020604081850152818551808452606086019150828701935060005b818110156132af57845183529383019391830191600101613293565b5090979650505050505050565b634e487b7160e01b600052604160045260246000fd5b6040516101a081016001600160401b03811182821017156132f5576132f56132bc565b60405290565b604051601f8201601f191681016001600160401b0381118282101715613323576133236132bc565b604052919050565b600082601f83011261333c57600080fd5b81356001600160401b03811115613355576133556132bc565b613368601f8201601f19166020016132fb565b81815284602083860101111561337d57600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600080600080610100898b0312156133b757600080fd5b88356133c281613197565b975060208901356133d281613197565b9650604089013595506060890135945060808901356133f081613197565b935060a0890135925060c089013561340781613197565b915060e08901356001600160401b0381111561342257600080fd5b61342e8b828c0161332b565b9150509295985092959890939650565b60006020828403121561345057600080fd5b81356001600160401b0381111561346657600080fd5b8201610120818503121561206a57600080fd5b60008060006060848603121561348e57600080fd5b8335925060208401356134a081613197565b929592945050506040919091013590565b60006001600160401b038211156134ca576134ca6132bc565b5060051b60200190565b600060208083850312156134e757600080fd5b82356001600160401b038111156134fd57600080fd5b8301601f8101851361350e57600080fd5b803561352161351c826134b1565b6132fb565b81815260059190911b8201830190838101908783111561354057600080fd5b928401925b828410156130db57833561355881613197565b82529284019290840190613545565b60008060006060848603121561357c57600080fd5b833561358781613197565b925060208401359150604084013561359e81613197565b809150509250925092565b60008235609e198336030181126135bf57600080fd5b9190910192915050565b63ffffffff81168114610bff57600080fd5b6000602082840312156135ed57600080fd5b813561206a816135c9565b6000808335601e1984360301811261360f57600080fd5b8301803591506001600160401b0382111561362957600080fd5b60200191503681900382131561363e57600080fd5b9250929050565b634e487b7160e01b600052601160045260246000fd5b60008282101561366d5761366d613645565b500390565b634e487b7160e01b600052602160045260246000fd5b80356004811061158057600080fd5b6000602082840312156136a957600080fd5b61206a82613688565b6001600160a01b038a811682528981166020830152888116604083015287811660608301528616608082015260a0810185905263ffffffff841660c082015261010060e08201819052810182905260006101208385828501376000838501820152601f909301601f19169091019091019998505050505050505050565b600082601f83011261374057600080fd5b8135602061375061351c836134b1565b82815260059290921b8401810191818101908684111561376f57600080fd5b8286015b8481101561378a5780358352918301918301613773565b509695505050505050565b600060a082840312156137a757600080fd5b60405160a081016001600160401b0382821081831117156137ca576137ca6132bc565b81604052829350843591506137de82613197565b9082526020840135906137f082613197565b8160208401526040850135915061380682613197565b8160408401526060850135915061381c826135c9565b816060840152608085013591508082111561383657600080fd5b506138438582860161332b565b6080830152505092915050565b60006101a0823603121561386357600080fd5b61386b6132d2565b613874836131ac565b8152613882602084016131ac565b60208201526040830135604082015260608301356060820152608083013560808201526138b160a084016131ac565b60a082015260c08301356001600160401b03808211156138d057600080fd5b6138dc3683870161372f565b60c08401526138ed60e086016131ac565b60e0840152610100858101359084015261012080860135908401526101409150818501358181111561391e57600080fd5b61392a3682880161332b565b8385015250610160915061393f828601613688565b828401526101809150818501358181111561395957600080fd5b61396536828801613795565b8385015250505080915050919050565b6000806040838503121561398857600080fd5b825191506020808401516001600160401b038111156139a657600080fd5b8401601f810186136139b757600080fd5b80516139c561351c826134b1565b81815260059190911b820183019083810190888311156139e457600080fd5b928401925b82841015613a02578351825292840192908401906139e9565b80955050505050509250929050565b60208082526028908201527f69742773206e6f7420616c6c6f77656420746f2073776170207769746820736160408201526736b2903a37b5b2b760c11b606082015260800190565b6000808335601e19843603018112613a7057600080fd5b8301803591506001600160401b03821115613a8a57600080fd5b6020019150600581901b360382131561363e57600080fd5b634e487b7160e01b600052603260045260246000fd5b60008219821115613acb57613acb613645565b500190565b6000600019821415613ae457613ae4613645565b5060010190565b6001600160a01b03978816815295871660208701529386166040860152919094166060840152608083019390935260a082019290925260c081019190915260e00190565b6000816000190483118215151615613b4957613b49613645565b500290565b634e487b7160e01b600052601260045260246000fd5b600082613b7357613b73613b4e565b500490565b6020808252825182820181905260009190848201906040850190845b81811015613bb95783516001600160a01b031683529284019291840191600101613b94565b50909695505050505050565b600060208284031215613bd757600080fd5b5051919050565b60005b83811015613bf9578181015183820152602001613be1565b8381111561179d5750506000910152565b60008151808452613c22816020860160208601613bde565b601f01601f19169290920160200192915050565b6001600160a01b0389811682528881166020830152878116604083015286811660608301528516608082015260a0810184905260c0810183905261010060e08201819052600090613c8983820185613c0a565b9b9a5050505050505050505050565b6001600160a01b0389811682528881166020830152878116604083015286811660608301528516608082015260a0810184905260c08101839052610100810160048310613cf557634e487b7160e01b600052602160045260246000fd5b8260e08301529998505050505050505050565b600082613d1757613d17613b4e565b500690565b600082516135bf818460208701613bde565b600060208284031215613d4057600080fd5b8151801515811461206a57600080fd5b600060208284031215613d6257600080fd5b815161206a81613197565b80516001600160701b038116811461158057600080fd5b600080600060608486031215613d9957600080fd5b613da284613d6d565b9250613db060208501613d6d565b9150604084015161359e816135c9565b60208152600061206a6020830184613c0a56fea264697066735822122035ad08fb8ad473412d841dd6f8cba6de7b528df310c3abda59e8a99d5834692d64736f6c63430008090033000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000006b4aafe0a2c03b223b73a681b544b1617a976ccb000000000000000000000000410f724847c92bc3cdacbcd4922f1d7833ec280a000000000000000000000000216b4b4ba9f3e719726886d34a177484278bfcae000000000000000000000000def171fe48cf0115b1d80b88dc8eab59176fee57000000000000000000000000af3e2b1d87a89d3f47089c8832643f882a59494500000000000000000000000028b9089b5f2724c1898e7dbb04a96c8c177fe46d00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000030000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f000000000000000000000000c0aee478e3658e2610c5f7a4a2e1777ce9e4f2ac000000000000000000000000115934131916c8b277dd010ee02de363c09d037cDeployed Bytecode
0x6080604052600436106102465760003560e01c80638c821e9011610139578063c415b95c116100b6578063e8984c5f1161007a578063e8984c5f1461069d578063ea15afc3146106bd578063ecefc705146106dd578063ee06d977146106f3578063f2fde38b14610713578063f640d5081461073357610246565b8063c415b95c146105ff578063c93d732d1461061f578063d6821ed814610632578063e37c425014610667578063e5932c401461067d57610246565b8063a85f3298116100fd578063a85f329814610569578063ab30469514610589578063ae551c661461059f578063b4c76fe0146105bf578063b9d52d3c146105df57610246565b80638c821e90146104df5780638da5cb5b146104f557806390f3f20814610513578063a42dce8014610529578063a734f06e1461054957610246565b806352b721f8116101c75780635c3d258f1161018b5780635c3d258f146104495780636076a0b414610469578063672383c414610497578063715018a6146104b75780638928a29f146104cc57610246565b806352b721f8146103b3578063538ba4f9146103c957806353fd7bf1146103e95780635b18075e146104095780635b769f3c1461042957610246565b80633aecd0e31161020e5780633aecd0e3146103055780633fc8cef314610333578063433b3c05146103535780634399fa561461037357806348c4d7811461039357610246565b8063116400781461025557806314f30bc214610275578063228cb7331461028857806323a9495e146102c557806331428a87146102e5575b3332141561025357600080fd5b005b34801561026157600080fd5b506102536102703660046131b7565b610753565b6102536102833660046131d4565b6107b0565b34801561029457600080fd5b50600c546102a8906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156102d157600080fd5b506102536102e036600461320f565b610c02565b3480156102f157600080fd5b50600a546102a8906001600160a01b031681565b34801561031157600080fd5b506103256103203660046131b7565b610c3f565b6040519081526020016102bc565b34801561033f57600080fd5b506006546102a8906001600160a01b031681565b34801561035f57600080fd5b506007546102a8906001600160a01b031681565b34801561037f57600080fd5b50600b546102a8906001600160a01b031681565b34801561039f57600080fd5b506102536103ae36600461320f565b610c62565b3480156103bf57600080fd5b5061032560115481565b3480156103d557600080fd5b506002546102a8906001600160a01b031681565b3480156103f557600080fd5b506102536104043660046131b7565b610cdd565b34801561041557600080fd5b50600d546102a8906001600160a01b031681565b34801561043557600080fd5b506102536104443660046131b7565b610d33565b34801561045557600080fd5b5061025361046436600461320f565b610d89565b34801561047557600080fd5b50610489610484366004613228565b610dc6565b6040516102bc92919061326e565b3480156104a357600080fd5b506102a86104b236600461320f565b610e6f565b3480156104c357600080fd5b50610253610e99565b6102536104da36600461339a565b610ead565b3480156104eb57600080fd5b5061032560045481565b34801561050157600080fd5b506000546001600160a01b03166102a8565b34801561051f57600080fd5b5061032560055481565b34801561053557600080fd5b506102536105443660046131b7565b610f2e565b34801561055557600080fd5b506001546102a8906001600160a01b031681565b34801561057557600080fd5b5061025361058436600461320f565b610f84565b34801561059557600080fd5b5061032560035481565b3480156105ab57600080fd5b50600e546102a8906001600160a01b031681565b3480156105cb57600080fd5b506102536105da3660046131b7565b610fc1565b3480156105eb57600080fd5b506102536105fa3660046131b7565b611017565b34801561060b57600080fd5b50600f546102a8906001600160a01b031681565b61032561062d36600461343e565b61106d565b34801561063e57600080fd5b5061065261064d366004613479565b611585565b604080519283526020830191909152016102bc565b34801561067357600080fd5b5061032560105481565b34801561068957600080fd5b506102536106983660046131b7565b6115b5565b3480156106a957600080fd5b506102536106b83660046131b7565b61160b565b3480156106c957600080fd5b506102536106d83660046134d4565b611661565b3480156106e957600080fd5b5061032561271081565b3480156106ff57600080fd5b506012546102a8906001600160a01b031681565b34801561071f57600080fd5b5061025361072e3660046131b7565b61170b565b34801561073f57600080fd5b5061025361074e366004613567565b611781565b61075b6117a3565b601280546001600160a01b0319166001600160a01b0383169081179091556040519081527f18dcb7d948e71f663c851d90e4df772a77de47691049183356fef763546a789f906020015b60405180910390a150565b6107b86117fd565b6107e0333060408401356107cf60208601866131b7565b6001600160a01b0316929190611857565b6000806108146107f360208501856131b7565b6040850135610809610100870160e088016131b7565b866101000135611949565b905061082660408401602085016131b7565b6001600160a01b031661083c60208501856131b7565b6001600160a01b0316141561097d5761094561085b60208501856131b7565b6108696101808601866135a9565b6108779060208101906131b7565b6108856101808701876135a9565b6108969060408101906020016131b7565b6108a46101808801886135a9565b6108b59060608101906040016131b7565b6108c560c0890160a08a016131b7565b60608901356108d86101808b018b6135a9565b6108e99060808101906060016135db565b63ffffffff166108fd6101808c018c6135a9565b61090b9060808101906135f8565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611c9792505050565b61097861095560208501856131b7565b61096560c0860160a087016131b7565b61097360608701358561365b565b611d64565b610bda565b600161099161018085016101608601613697565b60038111156109a2576109a2613672565b1415610b3157610a0b6109b860208501856131b7565b600e54600d546001600160a01b0391821691166109d96101808801886135a9565b6109ea9060608101906040016131b7565b6109fa60c0890160a08a016131b7565b86600061090b6101408c018c6135f8565b6012546001600160a01b03166328c1d569610a2c60408601602087016131b7565b610a3a6101808701876135a9565b610a489060208101906131b7565b610a566101808801886135a9565b610a679060408101906020016131b7565b610a756101808901896135a9565b610a869060608101906040016131b7565b610a9660c08a0160a08b016131b7565b60608a0135610aa96101808c018c6135a9565b610aba9060808101906060016135db565b610ac86101808d018d6135a9565b610ad69060808101906135f8565b6040518a63ffffffff1660e01b8152600401610afa999897969594939291906136b2565b600060405180830381600087803b158015610b1457600080fd5b505af1158015610b28573d6000803e3d6000fd5b50505050610bda565b610b3b8382611e4f565b91508260600135821015610b965760405162461bcd60e51b815260206004820152601860248201527f6661696c6564207377617070696e672066726f6d20646578000000000000000060448201526064015b60405180910390fd5b610ba961085b60408501602086016131b7565b610bda610bbc60408501602086016131b7565b610bcc60c0860160a087016131b7565b61097360608701358661365b565b610bf3610be684613850565b8285606001356001611f4f565b5050610bff6001600955565b50565b610c0a6117a3565b60058190556040518181527f11e8ee12d79dc7314b845f4e82465af5bd3d2214081526061af36de8364eaa2e906020016107a5565b6000610c496117a3565b610c5c6001600160a01b03831630611fd0565b92915050565b610c6a6117a3565b611388811115610ca85760405162461bcd60e51b8152602060048201526009602482015268746f6f206c6172676560b81b6044820152606401610b8d565b60108190556040518181527fa28aac6f4ba79029a647ee085b0ae88419c6aa87bae5dcf77d303dba45b3681b906020016107a5565b610ce56117a3565b600b80546001600160a01b0319166001600160a01b0383169081179091556040519081527f35e63b7fefc2b1fb2ed78adeed6688b187514d96c2d7d56222e52f3e41c2fb2f906020016107a5565b610d3b6117a3565b600680546001600160a01b0319166001600160a01b0383169081179091556040519081527f41408be49f75701fe4bb8484ce88d68f1d82e03cb4eb44263b6682ce2dbd32f0906020016107a5565b610d916117a3565b60118190556040518181527f8f817f25bf47abe304b519d80d1a633064758c57d280731736fe82ad20816c55906020016107a5565b600a5460405163181da82d60e21b81526001600160a01b03868116600483015285811660248301526044820185905260648201849052600092606092911690636076a0b49060840160006040518083038186803b158015610e2657600080fd5b505afa158015610e3a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610e629190810190613975565b9097909650945050505050565b60088181548110610e7f57600080fd5b6000918252602090912001546001600160a01b0316905081565b610ea16117a3565b610eab6000612071565b565b610eb56117fd565b866001600160a01b0316886001600160a01b03161415610ee75760405162461bcd60e51b8152600401610b8d90613a11565b610efc6001600160a01b038916333089611857565b6000610f0a89888787611949565b9050610f18898983856120c1565b5050610f246001600955565b5050505050505050565b610f366117a3565b600f80546001600160a01b0319166001600160a01b0383169081179091556040519081527f12e1d17016b94668449f97876f4a8d5cc2c19f314db337418894734037cc19d4906020016107a5565b610f8c6117a3565b60048190556040518181527f70f24e12a9db25e0d80cbcde19ffef47d6a7c52c1089db4c71e53ce1856577fc906020016107a5565b610fc96117a3565b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527f17780f3919f73af11f29e4157534858a06c91294d64b679fe4e49340122cd322906020016107a5565b61101f6117a3565b600e80546001600160a01b0319166001600160a01b0383169081179091556040519081527fe0209b1ff5892dc27d9ffb30000e308317645f928d78a0a018dd2e9289ecc292906020016107a5565b60006110776117fd565b8160800135826060013510156110ed5760405162461bcd60e51b815260206004820152603560248201527f657870656374656452657475726e206d75737420626520657175616c206f72206044820152743630b933b2b9103a3430b71036b4b72932ba3ab93760591b6064820152608401610b8d565b6110fd60408301602084016131b7565b6001600160a01b031661111360208401846131b7565b6001600160a01b0316141561113a5760405162461bcd60e51b8152600401610b8d90613a11565b60008060005b61114e610100860186613a59565b90508110156111cc576000611167610100870187613a59565b8381811061117757611177613aa2565b9050602002013511156111ba57611192610100860186613a59565b828181106111a2576111a2613aa2565b90506020020135836111b49190613ab8565b92508091505b806111c481613ad0565b915050611140565b5081611239576111f06111e260208601866131b7565b6001600160a01b031661218b565b1561122c5760405133903480156108fc02916000818181858888f19350505050158015611221573d6000803e3d6000fd5b503492505050611576565b5050506040810135611576565b611250333060408701356107cf60208901896131b7565b600061128161126260208701876131b7565b604087013561127760c0890160a08a016131b7565b8860c00135611949565b90506112ed611294610100870187613a59565b808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508592508791508690506112d860208b018b6131b7565b6112e860408c0160208d016131b7565b6121c4565b935083156115075784608001358410156113555760405162461bcd60e51b8152602060048201526024808201527f5377697463683a2052657475726e20616d6f756e7420776173206e6f7420656e6044820152630deeaced60e31b6064820152608401610b8d565b84606001358411156114775761139a611375610100870160e088016131b7565b606087013561138a6040890160208a016131b7565b6001600160a01b031691906123f4565b50600c546113c9906001600160a01b03166113b960608801358761365b565b61138a6040890160208a016131b7565b50600b546001600160a01b031663391fdc24336113ed610100890160e08a016131b7565b6113fa60208a018a6131b7565b61140a60408b0160208c016131b7565b60408b013560608c013561141e818d61365b565b6040518863ffffffff1660e01b81526004016114409796959493929190613aeb565b600060405180830381600087803b15801561145a57600080fd5b505af115801561146e573d6000803e3d6000fd5b50505050611572565b61149c61148b610100870160e088016131b7565b8561138a6040890160208a016131b7565b50600b546001600160a01b031663391fdc24336114c0610100890160e08a016131b7565b6114cd60208a018a6131b7565b6114dd60408b0160208c016131b7565b8a604001358a60006040518863ffffffff1660e01b81526004016114409796959493929190613aeb565b604085013561152c3061151d60208901896131b7565b6001600160a01b031690611fd0565b111561154e5761154833604087013561138a60208901896131b7565b50611572565b611570336115633061151d60208a018a6131b7565b61138a60208901896131b7565b505b5050505b6115806001600955565b919050565b6000806127106115958685613b2f565b61159f9190613b64565b91506115ab828661365b565b9050935093915050565b6115bd6117a3565b600c80546001600160a01b0319166001600160a01b0383169081179091556040519081527f53a596d7be747a5a4f4d39a6a36476d2eed407c93f6f2ba8a96c8b971240d5cd906020016107a5565b6116136117a3565b600d80546001600160a01b0319166001600160a01b0383169081179091556040519081527f4528d04696417deba6006cd6c7e5bbb56b9874ac9d954a956e14b8d74f08d72b906020016107a5565b6116696117a3565b805160035560005b81518110156116db57600882828151811061168e5761168e613aa2565b60209081029190910181015182546001810184556000938452919092200180546001600160a01b0319166001600160a01b03909216919091179055806116d381613ad0565b915050611671565b507fbbc63a7f378af7e269ef19f3fe0d08f044c91ee72930c0d045a58be58580f3d3816040516107a59190613b78565b6117136117a3565b6001600160a01b0381166117785760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610b8d565b610bff81612071565b6117896117a3565b61179d6001600160a01b03841682846123f4565b50505050565b6000546001600160a01b03163314610eab5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b8d565b600260095414156118505760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610b8d565b6002600955565b806118615761179d565b61186a8461218b565b15611934576001600160a01b038316331480156118875750803410155b6118e75760405162461bcd60e51b815260206004820152602b60248201527f57726f6e6720757365616765206f66204554482e756e6976657273616c54726160448201526a6e7366657246726f6d282960a81b6064820152608401610b8d565b6001600160a01b038216301461192f576040516001600160a01b0383169082156108fc029083906000818181858888f1935050505015801561192d573d6000803e3d6000fd5b505b61179d565b61179d6001600160a01b03851684848461246f565b600060105482111561199d5760405162461bcd60e51b815260206004820152601860248201527f706172746e65724665655261746520746f6f206c6172676500000000000000006044820152606401610b8d565b50828115611c8f57600f54604051637b8c4cdf60e01b81526001600160a01b0385811660048301526000921690637b8c4cdf9060240160206040518083038186803b1580156119eb57600080fd5b505afa1580156119ff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a239190613bc5565b15611aaa57600f54604051637b8c4cdf60e01b81526001600160a01b03868116600483015290911690637b8c4cdf9060240160206040518083038186803b158015611a6d57600080fd5b505afa158015611a81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aa59190613bc5565b611aae565b6011545b90506000611abe61271080613b2f565b601154611acb8887613b2f565b611ad59190613b2f565b611adf9190613b64565b9050600081612710611af18988613b2f565b611afb9190613b64565b611b05919061365b565b9050611b19886001600160a01b031661218b565b15611bac57600f546001600160a01b031663eedd56e1611b398484613ab8565b6040516001600160e01b031960e084901b1681526001600160a01b03808d16600483015260248201869052604482018790528a1660648201526084016000604051808303818588803b158015611b8e57600080fd5b505af1158015611ba2573d6000803e3d6000fd5b5050505050611c68565b600f54611bc7906001600160a01b038a8116911660006124da565b600f54611bf2906001600160a01b0316611be18484613ab8565b6001600160a01b038b1691906124da565b600f5460405163eedd56e160e01b81526001600160a01b038a81166004830152602482018490526044820185905288811660648301529091169063eedd56e190608401600060405180830381600087803b158015611c4f57600080fd5b505af1158015611c63573d6000803e3d6000fd5b505050505b612710611c758887613b2f565b611c7f9190613b64565b611c89908861365b565b93505050505b949350505050565b611ca9886001600160a01b031661218b565b15611cce57601254611cc8906001600160a01b038a81169116856123f4565b50611cea565b601254611ce8906001600160a01b038a81169116856123f4565b505b6012546040516328c1d56960e01b81526001600160a01b03909116906328c1d56990611d28908b908b908b908b908b908b908b908b90600401613c36565b600060405180830381600087803b158015611d4257600080fd5b505af1158015611d56573d6000803e3d6000fd5b505050505050505050505050565b611d76836001600160a01b031661218b565b15611dbd57804710611db8576040516001600160a01b0383169082156108fc029083906000818181858888f1935050505015801561179d573d6000803e3d6000fd5b505050565b6040516370a0823160e01b815230600482015281906001600160a01b038516906370a082319060240160206040518083038186803b158015611dfe57600080fd5b505afa158015611e12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e369190613bc5565b10611db85761179d6001600160a01b03841683836123f4565b600060018180805b611e6460c0880188613a59565b9050811015611ee0576000611e7c60c0890189613a59565b83818110611e8c57611e8c613aa2565b905060200201351115611ece57611ea660c0880188613a59565b82818110611eb657611eb6613aa2565b9050602002013583611ec89190613ab8565b92508091505b80611ed881613ad0565b915050611e57565b5060008211611f315760405162461bcd60e51b815260206004820152601a60248201527f696e76616c696420646973747269627574696f6e20706172616d0000000000006044820152606401610b8d565b611f45858383611f408a613850565b6125fe565b9695505050505050565b600b5460a08501516101808601518051602091820151885192890151604051637faf101560e01b81526001600160a01b0390961695637faf101595611fa2959094939290918b908b908b90600401613c98565b600060405180830381600087803b158015611fbc57600080fd5b505af1158015610f24573d6000803e3d6000fd5b6000611fdb8361218b565b15611ff157506001600160a01b03811631610c5c565b6040516370a0823160e01b81526001600160a01b0383811660048301528416906370a082319060240160206040518083038186803b15801561203257600080fd5b505afa158015612046573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061206a9190613bc5565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000836001600160a01b0316856001600160a01b031614156120f55760405162461bcd60e51b8152600401610b8d90613a11565b612100858484612667565b6121136001600160a01b03851630611fd0565b600b54604051630e47f70960e21b81529192506001600160a01b03169063391fdc249061215190339030908a908a908a908990600090600401613aeb565b600060405180830381600087803b15801561216b57600080fd5b505af115801561217f573d6000803e3d6000fd5b50505050949350505050565b60006001600160a01b0382161580610c5c57506001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1492915050565b60006004546003546121d69190613b2f565b875111156122565760405162461bcd60e51b815260206004820152604160248201527f5377697463683a20446973747269627574696f6e2061727261792073686f756c60448201527f64206e6f742065786365656420666163746f726965732061727261792073697a6064820152606560f81b608482015260a401610b8d565b856000805b89518110156123e75789818151811061227657612276613aa2565b60200260200101516000141561228b576123d5565b6000888b83815181106122a0576122a0613aa2565b60200260200101518b6122b39190613b2f565b6122bd9190613b64565b9050878214156122ca5750825b6122d4818561365b565b9350600454826122e49190613d08565b61232f576123288787836008600454876122fe9190613b64565b8154811061230e5761230e613aa2565b6000918252602090912001546001600160a01b03166127ab565b92506123c7565b60045461233c9083613d08565b600114156123845761232887878360086004548761235a9190613b64565b8154811061236a5761236a613aa2565b6000918252602090912001546001600160a01b03166127c2565b6123c487878360086004548761239a9190613b64565b815481106123aa576123aa613aa2565b6000918252602090912001546001600160a01b03166127df565b92505b6123d18386613ab8565b9450505b806123df81613ad0565b91505061225b565b5050509695505050505050565b6000816124035750600161206a565b61240c8461218b565b15612451576040516001600160a01b0384169083156108fc029084906000818181858888f19350505050158015612447573d6000803e3d6000fd5b506001905061206a565b6124656001600160a01b03851684846127fc565b5060019392505050565b6040516001600160a01b038085166024830152831660448201526064810182905261179d9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261282c565b8015806125635750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561252957600080fd5b505afa15801561253d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125619190613bc5565b155b6125ce5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610b8d565b6040516001600160a01b038316602482015260448101829052611db890849063095ea7b360e01b906064016124a3565b600061261a8260c00151868686866000015187602001516121c4565b90508160800151811015611c8f5760405162461bcd60e51b8152602060048201526014602482015273151a1948185b5bdd5b9d081d1bdbc81cdb585b1b60621b6044820152606401610b8d565b600061267b846001600160a01b031661218b565b156126d757824710156126d05760405162461bcd60e51b815260206004820152601b60248201527f4554482062616c616e636520697320696e73756666696369656e7400000000006044820152606401610b8d565b50816126f1565b600d546126f1906001600160a01b03868116911685612901565b600e546040516000916001600160a01b0316908390612711908690613d1c565b60006040518083038185875af1925050503d806000811461274e576040519150601f19603f3d011682016040523d82523d6000602084013e612753565b606091505b50509050806127a45760405162461bcd60e51b815260206004820152601960248201527f506172617377617020657865637574696f6e206661696c6564000000000000006044820152606401610b8d565b5050505050565b60006127b9858585856129dc565b95945050505050565b6006546000906127b99086906001600160a01b0316868686612e48565b6007546000906127b99086906001600160a01b0316868686612e48565b6040516001600160a01b038316602482015260448101829052611db890849063a9059cbb60e01b906064016124a3565b6000612881826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612e619092919063ffffffff16565b90508051600014806128a25750808060200190518101906128a29190613d2e565b611db85760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610b8d565b61290a8361218b565b611db8578061292857611db86001600160a01b0384168360006124da565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e9060440160206040518083038186803b15801561297357600080fd5b505afa158015612987573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129ab9190613bc5565b905080156129c8576129c86001600160a01b0385168460006124da565b61179d6001600160a01b03851684846124da565b60006129f0856001600160a01b031661218b565b15612a5f57600660009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0846040518263ffffffff1660e01b81526004016000604051808303818588803b158015612a4557600080fd5b505af1158015612a59573d6000803e3d6000fd5b50505050505b6000612a73866001600160a01b031661218b565b612a7d5785612a8a565b6006546001600160a01b03165b90506000612aa0866001600160a01b031661218b565b612aaa5785612ab7565b6006546001600160a01b03165b60405163e6a4390560e01b81526001600160a01b038481166004830152808316602483015291925060009186169063e6a439059060440160206040518083038186803b158015612b0657600080fd5b505afa158015612b1a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b3e9190613d50565b9050600080612b586001600160a01b03841686868b612e70565b919750925090508115612bbd57826001600160a01b031663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b158015612ba057600080fd5b505af1158015612bb4573d6000803e3d6000fd5b50505050612c31565b8015612c315760405163bc25cf7760e01b81527346fd07da395799f113a7584563b8cb886f33c2bc60048201526001600160a01b0384169063bc25cf7790602401600060405180830381600087803b158015612c1857600080fd5b505af1158015612c2c573d6000803e3d6000fd5b505050505b612c456001600160a01b038616848a6123f4565b50836001600160a01b0316856001600160a01b03161015612cda5760405163022c0d9f60e01b8152600060048201819052602482018890523060448301526080606483015260848201526001600160a01b0384169063022c0d9f9060a401600060405180830381600087803b158015612cbd57600080fd5b505af1158015612cd1573d6000803e3d6000fd5b50505050612d50565b60405163022c0d9f60e01b8152600481018790526000602482018190523060448301526080606483015260848201526001600160a01b0384169063022c0d9f9060a401600060405180830381600087803b158015612d3757600080fd5b505af1158015612d4b573d6000803e3d6000fd5b505050505b612d62896001600160a01b031661218b565b15612e3b576006546040516370a0823160e01b81523060048201526001600160a01b0390911690632e1a7d4d9082906370a082319060240160206040518083038186803b158015612db257600080fd5b505afa158015612dc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612dea9190613bc5565b6040518263ffffffff1660e01b8152600401612e0891815260200190565b600060405180830381600087803b158015612e2257600080fd5b505af1158015612e36573d6000803e3d6000fd5b505050505b5050505050949350505050565b6000611f458585612e5b898988886129dc565b856129dc565b6060611c8f848460008561300b565b6000808080612e886001600160a01b03881689611fd0565b90506000612e9f6001600160a01b0388168a611fd0565b90506000808a6001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015612edd57600080fd5b505afa158015612ef1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f159190613d84565b5091509150886001600160a01b03168a6001600160a01b03161115612f3657905b816001600160701b0316841080612f555750806001600160701b031683105b955085158015612f7f5750816001600160701b0316841180612f7f5750806001600160701b031683115b94506000612f8f896103e5613b2f565b90506000612fa685846001600160701b03166130e6565b612fb09083613b2f565b9050600082612fc888876001600160701b03166130e6565b612fd4906103e8613b2f565b612fde9190613ab8565b90508015612ff557612ff08183613b64565b612ff8565b60005b9950505050505050509450945094915050565b60608247101561306c5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610b8d565b600080866001600160a01b031685876040516130889190613d1c565b60006040518083038185875af1925050503d80600081146130c5576040519150601f19603f3d011682016040523d82523d6000602084013e6130ca565b606091505b50915091506130db878383876130fc565b979650505050505050565b60008183106130f5578161206a565b5090919050565b60608315613168578251613161576001600160a01b0385163b6131615760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610b8d565b5081611c8f565b611c8f838381511561317d5781518083602001fd5b8060405162461bcd60e51b8152600401610b8d9190613dc0565b6001600160a01b0381168114610bff57600080fd5b803561158081613197565b6000602082840312156131c957600080fd5b813561206a81613197565b6000602082840312156131e657600080fd5b81356001600160401b038111156131fc57600080fd5b82016101a0818503121561206a57600080fd5b60006020828403121561322157600080fd5b5035919050565b6000806000806080858703121561323e57600080fd5b843561324981613197565b9350602085013561325981613197565b93969395505050506040820135916060013590565b6000604082018483526020604081850152818551808452606086019150828701935060005b818110156132af57845183529383019391830191600101613293565b5090979650505050505050565b634e487b7160e01b600052604160045260246000fd5b6040516101a081016001600160401b03811182821017156132f5576132f56132bc565b60405290565b604051601f8201601f191681016001600160401b0381118282101715613323576133236132bc565b604052919050565b600082601f83011261333c57600080fd5b81356001600160401b03811115613355576133556132bc565b613368601f8201601f19166020016132fb565b81815284602083860101111561337d57600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600080600080610100898b0312156133b757600080fd5b88356133c281613197565b975060208901356133d281613197565b9650604089013595506060890135945060808901356133f081613197565b935060a0890135925060c089013561340781613197565b915060e08901356001600160401b0381111561342257600080fd5b61342e8b828c0161332b565b9150509295985092959890939650565b60006020828403121561345057600080fd5b81356001600160401b0381111561346657600080fd5b8201610120818503121561206a57600080fd5b60008060006060848603121561348e57600080fd5b8335925060208401356134a081613197565b929592945050506040919091013590565b60006001600160401b038211156134ca576134ca6132bc565b5060051b60200190565b600060208083850312156134e757600080fd5b82356001600160401b038111156134fd57600080fd5b8301601f8101851361350e57600080fd5b803561352161351c826134b1565b6132fb565b81815260059190911b8201830190838101908783111561354057600080fd5b928401925b828410156130db57833561355881613197565b82529284019290840190613545565b60008060006060848603121561357c57600080fd5b833561358781613197565b925060208401359150604084013561359e81613197565b809150509250925092565b60008235609e198336030181126135bf57600080fd5b9190910192915050565b63ffffffff81168114610bff57600080fd5b6000602082840312156135ed57600080fd5b813561206a816135c9565b6000808335601e1984360301811261360f57600080fd5b8301803591506001600160401b0382111561362957600080fd5b60200191503681900382131561363e57600080fd5b9250929050565b634e487b7160e01b600052601160045260246000fd5b60008282101561366d5761366d613645565b500390565b634e487b7160e01b600052602160045260246000fd5b80356004811061158057600080fd5b6000602082840312156136a957600080fd5b61206a82613688565b6001600160a01b038a811682528981166020830152888116604083015287811660608301528616608082015260a0810185905263ffffffff841660c082015261010060e08201819052810182905260006101208385828501376000838501820152601f909301601f19169091019091019998505050505050505050565b600082601f83011261374057600080fd5b8135602061375061351c836134b1565b82815260059290921b8401810191818101908684111561376f57600080fd5b8286015b8481101561378a5780358352918301918301613773565b509695505050505050565b600060a082840312156137a757600080fd5b60405160a081016001600160401b0382821081831117156137ca576137ca6132bc565b81604052829350843591506137de82613197565b9082526020840135906137f082613197565b8160208401526040850135915061380682613197565b8160408401526060850135915061381c826135c9565b816060840152608085013591508082111561383657600080fd5b506138438582860161332b565b6080830152505092915050565b60006101a0823603121561386357600080fd5b61386b6132d2565b613874836131ac565b8152613882602084016131ac565b60208201526040830135604082015260608301356060820152608083013560808201526138b160a084016131ac565b60a082015260c08301356001600160401b03808211156138d057600080fd5b6138dc3683870161372f565b60c08401526138ed60e086016131ac565b60e0840152610100858101359084015261012080860135908401526101409150818501358181111561391e57600080fd5b61392a3682880161332b565b8385015250610160915061393f828601613688565b828401526101809150818501358181111561395957600080fd5b61396536828801613795565b8385015250505080915050919050565b6000806040838503121561398857600080fd5b825191506020808401516001600160401b038111156139a657600080fd5b8401601f810186136139b757600080fd5b80516139c561351c826134b1565b81815260059190911b820183019083810190888311156139e457600080fd5b928401925b82841015613a02578351825292840192908401906139e9565b80955050505050509250929050565b60208082526028908201527f69742773206e6f7420616c6c6f77656420746f2073776170207769746820736160408201526736b2903a37b5b2b760c11b606082015260800190565b6000808335601e19843603018112613a7057600080fd5b8301803591506001600160401b03821115613a8a57600080fd5b6020019150600581901b360382131561363e57600080fd5b634e487b7160e01b600052603260045260246000fd5b60008219821115613acb57613acb613645565b500190565b6000600019821415613ae457613ae4613645565b5060010190565b6001600160a01b03978816815295871660208701529386166040860152919094166060840152608083019390935260a082019290925260c081019190915260e00190565b6000816000190483118215151615613b4957613b49613645565b500290565b634e487b7160e01b600052601260045260246000fd5b600082613b7357613b73613b4e565b500490565b6020808252825182820181905260009190848201906040850190845b81811015613bb95783516001600160a01b031683529284019291840191600101613b94565b50909695505050505050565b600060208284031215613bd757600080fd5b5051919050565b60005b83811015613bf9578181015183820152602001613be1565b8381111561179d5750506000910152565b60008151808452613c22816020860160208601613bde565b601f01601f19169290920160200192915050565b6001600160a01b0389811682528881166020830152878116604083015286811660608301528516608082015260a0810184905260c0810183905261010060e08201819052600090613c8983820185613c0a565b9b9a5050505050505050505050565b6001600160a01b0389811682528881166020830152878116604083015286811660608301528516608082015260a0810184905260c08101839052610100810160048310613cf557634e487b7160e01b600052602160045260246000fd5b8260e08301529998505050505050505050565b600082613d1757613d17613b4e565b500690565b600082516135bf818460208701613bde565b600060208284031215613d4057600080fd5b8151801515811461206a57600080fd5b600060208284031215613d6257600080fd5b815161206a81613197565b80516001600160701b038116811461158057600080fd5b600080600060608486031215613d9957600080fd5b613da284613d6d565b9250613db060208501613d6d565b9150604084015161359e816135c9565b60208152600061206a6020830184613c0a56fea264697066735822122035ad08fb8ad473412d841dd6f8cba6de7b528df310c3abda59e8a99d5834692d64736f6c63430008090033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000006b4aafe0a2c03b223b73a681b544b1617a976ccb000000000000000000000000410f724847c92bc3cdacbcd4922f1d7833ec280a000000000000000000000000216b4b4ba9f3e719726886d34a177484278bfcae000000000000000000000000def171fe48cf0115b1d80b88dc8eab59176fee57000000000000000000000000af3e2b1d87a89d3f47089c8832643f882a59494500000000000000000000000028b9089b5f2724c1898e7dbb04a96c8c177fe46d00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000030000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f000000000000000000000000c0aee478e3658e2610c5f7a4a2e1777ce9e4f2ac000000000000000000000000115934131916c8b277dd010ee02de363c09d037c
-----Decoded View---------------
Arg [0] : _weth (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
Arg [1] : _otherToken (address): 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
Arg [2] : _pathCountAndSplit (uint256[]): 2,2
Arg [3] : _factories (address[]): 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f,0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac,0x115934131916C8b277DD010Ee02de363c09d037c
Arg [4] : _switchViewAddress (address): 0x6B4AAFE0A2C03B223b73a681b544b1617A976CcB
Arg [5] : _switchEventAddress (address): 0x410f724847C92Bc3CdACBCD4922F1D7833Ec280A
Arg [6] : _paraswapProxy (address): 0x216B4B4Ba9F3e719726886d34a177484278Bfcae
Arg [7] : _augustusSwapper (address): 0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57
Arg [8] : _callDataExecutor (address): 0xaf3E2B1D87a89D3f47089c8832643F882a594945
Arg [9] : _feeCollector (address): 0x28B9089b5f2724c1898E7dbb04a96C8C177fE46d
-----Encoded View---------------
17 Constructor Arguments found :
Arg [0] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Arg [1] : 000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000140
Arg [3] : 00000000000000000000000000000000000000000000000000000000000001a0
Arg [4] : 0000000000000000000000006b4aafe0a2c03b223b73a681b544b1617a976ccb
Arg [5] : 000000000000000000000000410f724847c92bc3cdacbcd4922f1d7833ec280a
Arg [6] : 000000000000000000000000216b4b4ba9f3e719726886d34a177484278bfcae
Arg [7] : 000000000000000000000000def171fe48cf0115b1d80b88dc8eab59176fee57
Arg [8] : 000000000000000000000000af3e2b1d87a89d3f47089c8832643f882a594945
Arg [9] : 00000000000000000000000028b9089b5f2724c1898e7dbb04a96c8c177fe46d
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [11] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [12] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [13] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [14] : 0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f
Arg [15] : 000000000000000000000000c0aee478e3658e2610c5f7a4a2e1777ce9e4f2ac
Arg [16] : 000000000000000000000000115934131916c8b277dd010ee02de363c09d037cLoading...LoadingLoading...Loading
Loading...Loading
Loading...LoadingLoading...LoadingLoading...LoadingLoading...LoadingLoading...LoadingLoading...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.
Address QR Code
My Address - Private Name Tag or Note
My Name Tag:
Private Name Tags (up to 35 characters) can be used for easy identification of addressesPrivate Note:
A private note (up to 500 characters) can be attached to this address.
Please DO NOT store any passwords or private keys here.Compiler specific version warnings:
The compiled contract might be susceptible to VerbatimInvalidDeduplication (low-severity), FullInlinerNonExpressionSplitArgumentEvaluationOrder (low-severity), MissingSideEffectsOnSelectorAccess (low-severity), AbiReencodingHeadOverflowWithStaticArrayCleanup (medium-severity), DirtyBytesArrayToStorage (low-severity), DataLocationChangeInInternalOverride (very low-severity), NestedCalldataArrayAbiReencodingSizeValidation (very low-severity) Solidity Compiler Bugs.
Connect a Wallet
Connecting wallet for read function is optional, useful if you want to call certain functions or simply use your wallet's node.Connect a Wallet
Connecting wallet for read function is optional, useful if you want to call certain functions or simply use your wallet's node.Connect a Wallet
Connecting wallet for read function is optional, useful if you want to call certain functions or simply use your wallet's node.Address Cards
To use this feature, please login to your Etherscan account and return to this page.Before You Copy
This website uses cookies to improve your experience. By continuing to use this website, you agree to its Terms and Privacy Policy.