More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 114 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Swap By Dln | 20646794 | 2 hrs ago | IN | 0.201 ETH | 0.00048397 | ||||
Swap By Dln | 20646360 | 3 hrs ago | IN | 0.151 ETH | 0.0005128 | ||||
Swap By Dln | 20646199 | 4 hrs ago | IN | 0.401 ETH | 0.00054592 | ||||
Swap By Dln | 20636158 | 37 hrs ago | IN | 0.061 ETH | 0.00142359 | ||||
Transfer By Dln | 20633837 | 45 hrs ago | IN | 0.001 ETH | 0.00031598 | ||||
Swap By Dln | 20632750 | 2 days ago | IN | 0.018 ETH | 0.00036104 | ||||
Swap By Dln | 20631709 | 2 days ago | IN | 0.001 ETH | 0.0007733 | ||||
Swap By Dln | 20630653 | 2 days ago | IN | 0.001 ETH | 0.00082366 | ||||
Transfer By Dln | 20623795 | 3 days ago | IN | 0.001 ETH | 0.00044129 | ||||
Transfer By Dln | 20598219 | 6 days ago | IN | 0.001 ETH | 0.00026937 | ||||
Transfer By Dln | 20598203 | 6 days ago | IN | 0.001 ETH | 0.0002544 | ||||
Transfer By Dln | 20598166 | 6 days ago | IN | 0.001 ETH | 0.00029198 | ||||
Swap By Dln | 20597637 | 6 days ago | IN | 1.191 ETH | 0.00078459 | ||||
Swap By Dln | 20591747 | 7 days ago | IN | 0.211 ETH | 0.00125416 | ||||
Swap By Dln | 20591715 | 7 days ago | IN | 0.211 ETH | 0.00074295 | ||||
Swap By Dln | 20591409 | 7 days ago | IN | 1.141 ETH | 0.0009308 | ||||
Transfer By Dln | 20579244 | 9 days ago | IN | 0.011 ETH | 0.00068329 | ||||
Transfer By Dln | 20579118 | 9 days ago | IN | 0.0024 ETH | 0.0005029 | ||||
Transfer By Dln | 20578964 | 9 days ago | IN | 0.0014 ETH | 0.00052009 | ||||
Transfer By Dln | 20578930 | 9 days ago | IN | 0.0024 ETH | 0.00060232 | ||||
Transfer By Dln | 20578763 | 9 days ago | IN | 0.501 ETH | 0.00071624 | ||||
Swap By Dln | 20577240 | 9 days ago | IN | 0.011 ETH | 0.00051453 | ||||
Swap By Dln | 20572363 | 10 days ago | IN | 0.011 ETH | 0.00047837 | ||||
Swap By Dln | 20566011 | 11 days ago | IN | 0.001 ETH | 0.00104941 | ||||
Swap By Dln | 20562952 | 11 days ago | IN | 0.251 ETH | 0.00162829 |
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
20646794 | 2 hrs ago | 0.001 ETH | ||||
20646794 | 2 hrs ago | 0.1996 ETH | ||||
20646794 | 2 hrs ago | 0.0004 ETH | ||||
20646360 | 3 hrs ago | 0.001 ETH | ||||
20646360 | 3 hrs ago | 0.1497 ETH | ||||
20646360 | 3 hrs ago | 0.0003 ETH | ||||
20646199 | 4 hrs ago | 0.001 ETH | ||||
20646199 | 4 hrs ago | 0.3992 ETH | ||||
20646199 | 4 hrs ago | 0.0008 ETH | ||||
20636158 | 37 hrs ago | 0.001 ETH | ||||
20636158 | 37 hrs ago | 0.05988 ETH | ||||
20636158 | 37 hrs ago | 0.00012 ETH | ||||
20633837 | 45 hrs ago | 0.001 ETH | ||||
20632750 | 2 days ago | 0.001 ETH | ||||
20632750 | 2 days ago | 0.0165563 ETH | ||||
20632750 | 2 days ago | 0.0004437 ETH | ||||
20631709 | 2 days ago | 0.001 ETH | ||||
20630653 | 2 days ago | 0.001 ETH | ||||
20623795 | 3 days ago | 0.001 ETH | ||||
20598219 | 6 days ago | 0.001 ETH | ||||
20598203 | 6 days ago | 0.001 ETH | ||||
20598166 | 6 days ago | 0.001 ETH | ||||
20597637 | 6 days ago | 0.001 ETH | ||||
20597637 | 6 days ago | 1.18762 ETH | ||||
20597637 | 6 days ago | 0.00238 ETH |
Loading...
Loading
Contract Name:
SwitchDln
Compiler Version
v0.8.9+commit.e5eed63a
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity >=0.8.9; import "../dexs/Switch.sol"; import { IDlnSource } from "../interfaces/IDlnSource.sol"; import "../lib/DataTypes.sol"; contract SwitchDln is Switch { using UniversalERC20 for IERC20; using SafeERC20 for IERC20; address public dlnSource; struct SwapArgsDln { DataTypes.SwapInfo srcSwap; DataTypes.SwapInfo dstSwap; address payable recipient; address partner; uint256 partnerFeeRate; uint256 amount; uint256 expectedReturn; uint256 minReturn; uint256 estimatedDstTokenAmount; uint nativeFee; bool useParaswap; bytes affiliateFee; bytes permitEnvelope; bytes srcParaswapData; uint256[] srcDistribution; uint32 referralCode; bytes32 id; bytes32 bridge; IDlnSource.OrderCreation orderCreation; } struct TransferArgsDln { address fromToken; address destToken; address payable recipient; address partner; uint256 partnerFeeRate; uint256 amount; uint256 estimatedDstTokenAmount; uint nativeFee; bytes affiliateFee; bytes permitEnvelope; uint32 referralCode; bytes32 id; bytes32 bridge; IDlnSource.OrderCreation orderCreation; } event DlnSourceSet(address dlnSource); constructor( address _weth, address _otherToken, uint256 _pathCount, uint256 _pathSplit, address[] memory _factories, address[] memory _switchViewAndEventAddresses, address _paraswapProxy, address _augustusSwapper, address _feeCollector, address _dlnSource ) Switch( _weth, _otherToken, _pathCount, _pathSplit, _factories, _switchViewAndEventAddresses[0], _switchViewAndEventAddresses[1], _paraswapProxy, _augustusSwapper, _feeCollector ) public { dlnSource = _dlnSource; } function setDlnSource(address _dlnSource) external onlyOwner { dlnSource = _dlnSource; emit DlnSourceSet(_dlnSource); } function transferByDln( TransferArgsDln calldata transferArgs ) external payable nonReentrant returns (bytes32) { require(transferArgs.amount > 0, "The amount must be greater than zero"); // getting the protocol fee uint protocolFee = IDlnSource(dlnSource).globalFixedNativeFee(); require(transferArgs.nativeFee >= protocolFee, "native fee is not enough"); address fromToken = transferArgs.fromToken; IERC20(fromToken).universalTransferFrom(msg.sender, address(this), transferArgs.amount); uint256 amountAfterFee = _getAmountAfterFee( IERC20(fromToken), transferArgs.amount, transferArgs.partner, transferArgs.partnerFeeRate ); bool isNative = IERC20(fromToken).isETH(); if (!isNative) { IERC20(fromToken).universalApprove(dlnSource, amountAfterFee); } bytes32 orderId= IDlnSource(dlnSource).createOrder{ value: transferArgs.nativeFee }( IDlnSource.OrderCreation({ giveTokenAddress: transferArgs.orderCreation.giveTokenAddress, giveAmount: transferArgs.orderCreation.giveAmount, takeTokenAddress: transferArgs.orderCreation.takeTokenAddress, takeAmount: transferArgs.orderCreation.takeAmount, takeChainId: transferArgs.orderCreation.takeChainId, receiverDst: transferArgs.orderCreation.receiverDst, givePatchAuthoritySrc: transferArgs.orderCreation.givePatchAuthoritySrc, orderAuthorityAddressDst: transferArgs.orderCreation.orderAuthorityAddressDst, allowedTakerDst: transferArgs.orderCreation.allowedTakerDst, externalCall: transferArgs.orderCreation.externalCall, allowedCancelBeneficiarySrc: transferArgs.orderCreation.allowedCancelBeneficiarySrc }), transferArgs.affiliateFee, transferArgs.referralCode, transferArgs.permitEnvelope ); _emitCrossChainTransferRequest( transferArgs, orderId, amountAfterFee, msg.sender, DataTypes.SwapStatus.Succeeded ); return orderId; } function swapByDln( SwapArgsDln calldata swapArgs ) external payable nonReentrant returns (bytes32) { require(swapArgs.expectedReturn >= swapArgs.minReturn, "expectedReturn must be equal or larger than minReturn"); // getting the protocol fee uint protocolFee = IDlnSource(dlnSource).globalFixedNativeFee(); require(swapArgs.nativeFee >= protocolFee, "native fee is not enough"); IERC20(swapArgs.srcSwap.srcToken).universalTransferFrom(msg.sender, address(this), swapArgs.amount); uint256 returnAmount = 0; uint256 amountAfterFee = _getAmountAfterFee( IERC20(swapArgs.srcSwap.srcToken), swapArgs.amount, swapArgs.partner, swapArgs.partnerFeeRate ); // check fromToken is same or not destToken if (swapArgs.srcSwap.srcToken == swapArgs.srcSwap.dstToken) { // if dstToken is native token then returnAmount = giveAmount + protocolFee // otherwise returnAmount = amountAfterFee returnAmount = IERC20(swapArgs.srcSwap.dstToken).universalBalanceOf(address(this)); } else { if (swapArgs.useParaswap) { returnAmount = _swapFromParaswap(swapArgs, swapArgs.srcParaswapData, amountAfterFee); } else { returnAmount = _swapFromAggregator(swapArgs, amountAfterFee); } } require(returnAmount >= swapArgs.minReturn, "return amount was not enough"); // check if the bridge token is native or not // swapArgs.srcSwap.dstToken == swapArgs.orderCreation.giveTokenAddress bool isBridgeTokenNative = IERC20(swapArgs.srcSwap.dstToken).isETH(); bytes32 orderId; if (!isBridgeTokenNative) { IERC20(swapArgs.srcSwap.dstToken).universalApprove(dlnSource, returnAmount); orderId= IDlnSource(dlnSource).createOrder{ value: swapArgs.nativeFee }( IDlnSource.OrderCreation({ giveTokenAddress: swapArgs.orderCreation.giveTokenAddress, giveAmount: returnAmount, takeTokenAddress: swapArgs.orderCreation.takeTokenAddress, takeAmount: swapArgs.orderCreation.takeAmount, takeChainId: swapArgs.orderCreation.takeChainId, receiverDst: swapArgs.orderCreation.receiverDst, givePatchAuthoritySrc: swapArgs.orderCreation.givePatchAuthoritySrc, orderAuthorityAddressDst: swapArgs.orderCreation.orderAuthorityAddressDst, allowedTakerDst: swapArgs.orderCreation.allowedTakerDst, externalCall: swapArgs.orderCreation.externalCall, allowedCancelBeneficiarySrc: swapArgs.orderCreation.allowedCancelBeneficiarySrc }), swapArgs.affiliateFee, swapArgs.referralCode, swapArgs.permitEnvelope ); } else { //Native bridge token // after we swap from srcToken to use balanceOf(address(this)) to check the balance // but when we send tx from swing, the protocol native fee is include in the value // so returnAmount = protocolFee + giveAmount orderId= IDlnSource(dlnSource).createOrder{ value: returnAmount }( IDlnSource.OrderCreation({ giveTokenAddress: swapArgs.orderCreation.giveTokenAddress, giveAmount: returnAmount - swapArgs.nativeFee, takeTokenAddress: swapArgs.orderCreation.takeTokenAddress, takeAmount: swapArgs.orderCreation.takeAmount, takeChainId: swapArgs.orderCreation.takeChainId, receiverDst: swapArgs.orderCreation.receiverDst, givePatchAuthoritySrc: swapArgs.orderCreation.givePatchAuthoritySrc, orderAuthorityAddressDst: swapArgs.orderCreation.orderAuthorityAddressDst, allowedTakerDst: swapArgs.orderCreation.allowedTakerDst, externalCall: swapArgs.orderCreation.externalCall, allowedCancelBeneficiarySrc: swapArgs.orderCreation.allowedCancelBeneficiarySrc }), swapArgs.affiliateFee, swapArgs.referralCode, swapArgs.permitEnvelope ); } _emitCrossChainSwapRequest( swapArgs, orderId, returnAmount, msg.sender ); return orderId; } function _swapFromAggregator( SwapArgsDln calldata swapArgs, uint256 amount ) private returns (uint256 returnAmount) { uint256 parts = 0; uint256 lastNonZeroIndex = 0; for (uint i = 0; i < swapArgs.srcDistribution.length; i++) { if (swapArgs.srcDistribution[i] > 0) { parts += swapArgs.srcDistribution[i]; lastNonZeroIndex = i; } } require(parts > 0, "invalid distribution param"); returnAmount = _swapInternalForSingleSwap( swapArgs.srcDistribution, amount, parts, lastNonZeroIndex, IERC20(swapArgs.srcSwap.srcToken), IERC20(swapArgs.srcSwap.dstToken) ); switchEvent.emitSwapped( msg.sender, address(this), IERC20(swapArgs.srcSwap.srcToken), IERC20(swapArgs.srcSwap.dstToken), amount, returnAmount, 0 ); } function _swapFromParaswap( SwapArgsDln calldata swapArgs, bytes calldata callData, uint256 amount ) private returns (uint256 returnAmount) { returnAmount = _swapInternalWithParaSwap( IERC20(swapArgs.srcSwap.srcToken), IERC20(swapArgs.srcSwap.dstToken), amount, address(this), callData ); } function _emitCrossChainTransferRequest( TransferArgsDln calldata transferArgs, bytes32 orderId, uint256 returnAmount, address sender, DataTypes.SwapStatus status ) internal { switchEvent.emitCrosschainSwapRequest( transferArgs.id, orderId, transferArgs.bridge, sender, transferArgs.fromToken, transferArgs.fromToken, transferArgs.destToken, transferArgs.amount, returnAmount, transferArgs.estimatedDstTokenAmount, status ); } function _emitCrossChainSwapRequest( SwapArgsDln calldata swapArgs, bytes32 orderId, uint256 returnAmount, address sender ) internal { switchEvent.emitCrosschainSwapRequest( swapArgs.id, orderId, swapArgs.bridge, sender, swapArgs.srcSwap.srcToken, swapArgs.srcSwap.dstToken, swapArgs.dstSwap.dstToken, swapArgs.amount, returnAmount, swapArgs.estimatedDstTokenAmount, DataTypes.SwapStatus.Succeeded ); } }
// 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.4) (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. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ 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]. * * CAUTION: See Security Considerations above. */ 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 (last updated v4.9.4) (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; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// 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); } /** * @notice Occurred when msg.sender does not have permission to call the operation */ error Forbidden(); }
// 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, recipient, 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, address recipient, 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)); if (totalAmount > 0) { destToken.universalTransfer(recipient, totalAmount); } switchEvent.emitSwapped(msg.sender, recipient, 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 * swingCut / (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 ); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.9; interface IDlnSource { struct OrderCreation { // the address of the ERC-20 token you are giving; // use the zero address to indicate you are giving a native blockchain token (ether, matic, etc). address giveTokenAddress; // the amount of tokens you are giving uint256 giveAmount; // the address of the ERC-20 token you are willing to take on the destination chain bytes takeTokenAddress; // the amount of tokens you are willing to take on the destination chain uint256 takeAmount; // the ID of the chain where an order should be fulfilled. // Use the list of supported chains mentioned above uint256 takeChainId; // the address on the destination chain where the funds // should be sent to upon order fulfillment bytes receiverDst; // the address on the source (current) chain who is allowed to patch the order // giving more input tokens and thus making the order more attractive to takers, just in case address givePatchAuthoritySrc; // the address on the destination chain who is allowed to patch the order // decreasing the take amount and thus making the order more attractive to takers, just in case bytes orderAuthorityAddressDst; // an optional address restricting anyone in the open market from fulfilling // this order but the given address. This can be useful if you are creating a order // for a specific taker. By default, set to empty bytes array (0x) bytes allowedTakerDst; // *optional // set to an empty bytes array (0x) bytes externalCall; // N/A, *optional // an optional address on the source (current) chain where the given input tokens // would be transferred to in case order cancellation is initiated by the orderAuthorityAddressDst // on the destination chain. This property can be safely set to an empty bytes array (0x): // in this case, tokens would be transferred to the arbitrary address specified // by the orderAuthorityAddressDst upon order cancellation bytes allowedCancelBeneficiarySrc; // *optional } function createOrder( OrderCreation calldata _orderCreation, bytes calldata _affiliateFee, uint32 _referralCode, bytes calldata _permitEnvelope ) external payable returns (bytes32 orderId); function globalFixedNativeFee() external view returns (uint); }
// 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; bytes aggregatorInfo; // Dex aggregation swap info } 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; } /// @notice Dex Aggregator Swap Info struct FullSwapData { address swapContract; address spender; bytes swapData; } }
// 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
[{"inputs":[{"internalType":"address","name":"_weth","type":"address"},{"internalType":"address","name":"_otherToken","type":"address"},{"internalType":"uint256","name":"_pathCount","type":"uint256"},{"internalType":"uint256","name":"_pathSplit","type":"uint256"},{"internalType":"address[]","name":"_factories","type":"address[]"},{"internalType":"address[]","name":"_switchViewAndEventAddresses","type":"address[]"},{"internalType":"address","name":"_paraswapProxy","type":"address"},{"internalType":"address","name":"_augustusSwapper","type":"address"},{"internalType":"address","name":"_feeCollector","type":"address"},{"internalType":"address","name":"_dlnSource","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"Forbidden","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"augustusSwapper","type":"address"}],"name":"AugustusSwapperSet","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":"dlnSource","type":"address"}],"name":"DlnSourceSet","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":"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":[],"name":"dlnSource","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"uint256","name":"_defaultSwingCut","type":"uint256"}],"name":"setDefaultSwingCut","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_dlnSource","type":"address"}],"name":"setDlnSource","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":[{"components":[{"components":[{"internalType":"address","name":"srcToken","type":"address"},{"internalType":"address","name":"dstToken","type":"address"},{"internalType":"bytes","name":"aggregatorInfo","type":"bytes"}],"internalType":"struct DataTypes.SwapInfo","name":"srcSwap","type":"tuple"},{"components":[{"internalType":"address","name":"srcToken","type":"address"},{"internalType":"address","name":"dstToken","type":"address"},{"internalType":"bytes","name":"aggregatorInfo","type":"bytes"}],"internalType":"struct DataTypes.SwapInfo","name":"dstSwap","type":"tuple"},{"internalType":"address payable","name":"recipient","type":"address"},{"internalType":"address","name":"partner","type":"address"},{"internalType":"uint256","name":"partnerFeeRate","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"expectedReturn","type":"uint256"},{"internalType":"uint256","name":"minReturn","type":"uint256"},{"internalType":"uint256","name":"estimatedDstTokenAmount","type":"uint256"},{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"bool","name":"useParaswap","type":"bool"},{"internalType":"bytes","name":"affiliateFee","type":"bytes"},{"internalType":"bytes","name":"permitEnvelope","type":"bytes"},{"internalType":"bytes","name":"srcParaswapData","type":"bytes"},{"internalType":"uint256[]","name":"srcDistribution","type":"uint256[]"},{"internalType":"uint32","name":"referralCode","type":"uint32"},{"internalType":"bytes32","name":"id","type":"bytes32"},{"internalType":"bytes32","name":"bridge","type":"bytes32"},{"components":[{"internalType":"address","name":"giveTokenAddress","type":"address"},{"internalType":"uint256","name":"giveAmount","type":"uint256"},{"internalType":"bytes","name":"takeTokenAddress","type":"bytes"},{"internalType":"uint256","name":"takeAmount","type":"uint256"},{"internalType":"uint256","name":"takeChainId","type":"uint256"},{"internalType":"bytes","name":"receiverDst","type":"bytes"},{"internalType":"address","name":"givePatchAuthoritySrc","type":"address"},{"internalType":"bytes","name":"orderAuthorityAddressDst","type":"bytes"},{"internalType":"bytes","name":"allowedTakerDst","type":"bytes"},{"internalType":"bytes","name":"externalCall","type":"bytes"},{"internalType":"bytes","name":"allowedCancelBeneficiarySrc","type":"bytes"}],"internalType":"struct IDlnSource.OrderCreation","name":"orderCreation","type":"tuple"}],"internalType":"struct SwitchDln.SwapArgsDln","name":"swapArgs","type":"tuple"}],"name":"swapByDln","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"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":[{"components":[{"internalType":"address","name":"fromToken","type":"address"},{"internalType":"address","name":"destToken","type":"address"},{"internalType":"address payable","name":"recipient","type":"address"},{"internalType":"address","name":"partner","type":"address"},{"internalType":"uint256","name":"partnerFeeRate","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"estimatedDstTokenAmount","type":"uint256"},{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"bytes","name":"affiliateFee","type":"bytes"},{"internalType":"bytes","name":"permitEnvelope","type":"bytes"},{"internalType":"uint32","name":"referralCode","type":"uint32"},{"internalType":"bytes32","name":"id","type":"bytes32"},{"internalType":"bytes32","name":"bridge","type":"bytes32"},{"components":[{"internalType":"address","name":"giveTokenAddress","type":"address"},{"internalType":"uint256","name":"giveAmount","type":"uint256"},{"internalType":"bytes","name":"takeTokenAddress","type":"bytes"},{"internalType":"uint256","name":"takeAmount","type":"uint256"},{"internalType":"uint256","name":"takeChainId","type":"uint256"},{"internalType":"bytes","name":"receiverDst","type":"bytes"},{"internalType":"address","name":"givePatchAuthoritySrc","type":"address"},{"internalType":"bytes","name":"orderAuthorityAddressDst","type":"bytes"},{"internalType":"bytes","name":"allowedTakerDst","type":"bytes"},{"internalType":"bytes","name":"externalCall","type":"bytes"},{"internalType":"bytes","name":"allowedCancelBeneficiarySrc","type":"bytes"}],"internalType":"struct IDlnSource.OrderCreation","name":"orderCreation","type":"tuple"}],"internalType":"struct SwitchDln.TransferArgsDln","name":"transferArgs","type":"tuple"}],"name":"transferByDln","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"payable","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
6080604052600180546001600160a01b031990811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee179091556002805490911690556103e86010556105dc6011553480156200004f57600080fd5b5060405162004c5b38038062004c5b833981016040819052620000729162000356565b8989898989896000815181106200008d576200008d62000447565b60200260200101518a600181518110620000ab57620000ab62000447565b60200260200101518a8a8a8989898989620000d5620000cf6200022260201b60201c565b62000226565b600680546001600160a01b038088166001600160a01b031992831617909255600780549287169290911691909117905560048390556005829055805160035560005b81518110156200018857600882828151811062000138576200013862000447565b60209081029190910181015182546001810184556000938452919092200180546001600160a01b0319166001600160a01b03909216919091179055806200017f816200045d565b91505062000117565b505060016009555050600a80546001600160a01b03199081166001600160a01b03998a1617909155600b80548216978916979097179096555050600d8054851693861693909317909255600e80548416918516919091179055600f80548316918416919091179055600c80543390831617905560128054909116979091169690961790955550620004879c50505050505050505050505050565b3390565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146200028e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620002bb57600080fd5b815160206001600160401b0380831115620002da57620002da62000293565b8260051b604051601f19603f8301168101818110848211171562000302576200030262000293565b6040529384528581018301938381019250878511156200032157600080fd5b83870191505b848210156200034b576200033b8262000276565b8352918301919083019062000327565b979650505050505050565b6000806000806000806000806000806101408b8d0312156200037757600080fd5b620003828b62000276565b99506200039260208c0162000276565b60408c015160608d015160808e0151929b5090995097506001600160401b0380821115620003bf57600080fd5b620003cd8e838f01620002a9565b975060a08d0151915080821115620003e457600080fd5b50620003f38d828e01620002a9565b9550506200040460c08c0162000276565b93506200041460e08c0162000276565b9250620004256101008c0162000276565b9150620004366101208c0162000276565b90509295989b9194979a5092959850565b634e487b7160e01b600052603260045260246000fd5b60006000198214156200048057634e487b7160e01b600052601160045260246000fd5b5060010190565b6147c480620004976000396000f3fe6080604052600436106102515760003560e01c80638c821e9011610139578063b9d52d3c116100b6578063e5932c401161007a578063e5932c40146106bb578063e8984c5f146106db578063ea15afc3146106fb578063ecefc7051461071b578063f2fde38b14610731578063f640d5081461075157610251565b8063b9d52d3c1461061d578063c415b95c1461063d578063c93d732d1461065d578063d6821ed814610670578063e37c4250146106a557610251565b8063a734f06e116100fd578063a734f06e14610587578063a85f3298146105a7578063ab304695146105c7578063ae551c66146105dd578063b4c76fe0146105fd57610251565b80638c821e90146104fd5780638da5cb5b146105135780638f4bef1c1461053157806390f3f20814610551578063a42dce801461056757610251565b806352b721f8116101d25780635c3d258f116101965780635c3d258f14610454578063601e0bbe146104745780636076a0b414610487578063672383c4146104b5578063715018a6146104d55780638928a29f146104ea57610251565b806352b721f8146103be578063538ba4f9146103d457806353fd7bf1146103f45780635b18075e146104145780635b769f3c1461043457610251565b80633fc8cef3116102195780633fc8cef31461032b578063433b3c051461034b5780634399fa561461036b57806347fff2391461038b57806348c4d7811461039e57610251565b8063228cb7331461026057806323a9495e1461029d5780632d565c84146102bd57806331428a87146102dd5780633aecd0e3146102fd575b3332141561025e57600080fd5b005b34801561026c57600080fd5b50600c54610280906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156102a957600080fd5b5061025e6102b8366004613c94565b610771565b3480156102c957600080fd5b5061025e6102d8366004613cc2565b6107b5565b3480156102e957600080fd5b50600a54610280906001600160a01b031681565b34801561030957600080fd5b5061031d610318366004613cc2565b61080b565b604051908152602001610294565b34801561033757600080fd5b50600654610280906001600160a01b031681565b34801561035757600080fd5b50600754610280906001600160a01b031681565b34801561037757600080fd5b50600b54610280906001600160a01b031681565b61031d610399366004613cdf565b61082e565b3480156103aa57600080fd5b5061025e6103b9366004613c94565b611213565b3480156103ca57600080fd5b5061031d60115481565b3480156103e057600080fd5b50600254610280906001600160a01b031681565b34801561040057600080fd5b5061025e61040f366004613cc2565b61128e565b34801561042057600080fd5b50600d54610280906001600160a01b031681565b34801561044057600080fd5b5061025e61044f366004613cc2565b6112e4565b34801561046057600080fd5b5061025e61046f366004613c94565b61133a565b61031d610482366004613d1b565b611377565b34801561049357600080fd5b506104a76104a2366004613d57565b6118a4565b604051610294929190613d9d565b3480156104c157600080fd5b506102806104d0366004613c94565b61194d565b3480156104e157600080fd5b5061025e611977565b61025e6104f8366004613e32565b61198b565b34801561050957600080fd5b5061031d60045481565b34801561051f57600080fd5b506000546001600160a01b0316610280565b34801561053d57600080fd5b50601254610280906001600160a01b031681565b34801561055d57600080fd5b5061031d60055481565b34801561057357600080fd5b5061025e610582366004613cc2565b611a0d565b34801561059357600080fd5b50600154610280906001600160a01b031681565b3480156105b357600080fd5b5061025e6105c2366004613c94565b611a63565b3480156105d357600080fd5b5061031d60035481565b3480156105e957600080fd5b50600e54610280906001600160a01b031681565b34801561060957600080fd5b5061025e610618366004613cc2565b611aa0565b34801561062957600080fd5b5061025e610638366004613cc2565b611af6565b34801561064957600080fd5b50600f54610280906001600160a01b031681565b61031d61066b366004613f2f565b611b4c565b34801561067c57600080fd5b5061069061068b366004613f6b565b611ff3565b60408051928352602083019190915201610294565b3480156106b157600080fd5b5061031d60105481565b3480156106c757600080fd5b5061025e6106d6366004613cc2565b612023565b3480156106e757600080fd5b5061025e6106f6366004613cc2565b612079565b34801561070757600080fd5b5061025e610716366004613fc7565b6120cf565b34801561072757600080fd5b5061031d61271081565b34801561073d57600080fd5b5061025e61074c366004613cc2565b612179565b34801561075d57600080fd5b5061025e61076c36600461405b565b6121f2565b610779612214565b60058190556040518181527f11e8ee12d79dc7314b845f4e82465af5bd3d2214081526061af36de8364eaa2e906020015b60405180910390a150565b6107bd612214565b601280546001600160a01b0319166001600160a01b0383169081179091556040519081527fec16663b26b78d47d2f1240f969ab622178c2d1412a2ea1c6ebdb1f553d4f7fb906020016107aa565b6000610815612214565b6108286001600160a01b0383163061226e565b92915050565b600061083861230f565b8160e001358260c0013510156108695760405162461bcd60e51b81526004016108609061409d565b60405180910390fd5b60125460408051631a843f8560e11b815290516000926001600160a01b0316916335087f0a916004808301926020929190829003018186803b1580156108ae57600080fd5b505afa1580156108c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108e691906140f2565b90508083610120013510156109385760405162461bcd60e51b81526020600482015260186024820152770dcc2e8d2ecca40cccaca40d2e640dcdee840cadcdeeaced60431b6044820152606401610860565b61096b333060a086013561094c878061410b565b61095a906020810190613cc2565b6001600160a01b0316929190612369565b6000806109a861097b868061410b565b610989906020810190613cc2565b60a087013561099e6080890160608a01613cc2565b886080013561245b565b90506109b4858061410b565b6109c5906040810190602001613cc2565b6001600160a01b03166109d8868061410b565b6109e6906020810190613cc2565b6001600160a01b03161415610a2a57610a2330610a03878061410b565b610a14906040810190602001613cc2565b6001600160a01b03169061226e565b9150610a66565b610a3c61016086016101408701614139565b15610a5957610a2385610a536101a0820182614156565b846127a7565b610a638582612826565b91505b8460e00135821015610aba5760405162461bcd60e51b815260206004820152601c60248201527f72657475726e20616d6f756e7420776173206e6f7420656e6f756768000000006044820152606401610860565b6000610ae8610ac9878061410b565b610ada906040810190602001613cc2565b6001600160a01b0316612a2d565b9050600081610e8d57601254610b2d906001600160a01b031685610b0c8a8061410b565b610b1d906040810190602001613cc2565b6001600160a01b03169190612a66565b6012546040805161016081019091526001600160a01b039091169063fbe16ca7906101208a01359080610b646102408d018d6141a4565b610b72906020810190613cc2565b6001600160a01b0316815260208101899052604001610b956102408d018d6141a4565b610ba3906040810190614156565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250602001610beb6102408d018d6141a4565b606001358152602001610c026102408d018d6141a4565b608001358152602001610c196102408d018d6141a4565b610c279060a0810190614156565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250602001610c6f6102408d018d6141a4565b610c809060e081019060c001613cc2565b6001600160a01b03168152602001610c9c6102408d018d6141a4565b610caa9060e0810190614156565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250602001610cf26102408d018d6141a4565b610d0190610100810190614156565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250602001610d496102408d018d6141a4565b610d5890610120810190614156565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250602001610da06102408d018d6141a4565b610daf90610140810190614156565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050915250610df36101608c018c614156565b610e056102008e016101e08f016141cd565b610e136101808f018f614156565b6040518863ffffffff1660e01b8152600401610e349695949392919061426b565b6020604051808303818588803b158015610e4d57600080fd5b505af1158015610e61573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610e8691906140f2565b90506111f1565b6012546040805161016081019091526001600160a01b039091169063fbe16ca790869080610ebf6102408d018d6141a4565b610ecd906020810190613cc2565b6001600160a01b03168152602001610eea6101208d01358a6143d6565b8152602001610efd6102408d018d6141a4565b610f0b906040810190614156565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250602001610f536102408d018d6141a4565b606001358152602001610f6a6102408d018d6141a4565b608001358152602001610f816102408d018d6141a4565b610f8f9060a0810190614156565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250602001610fd76102408d018d6141a4565b610fe89060e081019060c001613cc2565b6001600160a01b031681526020016110046102408d018d6141a4565b6110129060e0810190614156565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060200161105a6102408d018d6141a4565b61106990610100810190614156565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050908252506020016110b16102408d018d6141a4565b6110c090610120810190614156565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050908252506020016111086102408d018d6141a4565b61111790610140810190614156565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505091525061115b6101608c018c614156565b61116d6102008e016101e08f016141cd565b61117b6101808f018f614156565b6040518863ffffffff1660e01b815260040161119c9695949392919061426b565b6020604051808303818588803b1580156111b557600080fd5b505af11580156111c9573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111ee91906140f2565b90505b6111fd87828633612b46565b9450505050505b61120e6001600955565b919050565b61121b612214565b6113888111156112595760405162461bcd60e51b8152602060048201526009602482015268746f6f206c6172676560b81b6044820152606401610860565b60108190556040518181527fa28aac6f4ba79029a647ee085b0ae88419c6aa87bae5dcf77d303dba45b3681b906020016107aa565b611296612214565b600b80546001600160a01b0319166001600160a01b0383169081179091556040519081527f35e63b7fefc2b1fb2ed78adeed6688b187514d96c2d7d56222e52f3e41c2fb2f906020016107aa565b6112ec612214565b600680546001600160a01b0319166001600160a01b0383169081179091556040519081527f41408be49f75701fe4bb8484ce88d68f1d82e03cb4eb44263b6682ce2dbd32f0906020016107aa565b611342612214565b60118190556040518181527f8f817f25bf47abe304b519d80d1a633064758c57d280731736fe82ad20816c55906020016107aa565b600061138161230f565b60008260a00135116113e15760405162461bcd60e51b8152602060048201526024808201527f54686520616d6f756e74206d7573742062652067726561746572207468616e206044820152637a65726f60e01b6064820152608401610860565b60125460408051631a843f8560e11b815290516000926001600160a01b0316916335087f0a916004808301926020929190829003018186803b15801561142657600080fd5b505afa15801561143a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145e91906140f2565b9050808360e0013510156114af5760405162461bcd60e51b81526020600482015260186024820152770dcc2e8d2ecca40cccaca40d2e640dcdee840cadcdeeaced60431b6044820152606401610860565b60006114be6020850185613cc2565b90506114d96001600160a01b038216333060a0880135612369565b60006114f48260a087013561099e6080890160608a01613cc2565b9050600061150a836001600160a01b0316612a2d565b90508061152b5760125461152b906001600160a01b03858116911684612a66565b6012546040805161016081019091526000916001600160a01b03169063fbe16ca79060e08a013590806115626101a08d018d6141a4565b611570906020810190613cc2565b6001600160a01b0316815260200161158c6101a08d018d6141a4565b6020908101358252016115a36101a08d018d6141a4565b6115b1906040810190614156565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050908252506020016115f96101a08d018d6141a4565b6060013581526020016116106101a08d018d6141a4565b6080013581526020016116276101a08d018d6141a4565b6116359060a0810190614156565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060200161167d6101a08d018d6141a4565b61168e9060e081019060c001613cc2565b6001600160a01b031681526020016116aa6101a08d018d6141a4565b6116b89060e0810190614156565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050908252506020016117006101a08d018d6141a4565b61170f90610100810190614156565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050908252506020016117576101a08d018d6141a4565b61176690610120810190614156565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050908252506020016117ae6101a08d018d6141a4565b6117bd90610140810190614156565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509152506118016101008c018c614156565b6118136101608e016101408f016141cd565b6118216101208f018f614156565b6040518863ffffffff1660e01b81526004016118429695949392919061426b565b6020604051808303818588803b15801561185b57600080fd5b505af115801561186f573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061189491906140f2565b90506111fd878285336001612c18565b600a5460405163181da82d60e21b81526001600160a01b03868116600483015285811660248301526044820185905260648201849052600092606092911690636076a0b49060840160006040518083038186803b15801561190457600080fd5b505afa158015611918573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261194091908101906143ed565b9097909650945050505050565b6008818154811061195d57600080fd5b6000918252602090912001546001600160a01b0316905081565b61197f612214565b6119896000612ccc565b565b61199361230f565b866001600160a01b0316886001600160a01b031614156119c55760405162461bcd60e51b81526004016108609061448a565b6119da6001600160a01b038916333089612369565b60006119e88988878761245b565b90506119f78989838686612d1c565b5050611a036001600955565b5050505050505050565b611a15612214565b600f80546001600160a01b0319166001600160a01b0383169081179091556040519081527f12e1d17016b94668449f97876f4a8d5cc2c19f314db337418894734037cc19d4906020016107aa565b611a6b612214565b60048190556040518181527f70f24e12a9db25e0d80cbcde19ffef47d6a7c52c1089db4c71e53ce1856577fc906020016107aa565b611aa8612214565b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527f17780f3919f73af11f29e4157534858a06c91294d64b679fe4e49340122cd322906020016107aa565b611afe612214565b600e80546001600160a01b0319166001600160a01b0383169081179091556040519081527fe0209b1ff5892dc27d9ffb30000e308317645f928d78a0a018dd2e9289ecc292906020016107aa565b6000611b5661230f565b816080013582606001351015611b7e5760405162461bcd60e51b81526004016108609061409d565b611b8e6040830160208401613cc2565b6001600160a01b0316611ba46020840184613cc2565b6001600160a01b03161415611bcb5760405162461bcd60e51b81526004016108609061448a565b60008060005b611bdf6101008601866144d2565b9050811015611c5d576000611bf86101008701876144d2565b83818110611c0857611c0861451c565b905060200201351115611c4b57611c236101008601866144d2565b82818110611c3357611c3361451c565b9050602002013583611c459190614532565b92508091505b80611c558161454a565b915050611bd1565b5081611cbc57611c73610ada6020860186613cc2565b15611caf5760405133903480156108fc02916000818181858888f19350505050158015611ca4573d6000803e3d6000fd5b503492505050611204565b5050506040810135611204565b611cd33330604087013561095a6020890189613cc2565b6000611d04611ce56020870187613cc2565b6040870135611cfa60c0890160a08a01613cc2565b8860c0013561245b565b9050611d70611d176101008701876144d2565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250859250879150869050611d5b60208b018b613cc2565b611d6b60408c0160208d01613cc2565b612e04565b93508315611f8a578460800135841015611dd85760405162461bcd60e51b8152602060048201526024808201527f5377697463683a2052657475726e20616d6f756e7420776173206e6f7420656e6044820152630deeaced60e31b6064820152608401610860565b8460600135841115611efa57611e1d611df8610100870160e08801613cc2565b6060870135611e0d6040890160208a01613cc2565b6001600160a01b03169190613034565b50600c54611e4c906001600160a01b0316611e3c6060880135876143d6565b611e0d6040890160208a01613cc2565b50600b546001600160a01b031663391fdc2433611e70610100890160e08a01613cc2565b611e7d60208a018a613cc2565b611e8d60408b0160208c01613cc2565b60408b013560608c0135611ea1818d6143d6565b6040518863ffffffff1660e01b8152600401611ec39796959493929190614565565b600060405180830381600087803b158015611edd57600080fd5b505af1158015611ef1573d6000803e3d6000fd5b50505050611fe6565b611f1f611f0e610100870160e08801613cc2565b85611e0d6040890160208a01613cc2565b50600b546001600160a01b031663391fdc2433611f43610100890160e08a01613cc2565b611f5060208a018a613cc2565b611f6060408b0160208c01613cc2565b8a604001358a60006040518863ffffffff1660e01b8152600401611ec39796959493929190614565565b6040850135611fa030610a146020890189613cc2565b1115611fc257611fbc336040870135611e0d6020890189613cc2565b50611fe6565b611fe433611fd730610a1460208a018a613cc2565b611e0d6020890189613cc2565b505b50505061120e6001600955565b60008061271061200386856145a9565b61200d91906145de565b915061201982866143d6565b9050935093915050565b61202b612214565b600c80546001600160a01b0319166001600160a01b0383169081179091556040519081527f53a596d7be747a5a4f4d39a6a36476d2eed407c93f6f2ba8a96c8b971240d5cd906020016107aa565b612081612214565b600d80546001600160a01b0319166001600160a01b0383169081179091556040519081527f4528d04696417deba6006cd6c7e5bbb56b9874ac9d954a956e14b8d74f08d72b906020016107aa565b6120d7612214565b805160035560005b81518110156121495760088282815181106120fc576120fc61451c565b60209081029190910181015182546001810184556000938452919092200180546001600160a01b0319166001600160a01b03909216919091179055806121418161454a565b9150506120df565b507fbbc63a7f378af7e269ef19f3fe0d08f044c91ee72930c0d045a58be58580f3d3816040516107aa91906145f2565b612181612214565b6001600160a01b0381166121e65760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610860565b6121ef81612ccc565b50565b6121fa612214565b61220e6001600160a01b0384168284613034565b50505050565b6000546001600160a01b031633146119895760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610860565b600061227983612a2d565b1561228f57506001600160a01b03811631610828565b6040516370a0823160e01b81526001600160a01b0383811660048301528416906370a082319060240160206040518083038186803b1580156122d057600080fd5b505afa1580156122e4573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061230891906140f2565b9392505050565b600260095414156123625760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610860565b6002600955565b806123735761220e565b61237c84612a2d565b15612446576001600160a01b038316331480156123995750803410155b6123f95760405162461bcd60e51b815260206004820152602b60248201527f57726f6e6720757365616765206f66204554482e756e6976657273616c54726160448201526a6e7366657246726f6d282960a81b6064820152608401610860565b6001600160a01b0382163014612441576040516001600160a01b0383169082156108fc029083906000818181858888f1935050505015801561243f573d6000803e3d6000fd5b505b61220e565b61220e6001600160a01b0385168484846130af565b60006010548211156124af5760405162461bcd60e51b815260206004820152601860248201527f706172746e65724665655261746520746f6f206c6172676500000000000000006044820152606401610860565b5082811561279f57600f54604051637b8c4cdf60e01b81526001600160a01b0385811660048301526000921690637b8c4cdf9060240160206040518083038186803b1580156124fd57600080fd5b505afa158015612511573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061253591906140f2565b156125bc57600f54604051637b8c4cdf60e01b81526001600160a01b03868116600483015290911690637b8c4cdf9060240160206040518083038186803b15801561257f57600080fd5b505afa158015612593573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125b791906140f2565b6125c0565b6011545b905060006125d0612710806145a9565b826125db88876145a9565b6125e591906145a9565b6125ef91906145de565b905060008161271061260189886145a9565b61260b91906145de565b61261591906143d6565b9050612629886001600160a01b0316612a2d565b156126bc57600f546001600160a01b031663eedd56e16126498484614532565b6040516001600160e01b031960e084901b1681526001600160a01b03808d16600483015260248201869052604482018790528a1660648201526084016000604051808303818588803b15801561269e57600080fd5b505af11580156126b2573d6000803e3d6000fd5b5050505050612778565b600f546126d7906001600160a01b038a81169116600061311a565b600f54612702906001600160a01b03166126f18484614532565b6001600160a01b038b16919061311a565b600f5460405163eedd56e160e01b81526001600160a01b038a81166004830152602482018490526044820185905288811660648301529091169063eedd56e190608401600060405180830381600087803b15801561275f57600080fd5b505af1158015612773573d6000803e3d6000fd5b505050505b61271061278588876145a9565b61278f91906145de565b61279990886143d6565b93505050505b949350505050565b600061281d6127b6868061410b565b6127c4906020810190613cc2565b6127ce878061410b565b6127df906040810190602001613cc2565b843088888080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612d1c92505050565b95945050505050565b60008080805b61283a6101c08701876144d2565b90508110156128b85760006128536101c08801886144d2565b838181106128635761286361451c565b9050602002013511156128a65761287e6101c08701876144d2565b8281811061288e5761288e61451c565b90506020020135836128a09190614532565b92508091505b806128b08161454a565b91505061282c565b50600082116129095760405162461bcd60e51b815260206004820152601a60248201527f696e76616c696420646973747269627574696f6e20706172616d0000000000006044820152606401610860565b61298461291a6101c08701876144d2565b8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525088925086915085905061295b8a8061410b565b612969906020810190613cc2565b6129738b8061410b565b611d6b906040810190602001613cc2565b600b549093506001600160a01b031663391fdc2433306129a4898061410b565b6129b2906020810190613cc2565b6129bc8a8061410b565b6129cd906040810190602001613cc2565b898960006040518863ffffffff1660e01b81526004016129f39796959493929190614565565b600060405180830381600087803b158015612a0d57600080fd5b505af1158015612a21573d6000803e3d6000fd5b50505050505092915050565b60006001600160a01b038216158061082857506001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1492915050565b612a6f83612a2d565b612a8d5780612a9257612a8d6001600160a01b03841683600061311a565b505050565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e9060440160206040518083038186803b158015612add57600080fd5b505afa158015612af1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b1591906140f2565b90508015612b3257612b326001600160a01b03851684600061311a565b61220e6001600160a01b038516848461311a565b600b546001600160a01b0316630aea28c76102008601358561022088013585612b6f8a8061410b565b612b7d906020810190613cc2565b612b878b8061410b565b612b98906040810190602001613cc2565b612ba560208d018d61410b565b612bb6906040810190602001613cc2565b8c60a001358b8e610100013560016040518c63ffffffff1660e01b8152600401612bea9b9a9998979695949392919061463f565b600060405180830381600087803b158015612c0457600080fd5b505af1158015611a03573d6000803e3d6000fd5b600b546001600160a01b0316630aea28c76101608701358661018089013586612c4460208c018c613cc2565b612c5160208d018d613cc2565b612c6160408e0160208f01613cc2565b8d60a001358c8f60c001358c6040518c63ffffffff1660e01b8152600401612c939b9a9998979695949392919061463f565b600060405180830381600087803b158015612cad57600080fd5b505af1158015612cc1573d6000803e3d6000fd5b505050505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000846001600160a01b0316866001600160a01b03161415612d505760405162461bcd60e51b81526004016108609061448a565b612d5b86858461323e565b612d6e6001600160a01b0386163061226e565b90508015612d8c57612d8a6001600160a01b0386168483613034565b505b600b54604051630e47f70960e21b81526001600160a01b039091169063391fdc2490612dc990339087908b908b908b908990600090600401614565565b600060405180830381600087803b158015612de357600080fd5b505af1158015612df7573d6000803e3d6000fd5b5050505095945050505050565b6000600454600354612e1691906145a9565b87511115612e965760405162461bcd60e51b815260206004820152604160248201527f5377697463683a20446973747269627574696f6e2061727261792073686f756c60448201527f64206e6f742065786365656420666163746f726965732061727261792073697a6064820152606560f81b608482015260a401610860565b856000805b895181101561302757898181518110612eb657612eb661451c565b602002602001015160001415612ecb57613015565b6000888b8381518110612ee057612ee061451c565b60200260200101518b612ef391906145a9565b612efd91906145de565b905087821415612f0a5750825b612f1481856143d6565b935060045482612f2491906146c8565b612f6f57612f68878783600860045487612f3e91906145de565b81548110612f4e57612f4e61451c565b6000918252602090912001546001600160a01b0316613382565b9250613007565b600454612f7c90836146c8565b60011415612fc457612f68878783600860045487612f9a91906145de565b81548110612faa57612faa61451c565b6000918252602090912001546001600160a01b0316613390565b613004878783600860045487612fda91906145de565b81548110612fea57612fea61451c565b6000918252602090912001546001600160a01b03166133ad565b92505b6130118386614532565b9450505b8061301f8161454a565b915050612e9b565b5050509695505050505050565b60008161304357506001612308565b61304c84612a2d565b15613091576040516001600160a01b0384169083156108fc029084906000818181858888f19350505050158015613087573d6000803e3d6000fd5b5060019050612308565b6130a56001600160a01b03851684846133ca565b5060019392505050565b6040516001600160a01b038085166024830152831660448201526064810182905261220e9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526133fa565b8015806131a35750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561316957600080fd5b505afa15801561317d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131a191906140f2565b155b61320e5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610860565b6040516001600160a01b038316602482015260448101829052612a8d90849063095ea7b360e01b906064016130e3565b6000613252846001600160a01b0316612a2d565b156132ae57824710156132a75760405162461bcd60e51b815260206004820152601b60248201527f4554482062616c616e636520697320696e73756666696369656e7400000000006044820152606401610860565b50816132c8565b600d546132c8906001600160a01b03868116911685612a66565b600e546040516000916001600160a01b03169083906132e89086906146dc565b60006040518083038185875af1925050503d8060008114613325576040519150601f19603f3d011682016040523d82523d6000602084013e61332a565b606091505b505090508061337b5760405162461bcd60e51b815260206004820152601960248201527f506172617377617020657865637574696f6e206661696c6564000000000000006044820152606401610860565b5050505050565b600061281d858585856134cf565b60065460009061281d9086906001600160a01b031686868661393b565b60075460009061281d9086906001600160a01b031686868661393b565b6040516001600160a01b038316602482015260448101829052612a8d90849063a9059cbb60e01b906064016130e3565b600061344f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661395e9092919063ffffffff16565b905080516000148061347057508080602001905181019061347091906146ee565b612a8d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610860565b60006134e3856001600160a01b0316612a2d565b1561355257600660009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0846040518263ffffffff1660e01b81526004016000604051808303818588803b15801561353857600080fd5b505af115801561354c573d6000803e3d6000fd5b50505050505b6000613566866001600160a01b0316612a2d565b613570578561357d565b6006546001600160a01b03165b90506000613593866001600160a01b0316612a2d565b61359d57856135aa565b6006546001600160a01b03165b60405163e6a4390560e01b81526001600160a01b038481166004830152808316602483015291925060009186169063e6a439059060440160206040518083038186803b1580156135f957600080fd5b505afa15801561360d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613631919061470b565b905060008061364b6001600160a01b03841686868b61396d565b9197509250905081156136b057826001600160a01b031663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561369357600080fd5b505af11580156136a7573d6000803e3d6000fd5b50505050613724565b80156137245760405163bc25cf7760e01b81527346fd07da395799f113a7584563b8cb886f33c2bc60048201526001600160a01b0384169063bc25cf7790602401600060405180830381600087803b15801561370b57600080fd5b505af115801561371f573d6000803e3d6000fd5b505050505b6137386001600160a01b038616848a613034565b50836001600160a01b0316856001600160a01b031610156137cd5760405163022c0d9f60e01b8152600060048201819052602482018890523060448301526080606483015260848201526001600160a01b0384169063022c0d9f9060a401600060405180830381600087803b1580156137b057600080fd5b505af11580156137c4573d6000803e3d6000fd5b50505050613843565b60405163022c0d9f60e01b8152600481018790526000602482018190523060448301526080606483015260848201526001600160a01b0384169063022c0d9f9060a401600060405180830381600087803b15801561382a57600080fd5b505af115801561383e573d6000803e3d6000fd5b505050505b613855896001600160a01b0316612a2d565b1561392e576006546040516370a0823160e01b81523060048201526001600160a01b0390911690632e1a7d4d9082906370a082319060240160206040518083038186803b1580156138a557600080fd5b505afa1580156138b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138dd91906140f2565b6040518263ffffffff1660e01b81526004016138fb91815260200190565b600060405180830381600087803b15801561391557600080fd5b505af1158015613929573d6000803e3d6000fd5b505050505b5050505050949350505050565b6000613954858561394e898988886134cf565b856134cf565b9695505050505050565b606061279f8484600085613b08565b60008080806139856001600160a01b0388168961226e565b9050600061399c6001600160a01b0388168a61226e565b90506000808a6001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b1580156139da57600080fd5b505afa1580156139ee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a12919061473f565b5091509150886001600160a01b03168a6001600160a01b03161115613a3357905b816001600160701b0316841080613a525750806001600160701b031683105b955085158015613a7c5750816001600160701b0316841180613a7c5750806001600160701b031683115b94506000613a8c896103e56145a9565b90506000613aa385846001600160701b0316613be3565b613aad90836145a9565b9050600082613ac588876001600160701b0316613be3565b613ad1906103e86145a9565b613adb9190614532565b90508015613af257613aed81836145de565b613af5565b60005b9950505050505050509450945094915050565b606082471015613b695760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610860565b600080866001600160a01b03168587604051613b8591906146dc565b60006040518083038185875af1925050503d8060008114613bc2576040519150601f19603f3d011682016040523d82523d6000602084013e613bc7565b606091505b5091509150613bd887838387613bf9565b979650505050505050565b6000818310613bf25781612308565b5090919050565b60608315613c65578251613c5e576001600160a01b0385163b613c5e5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610860565b508161279f565b61279f8383815115613c7a5781518083602001fd5b8060405162461bcd60e51b8152600401610860919061477b565b600060208284031215613ca657600080fd5b5035919050565b6001600160a01b03811681146121ef57600080fd5b600060208284031215613cd457600080fd5b813561230881613cad565b600060208284031215613cf157600080fd5b813567ffffffffffffffff811115613d0857600080fd5b8201610260818503121561230857600080fd5b600060208284031215613d2d57600080fd5b813567ffffffffffffffff811115613d4457600080fd5b82016101c0818503121561230857600080fd5b60008060008060808587031215613d6d57600080fd5b8435613d7881613cad565b93506020850135613d8881613cad565b93969395505050506040820135916060013590565b6000604082018483526020604081850152818551808452606086019150828701935060005b81811015613dde57845183529383019391830191600101613dc2565b5090979650505050505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613e2a57613e2a613deb565b604052919050565b600080600080600080600080610100898b031215613e4f57600080fd5b8835613e5a81613cad565b9750602089810135613e6b81613cad565b975060408a0135965060608a0135955060808a0135613e8981613cad565b945060a08a0135935060c08a0135613ea081613cad565b925060e08a013567ffffffffffffffff80821115613ebd57600080fd5b818c0191508c601f830112613ed157600080fd5b813581811115613ee357613ee3613deb565b613ef5601f8201601f19168501613e01565b91508082528d84828501011115613f0b57600080fd5b80848401858401376000848284010152508093505050509295985092959890939650565b600060208284031215613f4157600080fd5b813567ffffffffffffffff811115613f5857600080fd5b8201610120818503121561230857600080fd5b600080600060608486031215613f8057600080fd5b833592506020840135613f9281613cad565b929592945050506040919091013590565b600067ffffffffffffffff821115613fbd57613fbd613deb565b5060051b60200190565b60006020808385031215613fda57600080fd5b823567ffffffffffffffff811115613ff157600080fd5b8301601f8101851361400257600080fd5b803561401561401082613fa3565b613e01565b81815260059190911b8201830190838101908783111561403457600080fd5b928401925b82841015613bd857833561404c81613cad565b82529284019290840190614039565b60008060006060848603121561407057600080fd5b833561407b81613cad565b925060208401359150604084013561409281613cad565b809150509250925092565b60208082526035908201527f657870656374656452657475726e206d75737420626520657175616c206f72206040820152743630b933b2b9103a3430b71036b4b72932ba3ab93760591b606082015260800190565b60006020828403121561410457600080fd5b5051919050565b60008235605e1983360301811261412157600080fd5b9190910192915050565b80151581146121ef57600080fd5b60006020828403121561414b57600080fd5b81356123088161412b565b6000808335601e1984360301811261416d57600080fd5b83018035915067ffffffffffffffff82111561418857600080fd5b60200191503681900382131561419d57600080fd5b9250929050565b6000823561015e1983360301811261412157600080fd5b63ffffffff811681146121ef57600080fd5b6000602082840312156141df57600080fd5b8135612308816141bb565b60005b838110156142055781810151838201526020016141ed565b8381111561220e5750506000910152565b6000815180845261422e8160208601602086016141ea565b601f01601f19169290920160200192915050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b608081526142856080820188516001600160a01b03169052565b602087015160a0820152600060408801516101608060c08501526142ad6101e0850183614216565b915060608a015160e085015260808a0151610100818187015260a08c01519150607f196101208188870301818901526142e68685614216565b955060c08e01519350610140614306818a01866001600160a01b03169052565b60e08f015194508289880301868a01526143208786614216565b9650838f0151955082898803016101808a015261433d8787614216565b9650818f0151955082898803016101a08a015261435a8787614216565b9650808f01519550505080878603016101c088015250505061437c8282614216565b915050828103602084015261439281888a614242565b63ffffffff87166040850152905082810360608401526143b3818587614242565b9998505050505050505050565b634e487b7160e01b600052601160045260246000fd5b6000828210156143e8576143e86143c0565b500390565b6000806040838503121561440057600080fd5b8251915060208084015167ffffffffffffffff81111561441f57600080fd5b8401601f8101861361443057600080fd5b805161443e61401082613fa3565b81815260059190911b8201830190838101908883111561445d57600080fd5b928401925b8284101561447b57835182529284019290840190614462565b80955050505050509250929050565b60208082526028908201527f69742773206e6f7420616c6c6f77656420746f2073776170207769746820736160408201526736b2903a37b5b2b760c11b606082015260800190565b6000808335601e198436030181126144e957600080fd5b83018035915067ffffffffffffffff82111561450457600080fd5b6020019150600581901b360382131561419d57600080fd5b634e487b7160e01b600052603260045260246000fd5b60008219821115614545576145456143c0565b500190565b600060001982141561455e5761455e6143c0565b5060010190565b6001600160a01b03978816815295871660208701529386166040860152919094166060840152608083019390935260a082019290925260c081019190915260e00190565b60008160001904831182151516156145c3576145c36143c0565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826145ed576145ed6145c8565b500490565b6020808252825182820181905260009190848201906040850190845b818110156146335783516001600160a01b03168352928401929184019160010161460e565b50909695505050505050565b8b8152602081018b9052604081018a90526001600160a01b038981166060830152888116608083015287811660a0830152861660c082015260e08101859052610100810184905261012081018390526101608101600483106146b157634e487b7160e01b600052602160045260246000fd5b826101408301529c9b505050505050505050505050565b6000826146d7576146d76145c8565b500690565b600082516141218184602087016141ea565b60006020828403121561470057600080fd5b81516123088161412b565b60006020828403121561471d57600080fd5b815161230881613cad565b80516001600160701b038116811461120e57600080fd5b60008060006060848603121561475457600080fd5b61475d84614728565b925061476b60208501614728565b91506040840151614092816141bb565b602081526000612308602083018461421656fea2646970667358221220e4aa0733be66723617a0862b39bc744fc1fc769fb24e9c0a6f733cba9404b3ab64736f6c63430008090033000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000216b4b4ba9f3e719726886d34a177484278bfcae000000000000000000000000def171fe48cf0115b1d80b88dc8eab59176fee5700000000000000000000000028b9089b5f2724c1898e7dbb04a96c8c177fe46d000000000000000000000000ef4fb24ad0916217251f553c0596f8edc630eb6600000000000000000000000000000000000000000000000000000000000000030000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f000000000000000000000000c0aee478e3658e2610c5f7a4a2e1777ce9e4f2ac000000000000000000000000115934131916c8b277dd010ee02de363c09d037c00000000000000000000000000000000000000000000000000000000000000020000000000000000000000006b4aafe0a2c03b223b73a681b544b1617a976ccb000000000000000000000000410f724847c92bc3cdacbcd4922f1d7833ec280a
Deployed Bytecode
0x6080604052600436106102515760003560e01c80638c821e9011610139578063b9d52d3c116100b6578063e5932c401161007a578063e5932c40146106bb578063e8984c5f146106db578063ea15afc3146106fb578063ecefc7051461071b578063f2fde38b14610731578063f640d5081461075157610251565b8063b9d52d3c1461061d578063c415b95c1461063d578063c93d732d1461065d578063d6821ed814610670578063e37c4250146106a557610251565b8063a734f06e116100fd578063a734f06e14610587578063a85f3298146105a7578063ab304695146105c7578063ae551c66146105dd578063b4c76fe0146105fd57610251565b80638c821e90146104fd5780638da5cb5b146105135780638f4bef1c1461053157806390f3f20814610551578063a42dce801461056757610251565b806352b721f8116101d25780635c3d258f116101965780635c3d258f14610454578063601e0bbe146104745780636076a0b414610487578063672383c4146104b5578063715018a6146104d55780638928a29f146104ea57610251565b806352b721f8146103be578063538ba4f9146103d457806353fd7bf1146103f45780635b18075e146104145780635b769f3c1461043457610251565b80633fc8cef3116102195780633fc8cef31461032b578063433b3c051461034b5780634399fa561461036b57806347fff2391461038b57806348c4d7811461039e57610251565b8063228cb7331461026057806323a9495e1461029d5780632d565c84146102bd57806331428a87146102dd5780633aecd0e3146102fd575b3332141561025e57600080fd5b005b34801561026c57600080fd5b50600c54610280906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156102a957600080fd5b5061025e6102b8366004613c94565b610771565b3480156102c957600080fd5b5061025e6102d8366004613cc2565b6107b5565b3480156102e957600080fd5b50600a54610280906001600160a01b031681565b34801561030957600080fd5b5061031d610318366004613cc2565b61080b565b604051908152602001610294565b34801561033757600080fd5b50600654610280906001600160a01b031681565b34801561035757600080fd5b50600754610280906001600160a01b031681565b34801561037757600080fd5b50600b54610280906001600160a01b031681565b61031d610399366004613cdf565b61082e565b3480156103aa57600080fd5b5061025e6103b9366004613c94565b611213565b3480156103ca57600080fd5b5061031d60115481565b3480156103e057600080fd5b50600254610280906001600160a01b031681565b34801561040057600080fd5b5061025e61040f366004613cc2565b61128e565b34801561042057600080fd5b50600d54610280906001600160a01b031681565b34801561044057600080fd5b5061025e61044f366004613cc2565b6112e4565b34801561046057600080fd5b5061025e61046f366004613c94565b61133a565b61031d610482366004613d1b565b611377565b34801561049357600080fd5b506104a76104a2366004613d57565b6118a4565b604051610294929190613d9d565b3480156104c157600080fd5b506102806104d0366004613c94565b61194d565b3480156104e157600080fd5b5061025e611977565b61025e6104f8366004613e32565b61198b565b34801561050957600080fd5b5061031d60045481565b34801561051f57600080fd5b506000546001600160a01b0316610280565b34801561053d57600080fd5b50601254610280906001600160a01b031681565b34801561055d57600080fd5b5061031d60055481565b34801561057357600080fd5b5061025e610582366004613cc2565b611a0d565b34801561059357600080fd5b50600154610280906001600160a01b031681565b3480156105b357600080fd5b5061025e6105c2366004613c94565b611a63565b3480156105d357600080fd5b5061031d60035481565b3480156105e957600080fd5b50600e54610280906001600160a01b031681565b34801561060957600080fd5b5061025e610618366004613cc2565b611aa0565b34801561062957600080fd5b5061025e610638366004613cc2565b611af6565b34801561064957600080fd5b50600f54610280906001600160a01b031681565b61031d61066b366004613f2f565b611b4c565b34801561067c57600080fd5b5061069061068b366004613f6b565b611ff3565b60408051928352602083019190915201610294565b3480156106b157600080fd5b5061031d60105481565b3480156106c757600080fd5b5061025e6106d6366004613cc2565b612023565b3480156106e757600080fd5b5061025e6106f6366004613cc2565b612079565b34801561070757600080fd5b5061025e610716366004613fc7565b6120cf565b34801561072757600080fd5b5061031d61271081565b34801561073d57600080fd5b5061025e61074c366004613cc2565b612179565b34801561075d57600080fd5b5061025e61076c36600461405b565b6121f2565b610779612214565b60058190556040518181527f11e8ee12d79dc7314b845f4e82465af5bd3d2214081526061af36de8364eaa2e906020015b60405180910390a150565b6107bd612214565b601280546001600160a01b0319166001600160a01b0383169081179091556040519081527fec16663b26b78d47d2f1240f969ab622178c2d1412a2ea1c6ebdb1f553d4f7fb906020016107aa565b6000610815612214565b6108286001600160a01b0383163061226e565b92915050565b600061083861230f565b8160e001358260c0013510156108695760405162461bcd60e51b81526004016108609061409d565b60405180910390fd5b60125460408051631a843f8560e11b815290516000926001600160a01b0316916335087f0a916004808301926020929190829003018186803b1580156108ae57600080fd5b505afa1580156108c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108e691906140f2565b90508083610120013510156109385760405162461bcd60e51b81526020600482015260186024820152770dcc2e8d2ecca40cccaca40d2e640dcdee840cadcdeeaced60431b6044820152606401610860565b61096b333060a086013561094c878061410b565b61095a906020810190613cc2565b6001600160a01b0316929190612369565b6000806109a861097b868061410b565b610989906020810190613cc2565b60a087013561099e6080890160608a01613cc2565b886080013561245b565b90506109b4858061410b565b6109c5906040810190602001613cc2565b6001600160a01b03166109d8868061410b565b6109e6906020810190613cc2565b6001600160a01b03161415610a2a57610a2330610a03878061410b565b610a14906040810190602001613cc2565b6001600160a01b03169061226e565b9150610a66565b610a3c61016086016101408701614139565b15610a5957610a2385610a536101a0820182614156565b846127a7565b610a638582612826565b91505b8460e00135821015610aba5760405162461bcd60e51b815260206004820152601c60248201527f72657475726e20616d6f756e7420776173206e6f7420656e6f756768000000006044820152606401610860565b6000610ae8610ac9878061410b565b610ada906040810190602001613cc2565b6001600160a01b0316612a2d565b9050600081610e8d57601254610b2d906001600160a01b031685610b0c8a8061410b565b610b1d906040810190602001613cc2565b6001600160a01b03169190612a66565b6012546040805161016081019091526001600160a01b039091169063fbe16ca7906101208a01359080610b646102408d018d6141a4565b610b72906020810190613cc2565b6001600160a01b0316815260208101899052604001610b956102408d018d6141a4565b610ba3906040810190614156565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250602001610beb6102408d018d6141a4565b606001358152602001610c026102408d018d6141a4565b608001358152602001610c196102408d018d6141a4565b610c279060a0810190614156565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250602001610c6f6102408d018d6141a4565b610c809060e081019060c001613cc2565b6001600160a01b03168152602001610c9c6102408d018d6141a4565b610caa9060e0810190614156565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250602001610cf26102408d018d6141a4565b610d0190610100810190614156565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250602001610d496102408d018d6141a4565b610d5890610120810190614156565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250602001610da06102408d018d6141a4565b610daf90610140810190614156565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050915250610df36101608c018c614156565b610e056102008e016101e08f016141cd565b610e136101808f018f614156565b6040518863ffffffff1660e01b8152600401610e349695949392919061426b565b6020604051808303818588803b158015610e4d57600080fd5b505af1158015610e61573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610e8691906140f2565b90506111f1565b6012546040805161016081019091526001600160a01b039091169063fbe16ca790869080610ebf6102408d018d6141a4565b610ecd906020810190613cc2565b6001600160a01b03168152602001610eea6101208d01358a6143d6565b8152602001610efd6102408d018d6141a4565b610f0b906040810190614156565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250602001610f536102408d018d6141a4565b606001358152602001610f6a6102408d018d6141a4565b608001358152602001610f816102408d018d6141a4565b610f8f9060a0810190614156565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250602001610fd76102408d018d6141a4565b610fe89060e081019060c001613cc2565b6001600160a01b031681526020016110046102408d018d6141a4565b6110129060e0810190614156565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060200161105a6102408d018d6141a4565b61106990610100810190614156565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050908252506020016110b16102408d018d6141a4565b6110c090610120810190614156565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050908252506020016111086102408d018d6141a4565b61111790610140810190614156565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505091525061115b6101608c018c614156565b61116d6102008e016101e08f016141cd565b61117b6101808f018f614156565b6040518863ffffffff1660e01b815260040161119c9695949392919061426b565b6020604051808303818588803b1580156111b557600080fd5b505af11580156111c9573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111ee91906140f2565b90505b6111fd87828633612b46565b9450505050505b61120e6001600955565b919050565b61121b612214565b6113888111156112595760405162461bcd60e51b8152602060048201526009602482015268746f6f206c6172676560b81b6044820152606401610860565b60108190556040518181527fa28aac6f4ba79029a647ee085b0ae88419c6aa87bae5dcf77d303dba45b3681b906020016107aa565b611296612214565b600b80546001600160a01b0319166001600160a01b0383169081179091556040519081527f35e63b7fefc2b1fb2ed78adeed6688b187514d96c2d7d56222e52f3e41c2fb2f906020016107aa565b6112ec612214565b600680546001600160a01b0319166001600160a01b0383169081179091556040519081527f41408be49f75701fe4bb8484ce88d68f1d82e03cb4eb44263b6682ce2dbd32f0906020016107aa565b611342612214565b60118190556040518181527f8f817f25bf47abe304b519d80d1a633064758c57d280731736fe82ad20816c55906020016107aa565b600061138161230f565b60008260a00135116113e15760405162461bcd60e51b8152602060048201526024808201527f54686520616d6f756e74206d7573742062652067726561746572207468616e206044820152637a65726f60e01b6064820152608401610860565b60125460408051631a843f8560e11b815290516000926001600160a01b0316916335087f0a916004808301926020929190829003018186803b15801561142657600080fd5b505afa15801561143a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145e91906140f2565b9050808360e0013510156114af5760405162461bcd60e51b81526020600482015260186024820152770dcc2e8d2ecca40cccaca40d2e640dcdee840cadcdeeaced60431b6044820152606401610860565b60006114be6020850185613cc2565b90506114d96001600160a01b038216333060a0880135612369565b60006114f48260a087013561099e6080890160608a01613cc2565b9050600061150a836001600160a01b0316612a2d565b90508061152b5760125461152b906001600160a01b03858116911684612a66565b6012546040805161016081019091526000916001600160a01b03169063fbe16ca79060e08a013590806115626101a08d018d6141a4565b611570906020810190613cc2565b6001600160a01b0316815260200161158c6101a08d018d6141a4565b6020908101358252016115a36101a08d018d6141a4565b6115b1906040810190614156565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050908252506020016115f96101a08d018d6141a4565b6060013581526020016116106101a08d018d6141a4565b6080013581526020016116276101a08d018d6141a4565b6116359060a0810190614156565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060200161167d6101a08d018d6141a4565b61168e9060e081019060c001613cc2565b6001600160a01b031681526020016116aa6101a08d018d6141a4565b6116b89060e0810190614156565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050908252506020016117006101a08d018d6141a4565b61170f90610100810190614156565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050908252506020016117576101a08d018d6141a4565b61176690610120810190614156565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050908252506020016117ae6101a08d018d6141a4565b6117bd90610140810190614156565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509152506118016101008c018c614156565b6118136101608e016101408f016141cd565b6118216101208f018f614156565b6040518863ffffffff1660e01b81526004016118429695949392919061426b565b6020604051808303818588803b15801561185b57600080fd5b505af115801561186f573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061189491906140f2565b90506111fd878285336001612c18565b600a5460405163181da82d60e21b81526001600160a01b03868116600483015285811660248301526044820185905260648201849052600092606092911690636076a0b49060840160006040518083038186803b15801561190457600080fd5b505afa158015611918573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261194091908101906143ed565b9097909650945050505050565b6008818154811061195d57600080fd5b6000918252602090912001546001600160a01b0316905081565b61197f612214565b6119896000612ccc565b565b61199361230f565b866001600160a01b0316886001600160a01b031614156119c55760405162461bcd60e51b81526004016108609061448a565b6119da6001600160a01b038916333089612369565b60006119e88988878761245b565b90506119f78989838686612d1c565b5050611a036001600955565b5050505050505050565b611a15612214565b600f80546001600160a01b0319166001600160a01b0383169081179091556040519081527f12e1d17016b94668449f97876f4a8d5cc2c19f314db337418894734037cc19d4906020016107aa565b611a6b612214565b60048190556040518181527f70f24e12a9db25e0d80cbcde19ffef47d6a7c52c1089db4c71e53ce1856577fc906020016107aa565b611aa8612214565b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527f17780f3919f73af11f29e4157534858a06c91294d64b679fe4e49340122cd322906020016107aa565b611afe612214565b600e80546001600160a01b0319166001600160a01b0383169081179091556040519081527fe0209b1ff5892dc27d9ffb30000e308317645f928d78a0a018dd2e9289ecc292906020016107aa565b6000611b5661230f565b816080013582606001351015611b7e5760405162461bcd60e51b81526004016108609061409d565b611b8e6040830160208401613cc2565b6001600160a01b0316611ba46020840184613cc2565b6001600160a01b03161415611bcb5760405162461bcd60e51b81526004016108609061448a565b60008060005b611bdf6101008601866144d2565b9050811015611c5d576000611bf86101008701876144d2565b83818110611c0857611c0861451c565b905060200201351115611c4b57611c236101008601866144d2565b82818110611c3357611c3361451c565b9050602002013583611c459190614532565b92508091505b80611c558161454a565b915050611bd1565b5081611cbc57611c73610ada6020860186613cc2565b15611caf5760405133903480156108fc02916000818181858888f19350505050158015611ca4573d6000803e3d6000fd5b503492505050611204565b5050506040810135611204565b611cd33330604087013561095a6020890189613cc2565b6000611d04611ce56020870187613cc2565b6040870135611cfa60c0890160a08a01613cc2565b8860c0013561245b565b9050611d70611d176101008701876144d2565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250859250879150869050611d5b60208b018b613cc2565b611d6b60408c0160208d01613cc2565b612e04565b93508315611f8a578460800135841015611dd85760405162461bcd60e51b8152602060048201526024808201527f5377697463683a2052657475726e20616d6f756e7420776173206e6f7420656e6044820152630deeaced60e31b6064820152608401610860565b8460600135841115611efa57611e1d611df8610100870160e08801613cc2565b6060870135611e0d6040890160208a01613cc2565b6001600160a01b03169190613034565b50600c54611e4c906001600160a01b0316611e3c6060880135876143d6565b611e0d6040890160208a01613cc2565b50600b546001600160a01b031663391fdc2433611e70610100890160e08a01613cc2565b611e7d60208a018a613cc2565b611e8d60408b0160208c01613cc2565b60408b013560608c0135611ea1818d6143d6565b6040518863ffffffff1660e01b8152600401611ec39796959493929190614565565b600060405180830381600087803b158015611edd57600080fd5b505af1158015611ef1573d6000803e3d6000fd5b50505050611fe6565b611f1f611f0e610100870160e08801613cc2565b85611e0d6040890160208a01613cc2565b50600b546001600160a01b031663391fdc2433611f43610100890160e08a01613cc2565b611f5060208a018a613cc2565b611f6060408b0160208c01613cc2565b8a604001358a60006040518863ffffffff1660e01b8152600401611ec39796959493929190614565565b6040850135611fa030610a146020890189613cc2565b1115611fc257611fbc336040870135611e0d6020890189613cc2565b50611fe6565b611fe433611fd730610a1460208a018a613cc2565b611e0d6020890189613cc2565b505b50505061120e6001600955565b60008061271061200386856145a9565b61200d91906145de565b915061201982866143d6565b9050935093915050565b61202b612214565b600c80546001600160a01b0319166001600160a01b0383169081179091556040519081527f53a596d7be747a5a4f4d39a6a36476d2eed407c93f6f2ba8a96c8b971240d5cd906020016107aa565b612081612214565b600d80546001600160a01b0319166001600160a01b0383169081179091556040519081527f4528d04696417deba6006cd6c7e5bbb56b9874ac9d954a956e14b8d74f08d72b906020016107aa565b6120d7612214565b805160035560005b81518110156121495760088282815181106120fc576120fc61451c565b60209081029190910181015182546001810184556000938452919092200180546001600160a01b0319166001600160a01b03909216919091179055806121418161454a565b9150506120df565b507fbbc63a7f378af7e269ef19f3fe0d08f044c91ee72930c0d045a58be58580f3d3816040516107aa91906145f2565b612181612214565b6001600160a01b0381166121e65760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610860565b6121ef81612ccc565b50565b6121fa612214565b61220e6001600160a01b0384168284613034565b50505050565b6000546001600160a01b031633146119895760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610860565b600061227983612a2d565b1561228f57506001600160a01b03811631610828565b6040516370a0823160e01b81526001600160a01b0383811660048301528416906370a082319060240160206040518083038186803b1580156122d057600080fd5b505afa1580156122e4573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061230891906140f2565b9392505050565b600260095414156123625760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610860565b6002600955565b806123735761220e565b61237c84612a2d565b15612446576001600160a01b038316331480156123995750803410155b6123f95760405162461bcd60e51b815260206004820152602b60248201527f57726f6e6720757365616765206f66204554482e756e6976657273616c54726160448201526a6e7366657246726f6d282960a81b6064820152608401610860565b6001600160a01b0382163014612441576040516001600160a01b0383169082156108fc029083906000818181858888f1935050505015801561243f573d6000803e3d6000fd5b505b61220e565b61220e6001600160a01b0385168484846130af565b60006010548211156124af5760405162461bcd60e51b815260206004820152601860248201527f706172746e65724665655261746520746f6f206c6172676500000000000000006044820152606401610860565b5082811561279f57600f54604051637b8c4cdf60e01b81526001600160a01b0385811660048301526000921690637b8c4cdf9060240160206040518083038186803b1580156124fd57600080fd5b505afa158015612511573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061253591906140f2565b156125bc57600f54604051637b8c4cdf60e01b81526001600160a01b03868116600483015290911690637b8c4cdf9060240160206040518083038186803b15801561257f57600080fd5b505afa158015612593573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125b791906140f2565b6125c0565b6011545b905060006125d0612710806145a9565b826125db88876145a9565b6125e591906145a9565b6125ef91906145de565b905060008161271061260189886145a9565b61260b91906145de565b61261591906143d6565b9050612629886001600160a01b0316612a2d565b156126bc57600f546001600160a01b031663eedd56e16126498484614532565b6040516001600160e01b031960e084901b1681526001600160a01b03808d16600483015260248201869052604482018790528a1660648201526084016000604051808303818588803b15801561269e57600080fd5b505af11580156126b2573d6000803e3d6000fd5b5050505050612778565b600f546126d7906001600160a01b038a81169116600061311a565b600f54612702906001600160a01b03166126f18484614532565b6001600160a01b038b16919061311a565b600f5460405163eedd56e160e01b81526001600160a01b038a81166004830152602482018490526044820185905288811660648301529091169063eedd56e190608401600060405180830381600087803b15801561275f57600080fd5b505af1158015612773573d6000803e3d6000fd5b505050505b61271061278588876145a9565b61278f91906145de565b61279990886143d6565b93505050505b949350505050565b600061281d6127b6868061410b565b6127c4906020810190613cc2565b6127ce878061410b565b6127df906040810190602001613cc2565b843088888080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612d1c92505050565b95945050505050565b60008080805b61283a6101c08701876144d2565b90508110156128b85760006128536101c08801886144d2565b838181106128635761286361451c565b9050602002013511156128a65761287e6101c08701876144d2565b8281811061288e5761288e61451c565b90506020020135836128a09190614532565b92508091505b806128b08161454a565b91505061282c565b50600082116129095760405162461bcd60e51b815260206004820152601a60248201527f696e76616c696420646973747269627574696f6e20706172616d0000000000006044820152606401610860565b61298461291a6101c08701876144d2565b8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525088925086915085905061295b8a8061410b565b612969906020810190613cc2565b6129738b8061410b565b611d6b906040810190602001613cc2565b600b549093506001600160a01b031663391fdc2433306129a4898061410b565b6129b2906020810190613cc2565b6129bc8a8061410b565b6129cd906040810190602001613cc2565b898960006040518863ffffffff1660e01b81526004016129f39796959493929190614565565b600060405180830381600087803b158015612a0d57600080fd5b505af1158015612a21573d6000803e3d6000fd5b50505050505092915050565b60006001600160a01b038216158061082857506001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1492915050565b612a6f83612a2d565b612a8d5780612a9257612a8d6001600160a01b03841683600061311a565b505050565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e9060440160206040518083038186803b158015612add57600080fd5b505afa158015612af1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b1591906140f2565b90508015612b3257612b326001600160a01b03851684600061311a565b61220e6001600160a01b038516848461311a565b600b546001600160a01b0316630aea28c76102008601358561022088013585612b6f8a8061410b565b612b7d906020810190613cc2565b612b878b8061410b565b612b98906040810190602001613cc2565b612ba560208d018d61410b565b612bb6906040810190602001613cc2565b8c60a001358b8e610100013560016040518c63ffffffff1660e01b8152600401612bea9b9a9998979695949392919061463f565b600060405180830381600087803b158015612c0457600080fd5b505af1158015611a03573d6000803e3d6000fd5b600b546001600160a01b0316630aea28c76101608701358661018089013586612c4460208c018c613cc2565b612c5160208d018d613cc2565b612c6160408e0160208f01613cc2565b8d60a001358c8f60c001358c6040518c63ffffffff1660e01b8152600401612c939b9a9998979695949392919061463f565b600060405180830381600087803b158015612cad57600080fd5b505af1158015612cc1573d6000803e3d6000fd5b505050505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000846001600160a01b0316866001600160a01b03161415612d505760405162461bcd60e51b81526004016108609061448a565b612d5b86858461323e565b612d6e6001600160a01b0386163061226e565b90508015612d8c57612d8a6001600160a01b0386168483613034565b505b600b54604051630e47f70960e21b81526001600160a01b039091169063391fdc2490612dc990339087908b908b908b908990600090600401614565565b600060405180830381600087803b158015612de357600080fd5b505af1158015612df7573d6000803e3d6000fd5b5050505095945050505050565b6000600454600354612e1691906145a9565b87511115612e965760405162461bcd60e51b815260206004820152604160248201527f5377697463683a20446973747269627574696f6e2061727261792073686f756c60448201527f64206e6f742065786365656420666163746f726965732061727261792073697a6064820152606560f81b608482015260a401610860565b856000805b895181101561302757898181518110612eb657612eb661451c565b602002602001015160001415612ecb57613015565b6000888b8381518110612ee057612ee061451c565b60200260200101518b612ef391906145a9565b612efd91906145de565b905087821415612f0a5750825b612f1481856143d6565b935060045482612f2491906146c8565b612f6f57612f68878783600860045487612f3e91906145de565b81548110612f4e57612f4e61451c565b6000918252602090912001546001600160a01b0316613382565b9250613007565b600454612f7c90836146c8565b60011415612fc457612f68878783600860045487612f9a91906145de565b81548110612faa57612faa61451c565b6000918252602090912001546001600160a01b0316613390565b613004878783600860045487612fda91906145de565b81548110612fea57612fea61451c565b6000918252602090912001546001600160a01b03166133ad565b92505b6130118386614532565b9450505b8061301f8161454a565b915050612e9b565b5050509695505050505050565b60008161304357506001612308565b61304c84612a2d565b15613091576040516001600160a01b0384169083156108fc029084906000818181858888f19350505050158015613087573d6000803e3d6000fd5b5060019050612308565b6130a56001600160a01b03851684846133ca565b5060019392505050565b6040516001600160a01b038085166024830152831660448201526064810182905261220e9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526133fa565b8015806131a35750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561316957600080fd5b505afa15801561317d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131a191906140f2565b155b61320e5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610860565b6040516001600160a01b038316602482015260448101829052612a8d90849063095ea7b360e01b906064016130e3565b6000613252846001600160a01b0316612a2d565b156132ae57824710156132a75760405162461bcd60e51b815260206004820152601b60248201527f4554482062616c616e636520697320696e73756666696369656e7400000000006044820152606401610860565b50816132c8565b600d546132c8906001600160a01b03868116911685612a66565b600e546040516000916001600160a01b03169083906132e89086906146dc565b60006040518083038185875af1925050503d8060008114613325576040519150601f19603f3d011682016040523d82523d6000602084013e61332a565b606091505b505090508061337b5760405162461bcd60e51b815260206004820152601960248201527f506172617377617020657865637574696f6e206661696c6564000000000000006044820152606401610860565b5050505050565b600061281d858585856134cf565b60065460009061281d9086906001600160a01b031686868661393b565b60075460009061281d9086906001600160a01b031686868661393b565b6040516001600160a01b038316602482015260448101829052612a8d90849063a9059cbb60e01b906064016130e3565b600061344f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661395e9092919063ffffffff16565b905080516000148061347057508080602001905181019061347091906146ee565b612a8d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610860565b60006134e3856001600160a01b0316612a2d565b1561355257600660009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0846040518263ffffffff1660e01b81526004016000604051808303818588803b15801561353857600080fd5b505af115801561354c573d6000803e3d6000fd5b50505050505b6000613566866001600160a01b0316612a2d565b613570578561357d565b6006546001600160a01b03165b90506000613593866001600160a01b0316612a2d565b61359d57856135aa565b6006546001600160a01b03165b60405163e6a4390560e01b81526001600160a01b038481166004830152808316602483015291925060009186169063e6a439059060440160206040518083038186803b1580156135f957600080fd5b505afa15801561360d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613631919061470b565b905060008061364b6001600160a01b03841686868b61396d565b9197509250905081156136b057826001600160a01b031663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561369357600080fd5b505af11580156136a7573d6000803e3d6000fd5b50505050613724565b80156137245760405163bc25cf7760e01b81527346fd07da395799f113a7584563b8cb886f33c2bc60048201526001600160a01b0384169063bc25cf7790602401600060405180830381600087803b15801561370b57600080fd5b505af115801561371f573d6000803e3d6000fd5b505050505b6137386001600160a01b038616848a613034565b50836001600160a01b0316856001600160a01b031610156137cd5760405163022c0d9f60e01b8152600060048201819052602482018890523060448301526080606483015260848201526001600160a01b0384169063022c0d9f9060a401600060405180830381600087803b1580156137b057600080fd5b505af11580156137c4573d6000803e3d6000fd5b50505050613843565b60405163022c0d9f60e01b8152600481018790526000602482018190523060448301526080606483015260848201526001600160a01b0384169063022c0d9f9060a401600060405180830381600087803b15801561382a57600080fd5b505af115801561383e573d6000803e3d6000fd5b505050505b613855896001600160a01b0316612a2d565b1561392e576006546040516370a0823160e01b81523060048201526001600160a01b0390911690632e1a7d4d9082906370a082319060240160206040518083038186803b1580156138a557600080fd5b505afa1580156138b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138dd91906140f2565b6040518263ffffffff1660e01b81526004016138fb91815260200190565b600060405180830381600087803b15801561391557600080fd5b505af1158015613929573d6000803e3d6000fd5b505050505b5050505050949350505050565b6000613954858561394e898988886134cf565b856134cf565b9695505050505050565b606061279f8484600085613b08565b60008080806139856001600160a01b0388168961226e565b9050600061399c6001600160a01b0388168a61226e565b90506000808a6001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b1580156139da57600080fd5b505afa1580156139ee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a12919061473f565b5091509150886001600160a01b03168a6001600160a01b03161115613a3357905b816001600160701b0316841080613a525750806001600160701b031683105b955085158015613a7c5750816001600160701b0316841180613a7c5750806001600160701b031683115b94506000613a8c896103e56145a9565b90506000613aa385846001600160701b0316613be3565b613aad90836145a9565b9050600082613ac588876001600160701b0316613be3565b613ad1906103e86145a9565b613adb9190614532565b90508015613af257613aed81836145de565b613af5565b60005b9950505050505050509450945094915050565b606082471015613b695760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610860565b600080866001600160a01b03168587604051613b8591906146dc565b60006040518083038185875af1925050503d8060008114613bc2576040519150601f19603f3d011682016040523d82523d6000602084013e613bc7565b606091505b5091509150613bd887838387613bf9565b979650505050505050565b6000818310613bf25781612308565b5090919050565b60608315613c65578251613c5e576001600160a01b0385163b613c5e5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610860565b508161279f565b61279f8383815115613c7a5781518083602001fd5b8060405162461bcd60e51b8152600401610860919061477b565b600060208284031215613ca657600080fd5b5035919050565b6001600160a01b03811681146121ef57600080fd5b600060208284031215613cd457600080fd5b813561230881613cad565b600060208284031215613cf157600080fd5b813567ffffffffffffffff811115613d0857600080fd5b8201610260818503121561230857600080fd5b600060208284031215613d2d57600080fd5b813567ffffffffffffffff811115613d4457600080fd5b82016101c0818503121561230857600080fd5b60008060008060808587031215613d6d57600080fd5b8435613d7881613cad565b93506020850135613d8881613cad565b93969395505050506040820135916060013590565b6000604082018483526020604081850152818551808452606086019150828701935060005b81811015613dde57845183529383019391830191600101613dc2565b5090979650505050505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613e2a57613e2a613deb565b604052919050565b600080600080600080600080610100898b031215613e4f57600080fd5b8835613e5a81613cad565b9750602089810135613e6b81613cad565b975060408a0135965060608a0135955060808a0135613e8981613cad565b945060a08a0135935060c08a0135613ea081613cad565b925060e08a013567ffffffffffffffff80821115613ebd57600080fd5b818c0191508c601f830112613ed157600080fd5b813581811115613ee357613ee3613deb565b613ef5601f8201601f19168501613e01565b91508082528d84828501011115613f0b57600080fd5b80848401858401376000848284010152508093505050509295985092959890939650565b600060208284031215613f4157600080fd5b813567ffffffffffffffff811115613f5857600080fd5b8201610120818503121561230857600080fd5b600080600060608486031215613f8057600080fd5b833592506020840135613f9281613cad565b929592945050506040919091013590565b600067ffffffffffffffff821115613fbd57613fbd613deb565b5060051b60200190565b60006020808385031215613fda57600080fd5b823567ffffffffffffffff811115613ff157600080fd5b8301601f8101851361400257600080fd5b803561401561401082613fa3565b613e01565b81815260059190911b8201830190838101908783111561403457600080fd5b928401925b82841015613bd857833561404c81613cad565b82529284019290840190614039565b60008060006060848603121561407057600080fd5b833561407b81613cad565b925060208401359150604084013561409281613cad565b809150509250925092565b60208082526035908201527f657870656374656452657475726e206d75737420626520657175616c206f72206040820152743630b933b2b9103a3430b71036b4b72932ba3ab93760591b606082015260800190565b60006020828403121561410457600080fd5b5051919050565b60008235605e1983360301811261412157600080fd5b9190910192915050565b80151581146121ef57600080fd5b60006020828403121561414b57600080fd5b81356123088161412b565b6000808335601e1984360301811261416d57600080fd5b83018035915067ffffffffffffffff82111561418857600080fd5b60200191503681900382131561419d57600080fd5b9250929050565b6000823561015e1983360301811261412157600080fd5b63ffffffff811681146121ef57600080fd5b6000602082840312156141df57600080fd5b8135612308816141bb565b60005b838110156142055781810151838201526020016141ed565b8381111561220e5750506000910152565b6000815180845261422e8160208601602086016141ea565b601f01601f19169290920160200192915050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b608081526142856080820188516001600160a01b03169052565b602087015160a0820152600060408801516101608060c08501526142ad6101e0850183614216565b915060608a015160e085015260808a0151610100818187015260a08c01519150607f196101208188870301818901526142e68685614216565b955060c08e01519350610140614306818a01866001600160a01b03169052565b60e08f015194508289880301868a01526143208786614216565b9650838f0151955082898803016101808a015261433d8787614216565b9650818f0151955082898803016101a08a015261435a8787614216565b9650808f01519550505080878603016101c088015250505061437c8282614216565b915050828103602084015261439281888a614242565b63ffffffff87166040850152905082810360608401526143b3818587614242565b9998505050505050505050565b634e487b7160e01b600052601160045260246000fd5b6000828210156143e8576143e86143c0565b500390565b6000806040838503121561440057600080fd5b8251915060208084015167ffffffffffffffff81111561441f57600080fd5b8401601f8101861361443057600080fd5b805161443e61401082613fa3565b81815260059190911b8201830190838101908883111561445d57600080fd5b928401925b8284101561447b57835182529284019290840190614462565b80955050505050509250929050565b60208082526028908201527f69742773206e6f7420616c6c6f77656420746f2073776170207769746820736160408201526736b2903a37b5b2b760c11b606082015260800190565b6000808335601e198436030181126144e957600080fd5b83018035915067ffffffffffffffff82111561450457600080fd5b6020019150600581901b360382131561419d57600080fd5b634e487b7160e01b600052603260045260246000fd5b60008219821115614545576145456143c0565b500190565b600060001982141561455e5761455e6143c0565b5060010190565b6001600160a01b03978816815295871660208701529386166040860152919094166060840152608083019390935260a082019290925260c081019190915260e00190565b60008160001904831182151516156145c3576145c36143c0565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826145ed576145ed6145c8565b500490565b6020808252825182820181905260009190848201906040850190845b818110156146335783516001600160a01b03168352928401929184019160010161460e565b50909695505050505050565b8b8152602081018b9052604081018a90526001600160a01b038981166060830152888116608083015287811660a0830152861660c082015260e08101859052610100810184905261012081018390526101608101600483106146b157634e487b7160e01b600052602160045260246000fd5b826101408301529c9b505050505050505050505050565b6000826146d7576146d76145c8565b500690565b600082516141218184602087016141ea565b60006020828403121561470057600080fd5b81516123088161412b565b60006020828403121561471d57600080fd5b815161230881613cad565b80516001600160701b038116811461120e57600080fd5b60008060006060848603121561475457600080fd5b61475d84614728565b925061476b60208501614728565b91506040840151614092816141bb565b602081526000612308602083018461421656fea2646970667358221220e4aa0733be66723617a0862b39bc744fc1fc769fb24e9c0a6f733cba9404b3ab64736f6c63430008090033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000216b4b4ba9f3e719726886d34a177484278bfcae000000000000000000000000def171fe48cf0115b1d80b88dc8eab59176fee5700000000000000000000000028b9089b5f2724c1898e7dbb04a96c8c177fe46d000000000000000000000000ef4fb24ad0916217251f553c0596f8edc630eb6600000000000000000000000000000000000000000000000000000000000000030000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f000000000000000000000000c0aee478e3658e2610c5f7a4a2e1777ce9e4f2ac000000000000000000000000115934131916c8b277dd010ee02de363c09d037c00000000000000000000000000000000000000000000000000000000000000020000000000000000000000006b4aafe0a2c03b223b73a681b544b1617a976ccb000000000000000000000000410f724847c92bc3cdacbcd4922f1d7833ec280a
-----Decoded View---------------
Arg [0] : _weth (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
Arg [1] : _otherToken (address): 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
Arg [2] : _pathCount (uint256): 2
Arg [3] : _pathSplit (uint256): 2
Arg [4] : _factories (address[]): 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f,0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac,0x115934131916C8b277DD010Ee02de363c09d037c
Arg [5] : _switchViewAndEventAddresses (address[]): 0x6B4AAFE0A2C03B223b73a681b544b1617A976CcB,0x410f724847C92Bc3CdACBCD4922F1D7833Ec280A
Arg [6] : _paraswapProxy (address): 0x216B4B4Ba9F3e719726886d34a177484278Bfcae
Arg [7] : _augustusSwapper (address): 0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57
Arg [8] : _feeCollector (address): 0x28B9089b5f2724c1898E7dbb04a96C8C177fE46d
Arg [9] : _dlnSource (address): 0xeF4fB24aD0916217251F553c0596F8Edc630EB66
-----Encoded View---------------
17 Constructor Arguments found :
Arg [0] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Arg [1] : 000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000140
Arg [5] : 00000000000000000000000000000000000000000000000000000000000001c0
Arg [6] : 000000000000000000000000216b4b4ba9f3e719726886d34a177484278bfcae
Arg [7] : 000000000000000000000000def171fe48cf0115b1d80b88dc8eab59176fee57
Arg [8] : 00000000000000000000000028b9089b5f2724c1898e7dbb04a96c8c177fe46d
Arg [9] : 000000000000000000000000ef4fb24ad0916217251f553c0596f8edc630eb66
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [11] : 0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f
Arg [12] : 000000000000000000000000c0aee478e3658e2610c5f7a4a2e1777ce9e4f2ac
Arg [13] : 000000000000000000000000115934131916c8b277dd010ee02de363c09d037c
Arg [14] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [15] : 0000000000000000000000006b4aafe0a2c03b223b73a681b544b1617a976ccb
Arg [16] : 000000000000000000000000410f724847c92bc3cdacbcd4922f1d7833ec280a
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.