Source Code
Latest 25 from a total of 39 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Transfer By Hyph... | 129445759 | 400 days ago | IN | 0.0068 ETH | 0.000000230186 | ||||
| Transfer By Hyph... | 128979968 | 411 days ago | IN | 0 ETH | 0.000004294981 | ||||
| Swap By Hyphen | 128038530 | 433 days ago | IN | 0 ETH | 0.000003462653 | ||||
| Swap By Hyphen | 127438821 | 446 days ago | IN | 0 ETH | 0.000004357484 | ||||
| Transfer By Hyph... | 127429241 | 447 days ago | IN | 0 ETH | 0.000001143787 | ||||
| Transfer By Hyph... | 126461823 | 469 days ago | IN | 0 ETH | 0.000002533554 | ||||
| Swap By Hyphen | 126433556 | 470 days ago | IN | 0.005 ETH | 0.000000523397 | ||||
| Swap By Hyphen | 126433385 | 470 days ago | IN | 0.005 ETH | 0.000000926243 | ||||
| Swap By Hyphen | 126402677 | 470 days ago | IN | 0 ETH | 0.000009370144 | ||||
| Transfer By Hyph... | 126076754 | 478 days ago | IN | 0 ETH | 0.000000249082 | ||||
| Transfer By Hyph... | 125832800 | 484 days ago | IN | 0.217 ETH | 0.000000460403 | ||||
| Transfer By Hyph... | 125666885 | 487 days ago | IN | 0.02312 ETH | 0.000005780838 | ||||
| Transfer By Hyph... | 125666863 | 487 days ago | IN | 0.0247 ETH | 0.00000557691 | ||||
| Transfer By Hyph... | 125531489 | 491 days ago | IN | 0 ETH | 0.000000384666 | ||||
| Transfer By Hyph... | 125529635 | 491 days ago | IN | 0 ETH | 0.00000046967 | ||||
| Transfer By Hyph... | 125400288 | 494 days ago | IN | 0 ETH | 0.000000300855 | ||||
| Swap By Hyphen | 125217745 | 498 days ago | IN | 0.15 ETH | 0.000002192067 | ||||
| Transfer By Hyph... | 124765053 | 508 days ago | IN | 0.05117 ETH | 0.000000203709 | ||||
| Transfer By Hyph... | 124708223 | 510 days ago | IN | 0 ETH | 0.000000222409 | ||||
| Transfer By Hyph... | 124543473 | 513 days ago | IN | 0 ETH | 0.000015061766 | ||||
| Transfer By Hyph... | 124541245 | 513 days ago | IN | 0 ETH | 0.000003621141 | ||||
| Transfer By Hyph... | 124426981 | 516 days ago | IN | 0 ETH | 0.000000506796 | ||||
| Transfer By Hyph... | 124365286 | 518 days ago | IN | 0 ETH | 0.000001433454 | ||||
| Swap By Hyphen | 124359298 | 518 days ago | IN | 0.008 ETH | 0.000000333829 | ||||
| Swap By Hyphen | 124346748 | 518 days ago | IN | 0 ETH | 0.000000128704 |
Latest 21 internal transactions
Advanced mode:
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 129445759 | 400 days ago | 0.0065212 ETH | ||||
| 129445759 | 400 days ago | 0.0002788 ETH | ||||
| 126433556 | 470 days ago | 0.004574 ETH | ||||
| 126433556 | 470 days ago | 0.000426 ETH | ||||
| 126433385 | 470 days ago | 0.0045735 ETH | ||||
| 126433385 | 470 days ago | 0.0004265 ETH | ||||
| 125832800 | 484 days ago | 0.2159584 ETH | ||||
| 125832800 | 484 days ago | 0.0010416 ETH | ||||
| 125666885 | 487 days ago | 0.022659912 ETH | ||||
| 125666885 | 487 days ago | 0.000460088 ETH | ||||
| 125666863 | 487 days ago | 0.02423564 ETH | ||||
| 125666863 | 487 days ago | 0.00046436 ETH | ||||
| 125217745 | 498 days ago | 0.14925 ETH | ||||
| 125217745 | 498 days ago | 0.00075 ETH | ||||
| 124765053 | 508 days ago | 0.050617364 ETH | ||||
| 124765053 | 508 days ago | 0.000552636 ETH | ||||
| 124359298 | 518 days ago | 0.0075968 ETH | ||||
| 124359298 | 518 days ago | 0.0004032 ETH | ||||
| 124203346 | 521 days ago | 0.122458419 ETH | ||||
| 124203346 | 521 days ago | 0.000751581 ETH | ||||
| 123059506 | 548 days ago | 0.002945453143675 ETH |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
SwitchHyphen
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 { IHyphenRouter } from "../interfaces/IHyphenRouter.sol";
import "../lib/DataTypes.sol";
import "../dexs/Switch.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
contract SwitchHyphen is Switch {
using UniversalERC20 for IERC20;
using SafeERC20 for IERC20;
address public hyphenRouter;
address public nativeWrap;
struct TransferArgsHyphen {
address fromToken;
address destToken;
address payable recipient;
address partner;
uint256 partnerFeeRate;
uint256 amount;
uint256 estimatedDstTokenAmount;
uint64 dstChainId;
bytes32 id;
bytes32 bridge;
}
struct SwapArgsHyphen {
address fromToken;
address bridgeToken;
address destToken;
address payable recipient;
address partner;
uint256 partnerFeeRate;
uint256 amount;
uint256 estimatedDstTokenAmount;
uint256 dstChainId;
uint256[] srcDistribution;
bytes32 id;
bytes32 bridge;
bytes srcParaswapData;
DataTypes.ParaswapUsageStatus paraswapUsageStatus;
}
event HyphenRouterSet(address hyphenRouter);
event NativeWrapSet(address _nativeWrap);
constructor(
address _weth,
address _otherToken,
uint256[] memory _pathCountAndSplit,
address[] memory _factories,
address _switchViewAddress,
address _switchEventAddress,
address _hyphenRouter,
address _paraswapProxy,
address _augustusSwapper,
address _feeCollector
) Switch(
_weth,
_otherToken,
_pathCountAndSplit[0],
_pathCountAndSplit[1],
_factories,
_switchViewAddress,
_switchEventAddress,
_paraswapProxy,
_augustusSwapper,
_feeCollector
)
public
{
hyphenRouter = _hyphenRouter;
nativeWrap = _weth;
}
function setHyphenRouter(address _hyphenRouter) external onlyOwner {
hyphenRouter = _hyphenRouter;
emit HyphenRouterSet(_hyphenRouter);
}
function setNativeWrap(address _newNativeWrap) external onlyOwner {
nativeWrap = _newNativeWrap;
emit NativeWrapSet(nativeWrap);
}
function transferByHyphen(
TransferArgsHyphen calldata transferArgs
)
external
payable
nonReentrant
{
require(transferArgs.amount > 0, "The amount must be greater than zero");
require(block.chainid != transferArgs.dstChainId, "Cannot bridge to same network");
IERC20(transferArgs.fromToken).universalTransferFrom(msg.sender, address(this), transferArgs.amount);
uint256 amountAfterFee = _getAmountAfterFee(
IERC20(transferArgs.fromToken),
transferArgs.amount,
transferArgs.partner,
transferArgs.partnerFeeRate
);
bool isNative = IERC20(transferArgs.fromToken).isETH();
if (isNative) {
IHyphenRouter(hyphenRouter).depositNative{ value: amountAfterFee }(
transferArgs.recipient,
transferArgs.dstChainId,
"SWING"
);
} else {
// Give Hyphen bridge approval
IERC20(transferArgs.fromToken).safeApprove(hyphenRouter, 0);
IERC20(transferArgs.fromToken).safeApprove(hyphenRouter, amountAfterFee);
IHyphenRouter(hyphenRouter).depositErc20(
transferArgs.dstChainId,
transferArgs.fromToken,
transferArgs.recipient,
amountAfterFee,
"SWING"
);
}
_emitCrossChainTransferRequest(
transferArgs,
bytes32(0),
amountAfterFee,
msg.sender,
DataTypes.SwapStatus.Succeeded
);
}
function swapByHyphen(
SwapArgsHyphen calldata swapArgs
)
external
payable
nonReentrant
{
require(swapArgs.amount > 0, "The amount must be greater than zero");
require(block.chainid != swapArgs.dstChainId, "Cannot bridge to same network");
IERC20(swapArgs.fromToken).universalTransferFrom(msg.sender, address(this), swapArgs.amount);
uint256 returnAmount = 0;
uint256 amountAfterFee = _getAmountAfterFee(
IERC20(swapArgs.fromToken),
swapArgs.amount,
swapArgs.partner,
swapArgs.partnerFeeRate
);
address bridgeToken = swapArgs.bridgeToken;
if (swapArgs.fromToken == swapArgs.bridgeToken) {
returnAmount = amountAfterFee;
} else {
if (swapArgs.paraswapUsageStatus == DataTypes.ParaswapUsageStatus.OnSrcChain) {
returnAmount = _swapFromParaswap(swapArgs, amountAfterFee);
} else {
(returnAmount, ) = _swapBeforeHyphen(swapArgs, amountAfterFee);
}
}
bool isNativeBridgeToken = IERC20(swapArgs.bridgeToken).isETH();
if (isNativeBridgeToken) {
IHyphenRouter(hyphenRouter).depositNative{ value: returnAmount }(
swapArgs.recipient,
swapArgs.dstChainId,
"SWING"
);
} else {
IERC20(bridgeToken).universalApprove(hyphenRouter, returnAmount);
IHyphenRouter(hyphenRouter).depositErc20(
swapArgs.dstChainId,
bridgeToken,
swapArgs.recipient,
returnAmount,
"SWING"
);
}
_emitCrossChainSwapRequest(
swapArgs,
bytes32(0),
returnAmount,
msg.sender,
DataTypes.SwapStatus.Succeeded
);
}
function _swapBeforeHyphen(
SwapArgsHyphen calldata swapArgs,
uint256 amount
)
private
returns
(
uint256 returnAmount,
uint256 parts
)
{
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");
// break function to avoid stack too deep error
returnAmount = _swapInternalForSingleSwap(
swapArgs.srcDistribution,
amount,
parts,
lastNonZeroIndex,
IERC20(swapArgs.fromToken),
IERC20(swapArgs.bridgeToken)
);
require(returnAmount > 0, "Swap failed from dex");
switchEvent.emitSwapped(
msg.sender,
address(this),
IERC20(swapArgs.fromToken),
IERC20(swapArgs.bridgeToken),
amount,
returnAmount,
0
);
}
function _swapFromParaswap(
SwapArgsHyphen calldata swapArgs,
uint256 amount
)
private
returns (uint256 returnAmount)
{
// break function to avoid stack too deep error
returnAmount = _swapInternalWithParaSwap(
IERC20(swapArgs.fromToken),
IERC20(swapArgs.bridgeToken),
amount,
address(this),
swapArgs.srcParaswapData
);
}
function _emitCrossChainTransferRequest(
TransferArgsHyphen calldata transferArgs,
bytes32 transferId,
uint256 returnAmount,
address sender,
DataTypes.SwapStatus status
)
internal
{
switchEvent.emitCrosschainSwapRequest(
transferArgs.id,
transferId,
transferArgs.bridge,
sender,
transferArgs.fromToken,
transferArgs.fromToken,
transferArgs.destToken,
transferArgs.amount,
returnAmount,
transferArgs.estimatedDstTokenAmount,
status
);
}
function _emitCrossChainSwapRequest(
SwapArgsHyphen calldata swapArgs,
bytes32 transferId,
uint256 returnAmount,
address sender,
DataTypes.SwapStatus status
)
internal
{
switchEvent.emitCrosschainSwapRequest(
swapArgs.id,
transferId,
swapArgs.bridge,
sender,
swapArgs.fromToken,
swapArgs.bridgeToken,
swapArgs.destToken,
swapArgs.amount,
returnAmount,
swapArgs.estimatedDstTokenAmount,
status
);
}
}// 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 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;
// https://github.com/bcnmy/hyphen-contract/blob/master/contracts/hyphen/LiquidityPool.sol
interface IHyphenRouter {
function depositErc20(
uint256 toChainId,
address tokenAddress,
address receiver,
uint256 amount,
string calldata tag
) external;
function depositNative(
address receiver,
uint256 toChainId,
string calldata tag
) external payable;
}// 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
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_weth","type":"address"},{"internalType":"address","name":"_otherToken","type":"address"},{"internalType":"uint256[]","name":"_pathCountAndSplit","type":"uint256[]"},{"internalType":"address[]","name":"_factories","type":"address[]"},{"internalType":"address","name":"_switchViewAddress","type":"address"},{"internalType":"address","name":"_switchEventAddress","type":"address"},{"internalType":"address","name":"_hyphenRouter","type":"address"},{"internalType":"address","name":"_paraswapProxy","type":"address"},{"internalType":"address","name":"_augustusSwapper","type":"address"},{"internalType":"address","name":"_feeCollector","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":"_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":"address","name":"hyphenRouter","type":"address"}],"name":"HyphenRouterSet","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":"_nativeWrap","type":"address"}],"name":"NativeWrapSet","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":[{"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":"hyphenRouter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxPartnerFeeRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nativeWrap","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"_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":"address","name":"_hyphenRouter","type":"address"}],"name":"setHyphenRouter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxPartnerFeeRate","type":"uint256"}],"name":"setMaxPartnerFeeRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newNativeWrap","type":"address"}],"name":"setNativeWrap","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":[{"internalType":"address","name":"fromToken","type":"address"},{"internalType":"address","name":"bridgeToken","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":"dstChainId","type":"uint256"},{"internalType":"uint256[]","name":"srcDistribution","type":"uint256[]"},{"internalType":"bytes32","name":"id","type":"bytes32"},{"internalType":"bytes32","name":"bridge","type":"bytes32"},{"internalType":"bytes","name":"srcParaswapData","type":"bytes"},{"internalType":"enum DataTypes.ParaswapUsageStatus","name":"paraswapUsageStatus","type":"uint8"}],"internalType":"struct SwitchHyphen.SwapArgsHyphen","name":"swapArgs","type":"tuple"}],"name":"swapByHyphen","outputs":[],"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":"uint64","name":"dstChainId","type":"uint64"},{"internalType":"bytes32","name":"id","type":"bytes32"},{"internalType":"bytes32","name":"bridge","type":"bytes32"}],"internalType":"struct SwitchHyphen.TransferArgsHyphen","name":"transferArgs","type":"tuple"}],"name":"transferByHyphen","outputs":[],"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
6080604052600180546001600160a01b031990811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee179091556002805490911690556103e86010556105dc6011553480156200004f57600080fd5b50604051620043c7380380620043c78339810160408190526200007291620004a6565b8989896000815181106200008a576200008a620005a8565b60200260200101518a600181518110620000a857620000a8620005a8565b60200260200101518a8a8a8989898989898989620000d5620000cf620002e860201b60201c565b620002ec565b600680546001600160a01b038088166001600160a01b031992831617909255600780549287169290911691909117905560048390556005829055805160035560005b815181101562000188576008828281518110620001385762000138620005a8565b60209081029190910181015182546001810184556000938452919092200180546001600160a01b0319166001600160a01b03909216919091179055806200017f81620005be565b91505062000117565b505050505050600160098190555084600a60006101000a8154816001600160a01b0302191690836001600160a01b0316021790555083600b60006101000a8154816001600160a01b0302191690836001600160a01b0316021790555082600d60006101000a8154816001600160a01b0302191690836001600160a01b0316021790555081600e60006101000a8154816001600160a01b0302191690836001600160a01b0316021790555080600f60006101000a8154816001600160a01b0302191690836001600160a01b0316021790555033600c60006101000a8154816001600160a01b0302191690836001600160a01b031602179055505050505050505050505083601260006101000a8154816001600160a01b0302191690836001600160a01b0316021790555089601360006101000a8154816001600160a01b0302191690836001600160a01b0316021790555050505050505050505050620005e8565b3390565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146200035457600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156200039a576200039a62000359565b604052919050565b60006001600160401b03821115620003be57620003be62000359565b5060051b60200190565b600082601f830112620003da57600080fd5b81516020620003f3620003ed83620003a2565b6200036f565b82815260059290921b840181019181810190868411156200041357600080fd5b8286015b8481101562000430578051835291830191830162000417565b509695505050505050565b600082601f8301126200044d57600080fd5b8151602062000460620003ed83620003a2565b82815260059290921b840181019181810190868411156200048057600080fd5b8286015b84811015620004305762000498816200033c565b835291830191830162000484565b6000806000806000806000806000806101408b8d031215620004c757600080fd5b620004d28b6200033c565b9950620004e260208c016200033c565b60408c01519099506001600160401b03808211156200050057600080fd5b6200050e8e838f01620003c8565b995060608d01519150808211156200052557600080fd5b50620005348d828e016200043b565b9750506200054560808c016200033c565b95506200055560a08c016200033c565b94506200056560c08c016200033c565b93506200057560e08c016200033c565b9250620005866101008c016200033c565b9150620005976101208c016200033c565b90509295989b9194979a5092959850565b634e487b7160e01b600052603260045260246000fd5b6000600019821415620005e157634e487b7160e01b600052601160045260246000fd5b5060010190565b613dcf80620005f86000396000f3fe6080604052600436106102675760003560e01c80638c821e9011610144578063c415b95c116100b6578063e8984c5f1161007a578063e8984c5f1461071e578063e8bed6531461073e578063ea15afc314610751578063ecefc70514610771578063f2fde38b14610787578063f640d508146107a757610267565b8063c415b95c14610680578063c93d732d146106a0578063d6821ed8146106b3578063e37c4250146106e8578063e5932c40146106fe57610267565b8063a85f329811610108578063a85f3298146105ca578063ab304695146105ea578063ae551c6614610600578063b4c76fe014610620578063b9d52d3c14610640578063c10ffa6c1461066057610267565b80638c821e90146105405780638da5cb5b1461055657806390f3f20814610574578063a42dce801461058a578063a734f06e146105aa57610267565b806352b721f8116101dd5780635b769f3c116101a15780635b769f3c1461048a5780635c3d258f146104aa5780636076a0b4146104ca578063672383c4146104f8578063715018a6146105185780638928a29f1461052d57610267565b806352b721f8146103f4578063538ba4f91461040a57806353fd7bf11461042a5780635b18075e1461044a5780635b5a66a71461046a57610267565b80633aecd0e31161022f5780633aecd0e3146103265780633fc8cef314610354578063433b3c05146103745780634399fa5614610394578063457bfa2f146103b457806348c4d781146103d457610267565b806313721b6514610276578063228cb7331461028957806323a9495e146102c6578063310d4542146102e657806331428a8714610306575b3332141561027457600080fd5b005b610274610284366004613396565b6107c7565b34801561029557600080fd5b50600c546102a9906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156102d257600080fd5b506102746102e13660046133af565b610a6c565b3480156102f257600080fd5b506012546102a9906001600160a01b031681565b34801561031257600080fd5b50600a546102a9906001600160a01b031681565b34801561033257600080fd5b506103466103413660046133dd565b610ab0565b6040519081526020016102bd565b34801561036057600080fd5b506006546102a9906001600160a01b031681565b34801561038057600080fd5b506007546102a9906001600160a01b031681565b3480156103a057600080fd5b50600b546102a9906001600160a01b031681565b3480156103c057600080fd5b506013546102a9906001600160a01b031681565b3480156103e057600080fd5b506102746103ef3660046133af565b610ad3565b34801561040057600080fd5b5061034660115481565b34801561041657600080fd5b506002546102a9906001600160a01b031681565b34801561043657600080fd5b506102746104453660046133dd565b610b4e565b34801561045657600080fd5b50600d546102a9906001600160a01b031681565b34801561047657600080fd5b506102746104853660046133dd565b610ba4565b34801561049657600080fd5b506102746104a53660046133dd565b610bfa565b3480156104b657600080fd5b506102746104c53660046133af565b610c50565b3480156104d657600080fd5b506104ea6104e53660046133fa565b610c8d565b6040516102bd929190613440565b34801561050457600080fd5b506102a96105133660046133af565b610d36565b34801561052457600080fd5b50610274610d60565b61027461053b3660046134d4565b610d74565b34801561054c57600080fd5b5061034660045481565b34801561056257600080fd5b506000546001600160a01b03166102a9565b34801561058057600080fd5b5061034660055481565b34801561059657600080fd5b506102746105a53660046133dd565b610df6565b3480156105b657600080fd5b506001546102a9906001600160a01b031681565b3480156105d657600080fd5b506102746105e53660046133af565b610e4c565b3480156105f657600080fd5b5061034660035481565b34801561060c57600080fd5b50600e546102a9906001600160a01b031681565b34801561062c57600080fd5b5061027461063b3660046133dd565b610e89565b34801561064c57600080fd5b5061027461065b3660046133dd565b610edf565b34801561066c57600080fd5b5061027461067b3660046133dd565b610f35565b34801561068c57600080fd5b50600f546102a9906001600160a01b031681565b6103466106ae3660046135d0565b610f8b565b3480156106bf57600080fd5b506106d36106ce36600461360b565b611495565b604080519283526020830191909152016102bd565b3480156106f457600080fd5b5061034660105481565b34801561070a57600080fd5b506102746107193660046133dd565b6114c5565b34801561072a57600080fd5b506102746107393660046133dd565b61151b565b61027461074c366004613643565b611571565b34801561075d57600080fd5b5061027461076c3660046136a1565b611823565b34801561077d57600080fd5b5061034661271081565b34801561079357600080fd5b506102746107a23660046133dd565b6118cd565b3480156107b357600080fd5b506102746107c2366004613734565b611943565b6107cf611965565b60008160a00135116107fc5760405162461bcd60e51b81526004016107f390613776565b60405180910390fd5b61080d610100820160e083016137ba565b6001600160401b03164614156108655760405162461bcd60e51b815260206004820152601d60248201527f43616e6e6f742062726964676520746f2073616d65206e6574776f726b00000060448201526064016107f3565b61088d333060a084013561087c60208601866133dd565b6001600160a01b03169291906119bf565b60006108be61089f60208401846133dd565b60a08401356108b460808601606087016133dd565b8560800135611ab1565b905060006108e06108d260208501856133dd565b6001600160a01b0316611dfd565b9050801561096f576012546001600160a01b031663ea3684218361090a60608701604088016133dd565b61091b610100880160e089016137ba565b6040518463ffffffff1660e01b81526004016109389291906137fb565b6000604051808303818588803b15801561095157600080fd5b505af1158015610965573d6000803e3d6000fd5b5050505050610a4e565b60125461099e906001600160a01b0316600061098e60208701876133dd565b6001600160a01b03169190611e36565b6012546109bc906001600160a01b03168361098e60208701876133dd565b6012546001600160a01b03166355d735956109de610100860160e087016137ba565b6109eb60208701876133dd565b6109fb60608801604089016133dd565b866040518563ffffffff1660e01b8152600401610a1b949392919061382d565b600060405180830381600087803b158015610a3557600080fd5b505af1158015610a49573d6000803e3d6000fd5b505050505b610a5d83600084336001611f92565b5050610a696001600955565b50565b610a74612046565b60058190556040518181527f11e8ee12d79dc7314b845f4e82465af5bd3d2214081526061af36de8364eaa2e906020015b60405180910390a150565b6000610aba612046565b610acd6001600160a01b038316306120a0565b92915050565b610adb612046565b611388811115610b195760405162461bcd60e51b8152602060048201526009602482015268746f6f206c6172676560b81b60448201526064016107f3565b60108190556040518181527fa28aac6f4ba79029a647ee085b0ae88419c6aa87bae5dcf77d303dba45b3681b90602001610aa5565b610b56612046565b600b80546001600160a01b0319166001600160a01b0383169081179091556040519081527f35e63b7fefc2b1fb2ed78adeed6688b187514d96c2d7d56222e52f3e41c2fb2f90602001610aa5565b610bac612046565b601380546001600160a01b0319166001600160a01b0383169081179091556040519081527fb3bfb91ec7a3f9a14278772a47b34685afb9cdd7ef683fab8a790ccdd667264790602001610aa5565b610c02612046565b600680546001600160a01b0319166001600160a01b0383169081179091556040519081527f41408be49f75701fe4bb8484ce88d68f1d82e03cb4eb44263b6682ce2dbd32f090602001610aa5565b610c58612046565b60118190556040518181527f8f817f25bf47abe304b519d80d1a633064758c57d280731736fe82ad20816c5590602001610aa5565b600a5460405163181da82d60e21b81526001600160a01b03868116600483015285811660248301526044820185905260648201849052600092606092911690636076a0b49060840160006040518083038186803b158015610ced57600080fd5b505afa158015610d01573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610d29919081019061386e565b9097909650945050505050565b60088181548110610d4657600080fd5b6000918252602090912001546001600160a01b0316905081565b610d68612046565b610d726000612141565b565b610d7c611965565b866001600160a01b0316886001600160a01b03161415610dae5760405162461bcd60e51b81526004016107f39061390a565b610dc36001600160a01b0389163330896119bf565b6000610dd189888787611ab1565b9050610de08989838686612191565b5050610dec6001600955565b5050505050505050565b610dfe612046565b600f80546001600160a01b0319166001600160a01b0383169081179091556040519081527f12e1d17016b94668449f97876f4a8d5cc2c19f314db337418894734037cc19d490602001610aa5565b610e54612046565b60048190556040518181527f70f24e12a9db25e0d80cbcde19ffef47d6a7c52c1089db4c71e53ce1856577fc90602001610aa5565b610e91612046565b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527f17780f3919f73af11f29e4157534858a06c91294d64b679fe4e49340122cd32290602001610aa5565b610ee7612046565b600e80546001600160a01b0319166001600160a01b0383169081179091556040519081527fe0209b1ff5892dc27d9ffb30000e308317645f928d78a0a018dd2e9289ecc29290602001610aa5565b610f3d612046565b601280546001600160a01b0319166001600160a01b0383169081179091556040519081527fb5833751b090fc12b019e650d7889c9b220d3e51b21b8066b748a536ed15e2a190602001610aa5565b6000610f95611965565b81608001358260600135101561100b5760405162461bcd60e51b815260206004820152603560248201527f657870656374656452657475726e206d75737420626520657175616c206f72206044820152743630b933b2b9103a3430b71036b4b72932ba3ab93760591b60648201526084016107f3565b61101b60408301602084016133dd565b6001600160a01b031661103160208401846133dd565b6001600160a01b031614156110585760405162461bcd60e51b81526004016107f39061390a565b60008060005b61106c610100860186613952565b90508110156110ea576000611085610100870187613952565b83818110611095576110956139a2565b9050602002013511156110d8576110b0610100860186613952565b828181106110c0576110c06139a2565b90506020020135836110d291906139ce565b92508091505b806110e2816139e6565b91505061105e565b5081611149576111006108d260208601866133dd565b1561113c5760405133903480156108fc02916000818181858888f19350505050158015611131573d6000803e3d6000fd5b503492505050611486565b5050506040810135611486565b6111603330604087013561087c60208901896133dd565b600061119161117260208701876133dd565b604087013561118760c0890160a08a016133dd565b8860c00135611ab1565b90506111fd6111a4610100870187613952565b808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508592508791508690506111e860208b018b6133dd565b6111f860408c0160208d016133dd565b612279565b935083156114175784608001358410156112655760405162461bcd60e51b8152602060048201526024808201527f5377697463683a2052657475726e20616d6f756e7420776173206e6f7420656e6044820152630deeaced60e31b60648201526084016107f3565b8460600135841115611387576112aa611285610100870160e088016133dd565b606087013561129a6040890160208a016133dd565b6001600160a01b031691906124a9565b50600c546112d9906001600160a01b03166112c9606088013587613a01565b61129a6040890160208a016133dd565b50600b546001600160a01b031663391fdc24336112fd610100890160e08a016133dd565b61130a60208a018a6133dd565b61131a60408b0160208c016133dd565b60408b013560608c013561132e818d613a01565b6040518863ffffffff1660e01b81526004016113509796959493929190613a18565b600060405180830381600087803b15801561136a57600080fd5b505af115801561137e573d6000803e3d6000fd5b50505050611482565b6113ac61139b610100870160e088016133dd565b8561129a6040890160208a016133dd565b50600b546001600160a01b031663391fdc24336113d0610100890160e08a016133dd565b6113dd60208a018a6133dd565b6113ed60408b0160208c016133dd565b8a604001358a60006040518863ffffffff1660e01b81526004016113509796959493929190613a18565b604085013561143c3061142d60208901896133dd565b6001600160a01b0316906120a0565b111561145e5761145833604087013561129a60208901896133dd565b50611482565b611480336114733061142d60208a018a6133dd565b61129a60208901896133dd565b505b5050505b6114906001600955565b919050565b6000806127106114a58685613a5c565b6114af9190613a91565b91506114bb8286613a01565b9050935093915050565b6114cd612046565b600c80546001600160a01b0319166001600160a01b0383169081179091556040519081527f53a596d7be747a5a4f4d39a6a36476d2eed407c93f6f2ba8a96c8b971240d5cd90602001610aa5565b611523612046565b600d80546001600160a01b0319166001600160a01b0383169081179091556040519081527f4528d04696417deba6006cd6c7e5bbb56b9874ac9d954a956e14b8d74f08d72b90602001610aa5565b611579611965565b60008160c001351161159d5760405162461bcd60e51b81526004016107f390613776565b8061010001354614156115f25760405162461bcd60e51b815260206004820152601d60248201527f43616e6e6f742062726964676520746f2073616d65206e6574776f726b00000060448201526064016107f3565b611609333060c084013561087c60208601866133dd565b60008061163b61161c60208501856133dd565b60c085013561163160a08701608088016133dd565b8660a00135611ab1565b9050600061164f60408501602086016133dd565b905061166160408501602086016133dd565b6001600160a01b031661167760208601866133dd565b6001600160a01b0316141561168e578192506116d8565b60016116a26101c086016101a08701613abb565b60038111156116b3576116b3613aa5565b14156116ca576116c38483612524565b92506116d8565b6116d48483612590565b5092505b60006116ed6108d260408701602088016133dd565b90508015611771576012546001600160a01b031663ea368421856117176080890160608a016133dd565b8861010001356040518463ffffffff1660e01b815260040161173a929190613adc565b6000604051808303818588803b15801561175357600080fd5b505af1158015611767573d6000803e3d6000fd5b5050505050611806565b60125461178b906001600160a01b038481169116866127a1565b6012546001600160a01b03166355d73595610100870135846117b360808a0160608b016133dd565b886040518563ffffffff1660e01b81526004016117d39493929190613b02565b600060405180830381600087803b1580156117ed57600080fd5b505af1158015611801573d6000803e3d6000fd5b505050505b6118158560008633600161287c565b50505050610a696001600955565b61182b612046565b805160035560005b815181101561189d576008828281518110611850576118506139a2565b60209081029190910181015182546001810184556000938452919092200180546001600160a01b0319166001600160a01b0390921691909117905580611895816139e6565b915050611833565b507fbbc63a7f378af7e269ef19f3fe0d08f044c91ee72930c0d045a58be58580f3d381604051610aa59190613b3a565b6118d5612046565b6001600160a01b03811661193a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016107f3565b610a6981612141565b61194b612046565b61195f6001600160a01b03841682846124a9565b50505050565b600260095414156119b85760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016107f3565b6002600955565b806119c95761195f565b6119d284611dfd565b15611a9c576001600160a01b038316331480156119ef5750803410155b611a4f5760405162461bcd60e51b815260206004820152602b60248201527f57726f6e6720757365616765206f66204554482e756e6976657273616c54726160448201526a6e7366657246726f6d282960a81b60648201526084016107f3565b6001600160a01b0382163014611a97576040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015611a95573d6000803e3d6000fd5b505b61195f565b61195f6001600160a01b0385168484846128fa565b6000601054821115611b055760405162461bcd60e51b815260206004820152601860248201527f706172746e65724665655261746520746f6f206c61726765000000000000000060448201526064016107f3565b50828115611df557600f54604051637b8c4cdf60e01b81526001600160a01b0385811660048301526000921690637b8c4cdf9060240160206040518083038186803b158015611b5357600080fd5b505afa158015611b67573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b8b9190613b87565b15611c1257600f54604051637b8c4cdf60e01b81526001600160a01b03868116600483015290911690637b8c4cdf9060240160206040518083038186803b158015611bd557600080fd5b505afa158015611be9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c0d9190613b87565b611c16565b6011545b90506000611c2661271080613a5c565b82611c318887613a5c565b611c3b9190613a5c565b611c459190613a91565b9050600081612710611c578988613a5c565b611c619190613a91565b611c6b9190613a01565b9050611c7f886001600160a01b0316611dfd565b15611d1257600f546001600160a01b031663eedd56e1611c9f84846139ce565b6040516001600160e01b031960e084901b1681526001600160a01b03808d16600483015260248201869052604482018790528a1660648201526084016000604051808303818588803b158015611cf457600080fd5b505af1158015611d08573d6000803e3d6000fd5b5050505050611dce565b600f54611d2d906001600160a01b038a811691166000611e36565b600f54611d58906001600160a01b0316611d4784846139ce565b6001600160a01b038b169190611e36565b600f5460405163eedd56e160e01b81526001600160a01b038a81166004830152602482018490526044820185905288811660648301529091169063eedd56e190608401600060405180830381600087803b158015611db557600080fd5b505af1158015611dc9573d6000803e3d6000fd5b505050505b612710611ddb8887613a5c565b611de59190613a91565b611def9088613a01565b93505050505b949350505050565b60006001600160a01b0382161580610acd57506001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1492915050565b801580611ebf5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b158015611e8557600080fd5b505afa158015611e99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ebd9190613b87565b155b611f2a5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b60648201526084016107f3565b6040516001600160a01b038316602482015260448101829052611f8d90849063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612932565b505050565b600b546001600160a01b0316630aea28c76101008701358661012089013586611fbe60208c018c6133dd565b611fcb60208d018d6133dd565b611fdb60408e0160208f016133dd565b8d60a001358c8f60c001358c6040518c63ffffffff1660e01b815260040161200d9b9a99989796959493929190613ba0565b600060405180830381600087803b15801561202757600080fd5b505af115801561203b573d6000803e3d6000fd5b505050505050505050565b6000546001600160a01b03163314610d725760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107f3565b60006120ab83611dfd565b156120c157506001600160a01b03811631610acd565b6040516370a0823160e01b81526001600160a01b0383811660048301528416906370a082319060240160206040518083038186803b15801561210257600080fd5b505afa158015612116573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061213a9190613b87565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000846001600160a01b0316866001600160a01b031614156121c55760405162461bcd60e51b81526004016107f39061390a565b6121d0868584612a07565b6121e36001600160a01b038616306120a0565b90508015612201576121ff6001600160a01b03861684836124a9565b505b600b54604051630e47f70960e21b81526001600160a01b039091169063391fdc249061223e90339087908b908b908b908990600090600401613a18565b600060405180830381600087803b15801561225857600080fd5b505af115801561226c573d6000803e3d6000fd5b5050505095945050505050565b600060045460035461228b9190613a5c565b8751111561230b5760405162461bcd60e51b815260206004820152604160248201527f5377697463683a20446973747269627574696f6e2061727261792073686f756c60448201527f64206e6f742065786365656420666163746f726965732061727261792073697a6064820152606560f81b608482015260a4016107f3565b856000805b895181101561249c5789818151811061232b5761232b6139a2565b6020026020010151600014156123405761248a565b6000888b8381518110612355576123556139a2565b60200260200101518b6123689190613a5c565b6123729190613a91565b90508782141561237f5750825b6123898185613a01565b9350600454826123999190613c29565b6123e4576123dd8787836008600454876123b39190613a91565b815481106123c3576123c36139a2565b6000918252602090912001546001600160a01b0316612b4b565b925061247c565b6004546123f19083613c29565b60011415612439576123dd87878360086004548761240f9190613a91565b8154811061241f5761241f6139a2565b6000918252602090912001546001600160a01b0316612b62565b61247987878360086004548761244f9190613a91565b8154811061245f5761245f6139a2565b6000918252602090912001546001600160a01b0316612b7f565b92505b61248683866139ce565b9450505b80612494816139e6565b915050612310565b5050509695505050505050565b6000816124b85750600161213a565b6124c184611dfd565b15612506576040516001600160a01b0384169083156108fc029084906000818181858888f193505050501580156124fc573d6000803e3d6000fd5b506001905061213a565b61251a6001600160a01b0385168484612b9c565b5060019392505050565b600061213a61253660208501856133dd565b61254660408601602087016133dd565b8430612556610180890189613c3d565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061219192505050565b60008080805b6125a4610120870187613952565b90508110156126225760006125bd610120880188613952565b838181106125cd576125cd6139a2565b905060200201351115612610576125e8610120870187613952565b828181106125f8576125f86139a2565b905060200201358361260a91906139ce565b92508091505b8061261a816139e6565b915050612596565b50600082116126735760405162461bcd60e51b815260206004820152601a60248201527f696e76616c696420646973747269627574696f6e20706172616d00000000000060448201526064016107f3565b6126c8612684610120870187613952565b808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508892508691508590506111e860208b018b6133dd565b9250600083116127115760405162461bcd60e51b81526020600482015260146024820152730a6eec2e040ccc2d2d8cac840cce4deda40c8caf60631b60448201526064016107f3565b600b546001600160a01b031663391fdc24333061273160208a018a6133dd565b61274160408b0160208c016133dd565b898960006040518863ffffffff1660e01b81526004016127679796959493929190613a18565b600060405180830381600087803b15801561278157600080fd5b505af1158015612795573d6000803e3d6000fd5b50505050509250929050565b6127aa83611dfd565b611f8d57806127c857611f8d6001600160a01b038416836000611e36565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e9060440160206040518083038186803b15801561281357600080fd5b505afa158015612827573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061284b9190613b87565b90508015612868576128686001600160a01b038516846000611e36565b61195f6001600160a01b0385168484611e36565b600b546001600160a01b0316630aea28c761014087013586610160890135866128a860208c018c6133dd565b6128b860408d0160208e016133dd565b6128c860608e0160408f016133dd565b8d60c001358c8f60e001358c6040518c63ffffffff1660e01b815260040161200d9b9a99989796959493929190613ba0565b6040516001600160a01b038085166024830152831660448201526064810182905261195f9085906323b872dd60e01b90608401611f56565b6000612987826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612bcc9092919063ffffffff16565b90508051600014806129a85750808060200190518101906129a89190613c83565b611f8d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016107f3565b6000612a1b846001600160a01b0316611dfd565b15612a775782471015612a705760405162461bcd60e51b815260206004820152601b60248201527f4554482062616c616e636520697320696e73756666696369656e74000000000060448201526064016107f3565b5081612a91565b600d54612a91906001600160a01b038681169116856127a1565b600e546040516000916001600160a01b0316908390612ab1908690613cd1565b60006040518083038185875af1925050503d8060008114612aee576040519150601f19603f3d011682016040523d82523d6000602084013e612af3565b606091505b5050905080612b445760405162461bcd60e51b815260206004820152601960248201527f506172617377617020657865637574696f6e206661696c65640000000000000060448201526064016107f3565b5050505050565b6000612b5985858585612bdb565b95945050505050565b600654600090612b599086906001600160a01b0316868686613047565b600754600090612b599086906001600160a01b0316868686613047565b6040516001600160a01b038316602482015260448101829052611f8d90849063a9059cbb60e01b90606401611f56565b6060611df5848460008561306a565b6000612bef856001600160a01b0316611dfd565b15612c5e57600660009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0846040518263ffffffff1660e01b81526004016000604051808303818588803b158015612c4457600080fd5b505af1158015612c58573d6000803e3d6000fd5b50505050505b6000612c72866001600160a01b0316611dfd565b612c7c5785612c89565b6006546001600160a01b03165b90506000612c9f866001600160a01b0316611dfd565b612ca95785612cb6565b6006546001600160a01b03165b60405163e6a4390560e01b81526001600160a01b038481166004830152808316602483015291925060009186169063e6a439059060440160206040518083038186803b158015612d0557600080fd5b505afa158015612d19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d3d9190613ced565b9050600080612d576001600160a01b03841686868b613145565b919750925090508115612dbc57826001600160a01b031663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b158015612d9f57600080fd5b505af1158015612db3573d6000803e3d6000fd5b50505050612e30565b8015612e305760405163bc25cf7760e01b81527346fd07da395799f113a7584563b8cb886f33c2bc60048201526001600160a01b0384169063bc25cf7790602401600060405180830381600087803b158015612e1757600080fd5b505af1158015612e2b573d6000803e3d6000fd5b505050505b612e446001600160a01b038616848a6124a9565b50836001600160a01b0316856001600160a01b03161015612ed95760405163022c0d9f60e01b8152600060048201819052602482018890523060448301526080606483015260848201526001600160a01b0384169063022c0d9f9060a401600060405180830381600087803b158015612ebc57600080fd5b505af1158015612ed0573d6000803e3d6000fd5b50505050612f4f565b60405163022c0d9f60e01b8152600481018790526000602482018190523060448301526080606483015260848201526001600160a01b0384169063022c0d9f9060a401600060405180830381600087803b158015612f3657600080fd5b505af1158015612f4a573d6000803e3d6000fd5b505050505b612f61896001600160a01b0316611dfd565b1561303a576006546040516370a0823160e01b81523060048201526001600160a01b0390911690632e1a7d4d9082906370a082319060240160206040518083038186803b158015612fb157600080fd5b505afa158015612fc5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fe99190613b87565b6040518263ffffffff1660e01b815260040161300791815260200190565b600060405180830381600087803b15801561302157600080fd5b505af1158015613035573d6000803e3d6000fd5b505050505b5050505050949350505050565b6000613060858561305a89898888612bdb565b85612bdb565b9695505050505050565b6060824710156130cb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016107f3565b600080866001600160a01b031685876040516130e79190613cd1565b60006040518083038185875af1925050503d8060008114613124576040519150601f19603f3d011682016040523d82523d6000602084013e613129565b606091505b509150915061313a878383876132e0565b979650505050505050565b600080808061315d6001600160a01b038816896120a0565b905060006131746001600160a01b0388168a6120a0565b90506000808a6001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b1580156131b257600080fd5b505afa1580156131c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131ea9190613d21565b5091509150886001600160a01b03168a6001600160a01b0316111561320b57905b816001600160701b031684108061322a5750806001600160701b031683105b9550851580156132545750816001600160701b03168411806132545750806001600160701b031683115b94506000613264896103e5613a5c565b9050600061327b85846001600160701b0316613356565b6132859083613a5c565b905060008261329d88876001600160701b0316613356565b6132a9906103e8613a5c565b6132b391906139ce565b905080156132ca576132c58183613a91565b6132cd565b60005b9950505050505050509450945094915050565b6060831561334c578251613345576001600160a01b0385163b6133455760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016107f3565b5081611df5565b611df5838361336c565b6000818310613365578161213a565b5090919050565b81511561337c5781518083602001fd5b8060405162461bcd60e51b81526004016107f39190613d66565b600061014082840312156133a957600080fd5b50919050565b6000602082840312156133c157600080fd5b5035919050565b6001600160a01b0381168114610a6957600080fd5b6000602082840312156133ef57600080fd5b813561213a816133c8565b6000806000806080858703121561341057600080fd5b843561341b816133c8565b9350602085013561342b816133c8565b93969395505050506040820135916060013590565b6000604082018483526020604081850152818551808452606086019150828701935060005b8181101561348157845183529383019391830191600101613465565b5090979650505050505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156134cc576134cc61348e565b604052919050565b600080600080600080600080610100898b0312156134f157600080fd5b88356134fc816133c8565b975060208981013561350d816133c8565b975060408a0135965060608a0135955060808a013561352b816133c8565b945060a08a0135935060c08a0135613542816133c8565b925060e08a01356001600160401b038082111561355e57600080fd5b818c0191508c601f83011261357257600080fd5b8135818111156135845761358461348e565b613596601f8201601f191685016134a4565b91508082528d848285010111156135ac57600080fd5b80848401858401376000848284010152508093505050509295985092959890939650565b6000602082840312156135e257600080fd5b81356001600160401b038111156135f857600080fd5b8201610120818503121561213a57600080fd5b60008060006060848603121561362057600080fd5b833592506020840135613632816133c8565b929592945050506040919091013590565b60006020828403121561365557600080fd5b81356001600160401b0381111561366b57600080fd5b82016101c0818503121561213a57600080fd5b60006001600160401b038211156136975761369761348e565b5060051b60200190565b600060208083850312156136b457600080fd5b82356001600160401b038111156136ca57600080fd5b8301601f810185136136db57600080fd5b80356136ee6136e98261367e565b6134a4565b81815260059190911b8201830190838101908783111561370d57600080fd5b928401925b8284101561313a578335613725816133c8565b82529284019290840190613712565b60008060006060848603121561374957600080fd5b8335613754816133c8565b925060208401359150604084013561376b816133c8565b809150509250925092565b60208082526024908201527f54686520616d6f756e74206d7573742062652067726561746572207468616e206040820152637a65726f60e01b606082015260800190565b6000602082840312156137cc57600080fd5b81356001600160401b038116811461213a57600080fd5b60058152645357494e4760d81b602082015260400190565b6001600160a01b03831681526001600160401b0382166020820152606060408201819052600090611df59083016137e3565b6001600160401b03851681526001600160a01b038481166020830152831660408201526060810182905260a0608082018190526000906130609083016137e3565b6000806040838503121561388157600080fd5b825191506020808401516001600160401b0381111561389f57600080fd5b8401601f810186136138b057600080fd5b80516138be6136e98261367e565b81815260059190911b820183019083810190888311156138dd57600080fd5b928401925b828410156138fb578351825292840192908401906138e2565b80955050505050509250929050565b60208082526028908201527f69742773206e6f7420616c6c6f77656420746f2073776170207769746820736160408201526736b2903a37b5b2b760c11b606082015260800190565b6000808335601e1984360301811261396957600080fd5b8301803591506001600160401b0382111561398357600080fd5b6020019150600581901b360382131561399b57600080fd5b9250929050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600082198211156139e1576139e16139b8565b500190565b60006000198214156139fa576139fa6139b8565b5060010190565b600082821015613a1357613a136139b8565b500390565b6001600160a01b03978816815295871660208701529386166040860152919094166060840152608083019390935260a082019290925260c081019190915260e00190565b6000816000190483118215151615613a7657613a766139b8565b500290565b634e487b7160e01b600052601260045260246000fd5b600082613aa057613aa0613a7b565b500490565b634e487b7160e01b600052602160045260246000fd5b600060208284031215613acd57600080fd5b81356004811061213a57600080fd5b60018060a01b0383168152816020820152606060408201526000611df5606083016137e3565b8481526001600160a01b038481166020830152831660408201526060810182905260a0608082018190526000906130609083016137e3565b6020808252825182820181905260009190848201906040850190845b81811015613b7b5783516001600160a01b031683529284019291840191600101613b56565b50909695505050505050565b600060208284031215613b9957600080fd5b5051919050565b8b8152602081018b9052604081018a90526001600160a01b038981166060830152888116608083015287811660a0830152861660c082015260e0810185905261010081018490526101208101839052610160810160048310613c1257634e487b7160e01b600052602160045260246000fd5b826101408301529c9b505050505050505050505050565b600082613c3857613c38613a7b565b500690565b6000808335601e19843603018112613c5457600080fd5b8301803591506001600160401b03821115613c6e57600080fd5b60200191503681900382131561399b57600080fd5b600060208284031215613c9557600080fd5b8151801515811461213a57600080fd5b60005b83811015613cc0578181015183820152602001613ca8565b8381111561195f5750506000910152565b60008251613ce3818460208701613ca5565b9190910192915050565b600060208284031215613cff57600080fd5b815161213a816133c8565b80516001600160701b038116811461149057600080fd5b600080600060608486031215613d3657600080fd5b613d3f84613d0a565b9250613d4d60208501613d0a565b9150604084015163ffffffff8116811461376b57600080fd5b6020815260008251806020840152613d85816040850160208701613ca5565b601f01601f1916919091016040019291505056fea26469706673582212206028f663092c8d0455410e35d9be45f90b04c6bc08f45b4f62cf4752d08eb73c64736f6c6343000809003300000000000000000000000042000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000bfb35d10e9c2adff2f08d2a2ebae880f7006469b000000000000000000000000596c13b2eedc61a6a4d3f09afd71be5f35980d0f000000000000000000000000856cb5c3cbbe9e2e21293a644aa1f9363cee11e8000000000000000000000000216b4b4ba9f3e719726886d34a177484278bfcae000000000000000000000000def171fe48cf0115b1d80b88dc8eab59176fee570000000000000000000000004f81e014e2f798541f7fb53faeb9a376a60a297d00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000008bcedd62dd46f1a76f8a1633d4f5b76e0cda521e
Deployed Bytecode
0x6080604052600436106102675760003560e01c80638c821e9011610144578063c415b95c116100b6578063e8984c5f1161007a578063e8984c5f1461071e578063e8bed6531461073e578063ea15afc314610751578063ecefc70514610771578063f2fde38b14610787578063f640d508146107a757610267565b8063c415b95c14610680578063c93d732d146106a0578063d6821ed8146106b3578063e37c4250146106e8578063e5932c40146106fe57610267565b8063a85f329811610108578063a85f3298146105ca578063ab304695146105ea578063ae551c6614610600578063b4c76fe014610620578063b9d52d3c14610640578063c10ffa6c1461066057610267565b80638c821e90146105405780638da5cb5b1461055657806390f3f20814610574578063a42dce801461058a578063a734f06e146105aa57610267565b806352b721f8116101dd5780635b769f3c116101a15780635b769f3c1461048a5780635c3d258f146104aa5780636076a0b4146104ca578063672383c4146104f8578063715018a6146105185780638928a29f1461052d57610267565b806352b721f8146103f4578063538ba4f91461040a57806353fd7bf11461042a5780635b18075e1461044a5780635b5a66a71461046a57610267565b80633aecd0e31161022f5780633aecd0e3146103265780633fc8cef314610354578063433b3c05146103745780634399fa5614610394578063457bfa2f146103b457806348c4d781146103d457610267565b806313721b6514610276578063228cb7331461028957806323a9495e146102c6578063310d4542146102e657806331428a8714610306575b3332141561027457600080fd5b005b610274610284366004613396565b6107c7565b34801561029557600080fd5b50600c546102a9906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156102d257600080fd5b506102746102e13660046133af565b610a6c565b3480156102f257600080fd5b506012546102a9906001600160a01b031681565b34801561031257600080fd5b50600a546102a9906001600160a01b031681565b34801561033257600080fd5b506103466103413660046133dd565b610ab0565b6040519081526020016102bd565b34801561036057600080fd5b506006546102a9906001600160a01b031681565b34801561038057600080fd5b506007546102a9906001600160a01b031681565b3480156103a057600080fd5b50600b546102a9906001600160a01b031681565b3480156103c057600080fd5b506013546102a9906001600160a01b031681565b3480156103e057600080fd5b506102746103ef3660046133af565b610ad3565b34801561040057600080fd5b5061034660115481565b34801561041657600080fd5b506002546102a9906001600160a01b031681565b34801561043657600080fd5b506102746104453660046133dd565b610b4e565b34801561045657600080fd5b50600d546102a9906001600160a01b031681565b34801561047657600080fd5b506102746104853660046133dd565b610ba4565b34801561049657600080fd5b506102746104a53660046133dd565b610bfa565b3480156104b657600080fd5b506102746104c53660046133af565b610c50565b3480156104d657600080fd5b506104ea6104e53660046133fa565b610c8d565b6040516102bd929190613440565b34801561050457600080fd5b506102a96105133660046133af565b610d36565b34801561052457600080fd5b50610274610d60565b61027461053b3660046134d4565b610d74565b34801561054c57600080fd5b5061034660045481565b34801561056257600080fd5b506000546001600160a01b03166102a9565b34801561058057600080fd5b5061034660055481565b34801561059657600080fd5b506102746105a53660046133dd565b610df6565b3480156105b657600080fd5b506001546102a9906001600160a01b031681565b3480156105d657600080fd5b506102746105e53660046133af565b610e4c565b3480156105f657600080fd5b5061034660035481565b34801561060c57600080fd5b50600e546102a9906001600160a01b031681565b34801561062c57600080fd5b5061027461063b3660046133dd565b610e89565b34801561064c57600080fd5b5061027461065b3660046133dd565b610edf565b34801561066c57600080fd5b5061027461067b3660046133dd565b610f35565b34801561068c57600080fd5b50600f546102a9906001600160a01b031681565b6103466106ae3660046135d0565b610f8b565b3480156106bf57600080fd5b506106d36106ce36600461360b565b611495565b604080519283526020830191909152016102bd565b3480156106f457600080fd5b5061034660105481565b34801561070a57600080fd5b506102746107193660046133dd565b6114c5565b34801561072a57600080fd5b506102746107393660046133dd565b61151b565b61027461074c366004613643565b611571565b34801561075d57600080fd5b5061027461076c3660046136a1565b611823565b34801561077d57600080fd5b5061034661271081565b34801561079357600080fd5b506102746107a23660046133dd565b6118cd565b3480156107b357600080fd5b506102746107c2366004613734565b611943565b6107cf611965565b60008160a00135116107fc5760405162461bcd60e51b81526004016107f390613776565b60405180910390fd5b61080d610100820160e083016137ba565b6001600160401b03164614156108655760405162461bcd60e51b815260206004820152601d60248201527f43616e6e6f742062726964676520746f2073616d65206e6574776f726b00000060448201526064016107f3565b61088d333060a084013561087c60208601866133dd565b6001600160a01b03169291906119bf565b60006108be61089f60208401846133dd565b60a08401356108b460808601606087016133dd565b8560800135611ab1565b905060006108e06108d260208501856133dd565b6001600160a01b0316611dfd565b9050801561096f576012546001600160a01b031663ea3684218361090a60608701604088016133dd565b61091b610100880160e089016137ba565b6040518463ffffffff1660e01b81526004016109389291906137fb565b6000604051808303818588803b15801561095157600080fd5b505af1158015610965573d6000803e3d6000fd5b5050505050610a4e565b60125461099e906001600160a01b0316600061098e60208701876133dd565b6001600160a01b03169190611e36565b6012546109bc906001600160a01b03168361098e60208701876133dd565b6012546001600160a01b03166355d735956109de610100860160e087016137ba565b6109eb60208701876133dd565b6109fb60608801604089016133dd565b866040518563ffffffff1660e01b8152600401610a1b949392919061382d565b600060405180830381600087803b158015610a3557600080fd5b505af1158015610a49573d6000803e3d6000fd5b505050505b610a5d83600084336001611f92565b5050610a696001600955565b50565b610a74612046565b60058190556040518181527f11e8ee12d79dc7314b845f4e82465af5bd3d2214081526061af36de8364eaa2e906020015b60405180910390a150565b6000610aba612046565b610acd6001600160a01b038316306120a0565b92915050565b610adb612046565b611388811115610b195760405162461bcd60e51b8152602060048201526009602482015268746f6f206c6172676560b81b60448201526064016107f3565b60108190556040518181527fa28aac6f4ba79029a647ee085b0ae88419c6aa87bae5dcf77d303dba45b3681b90602001610aa5565b610b56612046565b600b80546001600160a01b0319166001600160a01b0383169081179091556040519081527f35e63b7fefc2b1fb2ed78adeed6688b187514d96c2d7d56222e52f3e41c2fb2f90602001610aa5565b610bac612046565b601380546001600160a01b0319166001600160a01b0383169081179091556040519081527fb3bfb91ec7a3f9a14278772a47b34685afb9cdd7ef683fab8a790ccdd667264790602001610aa5565b610c02612046565b600680546001600160a01b0319166001600160a01b0383169081179091556040519081527f41408be49f75701fe4bb8484ce88d68f1d82e03cb4eb44263b6682ce2dbd32f090602001610aa5565b610c58612046565b60118190556040518181527f8f817f25bf47abe304b519d80d1a633064758c57d280731736fe82ad20816c5590602001610aa5565b600a5460405163181da82d60e21b81526001600160a01b03868116600483015285811660248301526044820185905260648201849052600092606092911690636076a0b49060840160006040518083038186803b158015610ced57600080fd5b505afa158015610d01573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610d29919081019061386e565b9097909650945050505050565b60088181548110610d4657600080fd5b6000918252602090912001546001600160a01b0316905081565b610d68612046565b610d726000612141565b565b610d7c611965565b866001600160a01b0316886001600160a01b03161415610dae5760405162461bcd60e51b81526004016107f39061390a565b610dc36001600160a01b0389163330896119bf565b6000610dd189888787611ab1565b9050610de08989838686612191565b5050610dec6001600955565b5050505050505050565b610dfe612046565b600f80546001600160a01b0319166001600160a01b0383169081179091556040519081527f12e1d17016b94668449f97876f4a8d5cc2c19f314db337418894734037cc19d490602001610aa5565b610e54612046565b60048190556040518181527f70f24e12a9db25e0d80cbcde19ffef47d6a7c52c1089db4c71e53ce1856577fc90602001610aa5565b610e91612046565b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527f17780f3919f73af11f29e4157534858a06c91294d64b679fe4e49340122cd32290602001610aa5565b610ee7612046565b600e80546001600160a01b0319166001600160a01b0383169081179091556040519081527fe0209b1ff5892dc27d9ffb30000e308317645f928d78a0a018dd2e9289ecc29290602001610aa5565b610f3d612046565b601280546001600160a01b0319166001600160a01b0383169081179091556040519081527fb5833751b090fc12b019e650d7889c9b220d3e51b21b8066b748a536ed15e2a190602001610aa5565b6000610f95611965565b81608001358260600135101561100b5760405162461bcd60e51b815260206004820152603560248201527f657870656374656452657475726e206d75737420626520657175616c206f72206044820152743630b933b2b9103a3430b71036b4b72932ba3ab93760591b60648201526084016107f3565b61101b60408301602084016133dd565b6001600160a01b031661103160208401846133dd565b6001600160a01b031614156110585760405162461bcd60e51b81526004016107f39061390a565b60008060005b61106c610100860186613952565b90508110156110ea576000611085610100870187613952565b83818110611095576110956139a2565b9050602002013511156110d8576110b0610100860186613952565b828181106110c0576110c06139a2565b90506020020135836110d291906139ce565b92508091505b806110e2816139e6565b91505061105e565b5081611149576111006108d260208601866133dd565b1561113c5760405133903480156108fc02916000818181858888f19350505050158015611131573d6000803e3d6000fd5b503492505050611486565b5050506040810135611486565b6111603330604087013561087c60208901896133dd565b600061119161117260208701876133dd565b604087013561118760c0890160a08a016133dd565b8860c00135611ab1565b90506111fd6111a4610100870187613952565b808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508592508791508690506111e860208b018b6133dd565b6111f860408c0160208d016133dd565b612279565b935083156114175784608001358410156112655760405162461bcd60e51b8152602060048201526024808201527f5377697463683a2052657475726e20616d6f756e7420776173206e6f7420656e6044820152630deeaced60e31b60648201526084016107f3565b8460600135841115611387576112aa611285610100870160e088016133dd565b606087013561129a6040890160208a016133dd565b6001600160a01b031691906124a9565b50600c546112d9906001600160a01b03166112c9606088013587613a01565b61129a6040890160208a016133dd565b50600b546001600160a01b031663391fdc24336112fd610100890160e08a016133dd565b61130a60208a018a6133dd565b61131a60408b0160208c016133dd565b60408b013560608c013561132e818d613a01565b6040518863ffffffff1660e01b81526004016113509796959493929190613a18565b600060405180830381600087803b15801561136a57600080fd5b505af115801561137e573d6000803e3d6000fd5b50505050611482565b6113ac61139b610100870160e088016133dd565b8561129a6040890160208a016133dd565b50600b546001600160a01b031663391fdc24336113d0610100890160e08a016133dd565b6113dd60208a018a6133dd565b6113ed60408b0160208c016133dd565b8a604001358a60006040518863ffffffff1660e01b81526004016113509796959493929190613a18565b604085013561143c3061142d60208901896133dd565b6001600160a01b0316906120a0565b111561145e5761145833604087013561129a60208901896133dd565b50611482565b611480336114733061142d60208a018a6133dd565b61129a60208901896133dd565b505b5050505b6114906001600955565b919050565b6000806127106114a58685613a5c565b6114af9190613a91565b91506114bb8286613a01565b9050935093915050565b6114cd612046565b600c80546001600160a01b0319166001600160a01b0383169081179091556040519081527f53a596d7be747a5a4f4d39a6a36476d2eed407c93f6f2ba8a96c8b971240d5cd90602001610aa5565b611523612046565b600d80546001600160a01b0319166001600160a01b0383169081179091556040519081527f4528d04696417deba6006cd6c7e5bbb56b9874ac9d954a956e14b8d74f08d72b90602001610aa5565b611579611965565b60008160c001351161159d5760405162461bcd60e51b81526004016107f390613776565b8061010001354614156115f25760405162461bcd60e51b815260206004820152601d60248201527f43616e6e6f742062726964676520746f2073616d65206e6574776f726b00000060448201526064016107f3565b611609333060c084013561087c60208601866133dd565b60008061163b61161c60208501856133dd565b60c085013561163160a08701608088016133dd565b8660a00135611ab1565b9050600061164f60408501602086016133dd565b905061166160408501602086016133dd565b6001600160a01b031661167760208601866133dd565b6001600160a01b0316141561168e578192506116d8565b60016116a26101c086016101a08701613abb565b60038111156116b3576116b3613aa5565b14156116ca576116c38483612524565b92506116d8565b6116d48483612590565b5092505b60006116ed6108d260408701602088016133dd565b90508015611771576012546001600160a01b031663ea368421856117176080890160608a016133dd565b8861010001356040518463ffffffff1660e01b815260040161173a929190613adc565b6000604051808303818588803b15801561175357600080fd5b505af1158015611767573d6000803e3d6000fd5b5050505050611806565b60125461178b906001600160a01b038481169116866127a1565b6012546001600160a01b03166355d73595610100870135846117b360808a0160608b016133dd565b886040518563ffffffff1660e01b81526004016117d39493929190613b02565b600060405180830381600087803b1580156117ed57600080fd5b505af1158015611801573d6000803e3d6000fd5b505050505b6118158560008633600161287c565b50505050610a696001600955565b61182b612046565b805160035560005b815181101561189d576008828281518110611850576118506139a2565b60209081029190910181015182546001810184556000938452919092200180546001600160a01b0319166001600160a01b0390921691909117905580611895816139e6565b915050611833565b507fbbc63a7f378af7e269ef19f3fe0d08f044c91ee72930c0d045a58be58580f3d381604051610aa59190613b3a565b6118d5612046565b6001600160a01b03811661193a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016107f3565b610a6981612141565b61194b612046565b61195f6001600160a01b03841682846124a9565b50505050565b600260095414156119b85760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016107f3565b6002600955565b806119c95761195f565b6119d284611dfd565b15611a9c576001600160a01b038316331480156119ef5750803410155b611a4f5760405162461bcd60e51b815260206004820152602b60248201527f57726f6e6720757365616765206f66204554482e756e6976657273616c54726160448201526a6e7366657246726f6d282960a81b60648201526084016107f3565b6001600160a01b0382163014611a97576040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015611a95573d6000803e3d6000fd5b505b61195f565b61195f6001600160a01b0385168484846128fa565b6000601054821115611b055760405162461bcd60e51b815260206004820152601860248201527f706172746e65724665655261746520746f6f206c61726765000000000000000060448201526064016107f3565b50828115611df557600f54604051637b8c4cdf60e01b81526001600160a01b0385811660048301526000921690637b8c4cdf9060240160206040518083038186803b158015611b5357600080fd5b505afa158015611b67573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b8b9190613b87565b15611c1257600f54604051637b8c4cdf60e01b81526001600160a01b03868116600483015290911690637b8c4cdf9060240160206040518083038186803b158015611bd557600080fd5b505afa158015611be9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c0d9190613b87565b611c16565b6011545b90506000611c2661271080613a5c565b82611c318887613a5c565b611c3b9190613a5c565b611c459190613a91565b9050600081612710611c578988613a5c565b611c619190613a91565b611c6b9190613a01565b9050611c7f886001600160a01b0316611dfd565b15611d1257600f546001600160a01b031663eedd56e1611c9f84846139ce565b6040516001600160e01b031960e084901b1681526001600160a01b03808d16600483015260248201869052604482018790528a1660648201526084016000604051808303818588803b158015611cf457600080fd5b505af1158015611d08573d6000803e3d6000fd5b5050505050611dce565b600f54611d2d906001600160a01b038a811691166000611e36565b600f54611d58906001600160a01b0316611d4784846139ce565b6001600160a01b038b169190611e36565b600f5460405163eedd56e160e01b81526001600160a01b038a81166004830152602482018490526044820185905288811660648301529091169063eedd56e190608401600060405180830381600087803b158015611db557600080fd5b505af1158015611dc9573d6000803e3d6000fd5b505050505b612710611ddb8887613a5c565b611de59190613a91565b611def9088613a01565b93505050505b949350505050565b60006001600160a01b0382161580610acd57506001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1492915050565b801580611ebf5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b158015611e8557600080fd5b505afa158015611e99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ebd9190613b87565b155b611f2a5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b60648201526084016107f3565b6040516001600160a01b038316602482015260448101829052611f8d90849063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612932565b505050565b600b546001600160a01b0316630aea28c76101008701358661012089013586611fbe60208c018c6133dd565b611fcb60208d018d6133dd565b611fdb60408e0160208f016133dd565b8d60a001358c8f60c001358c6040518c63ffffffff1660e01b815260040161200d9b9a99989796959493929190613ba0565b600060405180830381600087803b15801561202757600080fd5b505af115801561203b573d6000803e3d6000fd5b505050505050505050565b6000546001600160a01b03163314610d725760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107f3565b60006120ab83611dfd565b156120c157506001600160a01b03811631610acd565b6040516370a0823160e01b81526001600160a01b0383811660048301528416906370a082319060240160206040518083038186803b15801561210257600080fd5b505afa158015612116573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061213a9190613b87565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000846001600160a01b0316866001600160a01b031614156121c55760405162461bcd60e51b81526004016107f39061390a565b6121d0868584612a07565b6121e36001600160a01b038616306120a0565b90508015612201576121ff6001600160a01b03861684836124a9565b505b600b54604051630e47f70960e21b81526001600160a01b039091169063391fdc249061223e90339087908b908b908b908990600090600401613a18565b600060405180830381600087803b15801561225857600080fd5b505af115801561226c573d6000803e3d6000fd5b5050505095945050505050565b600060045460035461228b9190613a5c565b8751111561230b5760405162461bcd60e51b815260206004820152604160248201527f5377697463683a20446973747269627574696f6e2061727261792073686f756c60448201527f64206e6f742065786365656420666163746f726965732061727261792073697a6064820152606560f81b608482015260a4016107f3565b856000805b895181101561249c5789818151811061232b5761232b6139a2565b6020026020010151600014156123405761248a565b6000888b8381518110612355576123556139a2565b60200260200101518b6123689190613a5c565b6123729190613a91565b90508782141561237f5750825b6123898185613a01565b9350600454826123999190613c29565b6123e4576123dd8787836008600454876123b39190613a91565b815481106123c3576123c36139a2565b6000918252602090912001546001600160a01b0316612b4b565b925061247c565b6004546123f19083613c29565b60011415612439576123dd87878360086004548761240f9190613a91565b8154811061241f5761241f6139a2565b6000918252602090912001546001600160a01b0316612b62565b61247987878360086004548761244f9190613a91565b8154811061245f5761245f6139a2565b6000918252602090912001546001600160a01b0316612b7f565b92505b61248683866139ce565b9450505b80612494816139e6565b915050612310565b5050509695505050505050565b6000816124b85750600161213a565b6124c184611dfd565b15612506576040516001600160a01b0384169083156108fc029084906000818181858888f193505050501580156124fc573d6000803e3d6000fd5b506001905061213a565b61251a6001600160a01b0385168484612b9c565b5060019392505050565b600061213a61253660208501856133dd565b61254660408601602087016133dd565b8430612556610180890189613c3d565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061219192505050565b60008080805b6125a4610120870187613952565b90508110156126225760006125bd610120880188613952565b838181106125cd576125cd6139a2565b905060200201351115612610576125e8610120870187613952565b828181106125f8576125f86139a2565b905060200201358361260a91906139ce565b92508091505b8061261a816139e6565b915050612596565b50600082116126735760405162461bcd60e51b815260206004820152601a60248201527f696e76616c696420646973747269627574696f6e20706172616d00000000000060448201526064016107f3565b6126c8612684610120870187613952565b808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508892508691508590506111e860208b018b6133dd565b9250600083116127115760405162461bcd60e51b81526020600482015260146024820152730a6eec2e040ccc2d2d8cac840cce4deda40c8caf60631b60448201526064016107f3565b600b546001600160a01b031663391fdc24333061273160208a018a6133dd565b61274160408b0160208c016133dd565b898960006040518863ffffffff1660e01b81526004016127679796959493929190613a18565b600060405180830381600087803b15801561278157600080fd5b505af1158015612795573d6000803e3d6000fd5b50505050509250929050565b6127aa83611dfd565b611f8d57806127c857611f8d6001600160a01b038416836000611e36565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e9060440160206040518083038186803b15801561281357600080fd5b505afa158015612827573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061284b9190613b87565b90508015612868576128686001600160a01b038516846000611e36565b61195f6001600160a01b0385168484611e36565b600b546001600160a01b0316630aea28c761014087013586610160890135866128a860208c018c6133dd565b6128b860408d0160208e016133dd565b6128c860608e0160408f016133dd565b8d60c001358c8f60e001358c6040518c63ffffffff1660e01b815260040161200d9b9a99989796959493929190613ba0565b6040516001600160a01b038085166024830152831660448201526064810182905261195f9085906323b872dd60e01b90608401611f56565b6000612987826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612bcc9092919063ffffffff16565b90508051600014806129a85750808060200190518101906129a89190613c83565b611f8d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016107f3565b6000612a1b846001600160a01b0316611dfd565b15612a775782471015612a705760405162461bcd60e51b815260206004820152601b60248201527f4554482062616c616e636520697320696e73756666696369656e74000000000060448201526064016107f3565b5081612a91565b600d54612a91906001600160a01b038681169116856127a1565b600e546040516000916001600160a01b0316908390612ab1908690613cd1565b60006040518083038185875af1925050503d8060008114612aee576040519150601f19603f3d011682016040523d82523d6000602084013e612af3565b606091505b5050905080612b445760405162461bcd60e51b815260206004820152601960248201527f506172617377617020657865637574696f6e206661696c65640000000000000060448201526064016107f3565b5050505050565b6000612b5985858585612bdb565b95945050505050565b600654600090612b599086906001600160a01b0316868686613047565b600754600090612b599086906001600160a01b0316868686613047565b6040516001600160a01b038316602482015260448101829052611f8d90849063a9059cbb60e01b90606401611f56565b6060611df5848460008561306a565b6000612bef856001600160a01b0316611dfd565b15612c5e57600660009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0846040518263ffffffff1660e01b81526004016000604051808303818588803b158015612c4457600080fd5b505af1158015612c58573d6000803e3d6000fd5b50505050505b6000612c72866001600160a01b0316611dfd565b612c7c5785612c89565b6006546001600160a01b03165b90506000612c9f866001600160a01b0316611dfd565b612ca95785612cb6565b6006546001600160a01b03165b60405163e6a4390560e01b81526001600160a01b038481166004830152808316602483015291925060009186169063e6a439059060440160206040518083038186803b158015612d0557600080fd5b505afa158015612d19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d3d9190613ced565b9050600080612d576001600160a01b03841686868b613145565b919750925090508115612dbc57826001600160a01b031663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b158015612d9f57600080fd5b505af1158015612db3573d6000803e3d6000fd5b50505050612e30565b8015612e305760405163bc25cf7760e01b81527346fd07da395799f113a7584563b8cb886f33c2bc60048201526001600160a01b0384169063bc25cf7790602401600060405180830381600087803b158015612e1757600080fd5b505af1158015612e2b573d6000803e3d6000fd5b505050505b612e446001600160a01b038616848a6124a9565b50836001600160a01b0316856001600160a01b03161015612ed95760405163022c0d9f60e01b8152600060048201819052602482018890523060448301526080606483015260848201526001600160a01b0384169063022c0d9f9060a401600060405180830381600087803b158015612ebc57600080fd5b505af1158015612ed0573d6000803e3d6000fd5b50505050612f4f565b60405163022c0d9f60e01b8152600481018790526000602482018190523060448301526080606483015260848201526001600160a01b0384169063022c0d9f9060a401600060405180830381600087803b158015612f3657600080fd5b505af1158015612f4a573d6000803e3d6000fd5b505050505b612f61896001600160a01b0316611dfd565b1561303a576006546040516370a0823160e01b81523060048201526001600160a01b0390911690632e1a7d4d9082906370a082319060240160206040518083038186803b158015612fb157600080fd5b505afa158015612fc5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fe99190613b87565b6040518263ffffffff1660e01b815260040161300791815260200190565b600060405180830381600087803b15801561302157600080fd5b505af1158015613035573d6000803e3d6000fd5b505050505b5050505050949350505050565b6000613060858561305a89898888612bdb565b85612bdb565b9695505050505050565b6060824710156130cb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016107f3565b600080866001600160a01b031685876040516130e79190613cd1565b60006040518083038185875af1925050503d8060008114613124576040519150601f19603f3d011682016040523d82523d6000602084013e613129565b606091505b509150915061313a878383876132e0565b979650505050505050565b600080808061315d6001600160a01b038816896120a0565b905060006131746001600160a01b0388168a6120a0565b90506000808a6001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b1580156131b257600080fd5b505afa1580156131c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131ea9190613d21565b5091509150886001600160a01b03168a6001600160a01b0316111561320b57905b816001600160701b031684108061322a5750806001600160701b031683105b9550851580156132545750816001600160701b03168411806132545750806001600160701b031683115b94506000613264896103e5613a5c565b9050600061327b85846001600160701b0316613356565b6132859083613a5c565b905060008261329d88876001600160701b0316613356565b6132a9906103e8613a5c565b6132b391906139ce565b905080156132ca576132c58183613a91565b6132cd565b60005b9950505050505050509450945094915050565b6060831561334c578251613345576001600160a01b0385163b6133455760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016107f3565b5081611df5565b611df5838361336c565b6000818310613365578161213a565b5090919050565b81511561337c5781518083602001fd5b8060405162461bcd60e51b81526004016107f39190613d66565b600061014082840312156133a957600080fd5b50919050565b6000602082840312156133c157600080fd5b5035919050565b6001600160a01b0381168114610a6957600080fd5b6000602082840312156133ef57600080fd5b813561213a816133c8565b6000806000806080858703121561341057600080fd5b843561341b816133c8565b9350602085013561342b816133c8565b93969395505050506040820135916060013590565b6000604082018483526020604081850152818551808452606086019150828701935060005b8181101561348157845183529383019391830191600101613465565b5090979650505050505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156134cc576134cc61348e565b604052919050565b600080600080600080600080610100898b0312156134f157600080fd5b88356134fc816133c8565b975060208981013561350d816133c8565b975060408a0135965060608a0135955060808a013561352b816133c8565b945060a08a0135935060c08a0135613542816133c8565b925060e08a01356001600160401b038082111561355e57600080fd5b818c0191508c601f83011261357257600080fd5b8135818111156135845761358461348e565b613596601f8201601f191685016134a4565b91508082528d848285010111156135ac57600080fd5b80848401858401376000848284010152508093505050509295985092959890939650565b6000602082840312156135e257600080fd5b81356001600160401b038111156135f857600080fd5b8201610120818503121561213a57600080fd5b60008060006060848603121561362057600080fd5b833592506020840135613632816133c8565b929592945050506040919091013590565b60006020828403121561365557600080fd5b81356001600160401b0381111561366b57600080fd5b82016101c0818503121561213a57600080fd5b60006001600160401b038211156136975761369761348e565b5060051b60200190565b600060208083850312156136b457600080fd5b82356001600160401b038111156136ca57600080fd5b8301601f810185136136db57600080fd5b80356136ee6136e98261367e565b6134a4565b81815260059190911b8201830190838101908783111561370d57600080fd5b928401925b8284101561313a578335613725816133c8565b82529284019290840190613712565b60008060006060848603121561374957600080fd5b8335613754816133c8565b925060208401359150604084013561376b816133c8565b809150509250925092565b60208082526024908201527f54686520616d6f756e74206d7573742062652067726561746572207468616e206040820152637a65726f60e01b606082015260800190565b6000602082840312156137cc57600080fd5b81356001600160401b038116811461213a57600080fd5b60058152645357494e4760d81b602082015260400190565b6001600160a01b03831681526001600160401b0382166020820152606060408201819052600090611df59083016137e3565b6001600160401b03851681526001600160a01b038481166020830152831660408201526060810182905260a0608082018190526000906130609083016137e3565b6000806040838503121561388157600080fd5b825191506020808401516001600160401b0381111561389f57600080fd5b8401601f810186136138b057600080fd5b80516138be6136e98261367e565b81815260059190911b820183019083810190888311156138dd57600080fd5b928401925b828410156138fb578351825292840192908401906138e2565b80955050505050509250929050565b60208082526028908201527f69742773206e6f7420616c6c6f77656420746f2073776170207769746820736160408201526736b2903a37b5b2b760c11b606082015260800190565b6000808335601e1984360301811261396957600080fd5b8301803591506001600160401b0382111561398357600080fd5b6020019150600581901b360382131561399b57600080fd5b9250929050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600082198211156139e1576139e16139b8565b500190565b60006000198214156139fa576139fa6139b8565b5060010190565b600082821015613a1357613a136139b8565b500390565b6001600160a01b03978816815295871660208701529386166040860152919094166060840152608083019390935260a082019290925260c081019190915260e00190565b6000816000190483118215151615613a7657613a766139b8565b500290565b634e487b7160e01b600052601260045260246000fd5b600082613aa057613aa0613a7b565b500490565b634e487b7160e01b600052602160045260246000fd5b600060208284031215613acd57600080fd5b81356004811061213a57600080fd5b60018060a01b0383168152816020820152606060408201526000611df5606083016137e3565b8481526001600160a01b038481166020830152831660408201526060810182905260a0608082018190526000906130609083016137e3565b6020808252825182820181905260009190848201906040850190845b81811015613b7b5783516001600160a01b031683529284019291840191600101613b56565b50909695505050505050565b600060208284031215613b9957600080fd5b5051919050565b8b8152602081018b9052604081018a90526001600160a01b038981166060830152888116608083015287811660a0830152861660c082015260e0810185905261010081018490526101208101839052610160810160048310613c1257634e487b7160e01b600052602160045260246000fd5b826101408301529c9b505050505050505050505050565b600082613c3857613c38613a7b565b500690565b6000808335601e19843603018112613c5457600080fd5b8301803591506001600160401b03821115613c6e57600080fd5b60200191503681900382131561399b57600080fd5b600060208284031215613c9557600080fd5b8151801515811461213a57600080fd5b60005b83811015613cc0578181015183820152602001613ca8565b8381111561195f5750506000910152565b60008251613ce3818460208701613ca5565b9190910192915050565b600060208284031215613cff57600080fd5b815161213a816133c8565b80516001600160701b038116811461149057600080fd5b600080600060608486031215613d3657600080fd5b613d3f84613d0a565b9250613d4d60208501613d0a565b9150604084015163ffffffff8116811461376b57600080fd5b6020815260008251806020840152613d85816040850160208701613ca5565b601f01601f1916919091016040019291505056fea26469706673582212206028f663092c8d0455410e35d9be45f90b04c6bc08f45b4f62cf4752d08eb73c64736f6c63430008090033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000042000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000bfb35d10e9c2adff2f08d2a2ebae880f7006469b000000000000000000000000596c13b2eedc61a6a4d3f09afd71be5f35980d0f000000000000000000000000856cb5c3cbbe9e2e21293a644aa1f9363cee11e8000000000000000000000000216b4b4ba9f3e719726886d34a177484278bfcae000000000000000000000000def171fe48cf0115b1d80b88dc8eab59176fee570000000000000000000000004f81e014e2f798541f7fb53faeb9a376a60a297d00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000008bcedd62dd46f1a76f8a1633d4f5b76e0cda521e
-----Decoded View---------------
Arg [0] : _weth (address): 0x4200000000000000000000000000000000000006
Arg [1] : _otherToken (address): 0x0000000000000000000000000000000000000000
Arg [2] : _pathCountAndSplit (uint256[]): 2,1
Arg [3] : _factories (address[]): 0x8BCeDD62DD46F1A76F8A1633d4f5B76e0CDa521E
Arg [4] : _switchViewAddress (address): 0xbFB35d10e9C2ADff2F08d2A2ebae880F7006469B
Arg [5] : _switchEventAddress (address): 0x596c13B2eEDC61A6a4d3F09afd71Be5F35980D0F
Arg [6] : _hyphenRouter (address): 0x856cb5c3cBBe9e2E21293A644aA1f9363CEE11E8
Arg [7] : _paraswapProxy (address): 0x216B4B4Ba9F3e719726886d34a177484278Bfcae
Arg [8] : _augustusSwapper (address): 0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57
Arg [9] : _feeCollector (address): 0x4f81e014E2f798541f7fB53Faeb9A376a60A297d
-----Encoded View---------------
15 Constructor Arguments found :
Arg [0] : 0000000000000000000000004200000000000000000000000000000000000006
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000140
Arg [3] : 00000000000000000000000000000000000000000000000000000000000001a0
Arg [4] : 000000000000000000000000bfb35d10e9c2adff2f08d2a2ebae880f7006469b
Arg [5] : 000000000000000000000000596c13b2eedc61a6a4d3f09afd71be5f35980d0f
Arg [6] : 000000000000000000000000856cb5c3cbbe9e2e21293a644aa1f9363cee11e8
Arg [7] : 000000000000000000000000216b4b4ba9f3e719726886d34a177484278bfcae
Arg [8] : 000000000000000000000000def171fe48cf0115b1d80b88dc8eab59176fee57
Arg [9] : 0000000000000000000000004f81e014e2f798541f7fb53faeb9a376a60a297d
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [11] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [12] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [13] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [14] : 0000000000000000000000008bcedd62dd46f1a76f8a1633d4f5b76e0cda521e
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.