Source Code
Latest 25 from a total of 454 transactions
| Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Transfer By Symb... | 19015290 | 166 days ago | IN | 0.01156072 ETH | 0.00000005 | ||||
| Swap By Symbiosi... | 17145511 | 198 days ago | IN | 0 ETH | 0.00000853 | ||||
| Swap By Symbiosi... | 15846757 | 247 days ago | IN | 0.03 ETH | 0.000007 | ||||
| Swap By Symbiosi... | 14934875 | 278 days ago | IN | 0.22 ETH | 0.00008214 | ||||
| Transfer By Symb... | 14185444 | 308 days ago | IN | 0.0038 ETH | 0.00001499 | ||||
| Transfer By Symb... | 14136417 | 311 days ago | IN | 0.005 ETH | 0.00001389 | ||||
| Transfer By Symb... | 14112647 | 312 days ago | IN | 0.004 ETH | 0.00002454 | ||||
| Transfer By Symb... | 14107259 | 313 days ago | IN | 0.005 ETH | 0.00002073 | ||||
| Transfer By Symb... | 14100091 | 313 days ago | IN | 0.01 ETH | 0.00001369 | ||||
| Transfer By Symb... | 14076053 | 315 days ago | IN | 0.0032 ETH | 0.00001668 | ||||
| Transfer By Symb... | 14031505 | 317 days ago | IN | 0.005 ETH | 0.00002456 | ||||
| Swap By Symbiosi... | 13794711 | 329 days ago | IN | 0 ETH | 0.00006468 | ||||
| Transfer By Symb... | 13001358 | 364 days ago | IN | 0.0375 ETH | 0.00004336 | ||||
| Transfer By Symb... | 12960269 | 365 days ago | IN | 0.0027 ETH | 0.00008781 | ||||
| Swap By Symbiosi... | 12503233 | 384 days ago | IN | 0.006 ETH | 0.00011173 | ||||
| Transfer By Symb... | 12278145 | 393 days ago | IN | 0.0125 ETH | 0.00012836 | ||||
| Transfer By Symb... | 12175300 | 397 days ago | IN | 0.04 ETH | 0.0000489 | ||||
| Swap By Symbiosi... | 12096945 | 400 days ago | IN | 0 ETH | 0.0000351 | ||||
| Transfer By Symb... | 11929964 | 407 days ago | IN | 0 ETH | 0.00002636 | ||||
| Transfer By Symb... | 11824624 | 411 days ago | IN | 0.00205 ETH | 0.00003195 | ||||
| Swap By Symbiosi... | 11801406 | 411 days ago | IN | 0.04 ETH | 0.00002616 | ||||
| Swap By Symbiosi... | 11801212 | 411 days ago | IN | 0.03 ETH | 0.00004629 | ||||
| Swap By Symbiosi... | 11801084 | 411 days ago | IN | 0.03 ETH | 0.00003742 | ||||
| Swap By Symbiosi... | 11800658 | 411 days ago | IN | 0.03 ETH | 0.0000254 | ||||
| Swap By Symbiosi... | 11798382 | 412 days ago | IN | 0.02 ETH | 0.00004934 |
Latest 25 internal transactions (View All)
Advanced mode:
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 19015290 | 166 days ago | 0.0115376 ETH | ||||
| 19015290 | 166 days ago | 0.00002312 ETH | ||||
| 15846757 | 247 days ago | 0.02994 ETH | ||||
| 15846757 | 247 days ago | 0.00006 ETH | ||||
| 14934875 | 278 days ago | 0.21956 ETH | ||||
| 14934875 | 278 days ago | 0.00044 ETH | ||||
| 14185444 | 308 days ago | 0.0032927 ETH | ||||
| 14185444 | 308 days ago | 0.0005073 ETH | ||||
| 14136417 | 311 days ago | 0.004479 ETH | ||||
| 14136417 | 311 days ago | 0.000521 ETH | ||||
| 14112647 | 312 days ago | 0.0034924 ETH | ||||
| 14112647 | 312 days ago | 0.0005076 ETH | ||||
| 14107259 | 313 days ago | 0.004469 ETH | ||||
| 14107259 | 313 days ago | 0.000531 ETH | ||||
| 14100091 | 313 days ago | 0.009438 ETH | ||||
| 14100091 | 313 days ago | 0.000562 ETH | ||||
| 14076053 | 315 days ago | 0.00266816 ETH | ||||
| 14076053 | 315 days ago | 0.00053184 ETH | ||||
| 14031505 | 317 days ago | 0.004467 ETH | ||||
| 14031505 | 317 days ago | 0.000533 ETH | ||||
| 13794711 | 329 days ago | 0.01059157 ETH | ||||
| 13794711 | 329 days ago | 0.01059157 ETH | ||||
| 13794711 | 329 days ago | 0.01059157 ETH | ||||
| 13001358 | 364 days ago | 0.03706125 ETH | ||||
| 13001358 | 364 days ago | 0.00043875 ETH |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
SwitchSymbiosis
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 { ISymbiosisRouter } from "../interfaces/ISymbiosisRouter.sol";
import "../lib/DataTypes.sol";
import "../dexs/SwitchV2.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
contract SwitchSymbiosis is SwitchV2 {
using UniversalERC20 for IERC20;
using SafeERC20 for IERC20;
address public symbiosisRouter;
address public symbiosisGateway;
address public nativeWrap;
struct SymbiosisMetaRouteData {
bytes firstSwapCalldata;
bytes secondSwapCalldata;
address[] approvedTokens;
address firstDexRouter;
address secondDexRouter;
uint256 amount;
bool nativeIn;
address relayRecipient;
bytes otherSideCalldata;
}
struct TransferArgsSymbiosis {
address fromToken;
address destToken;
address symbiosisMaker;
address partner;
uint256 partnerFeeRate;
uint256 amount;
uint256 estimatedDstTokenAmount;
uint64 dstChainId;
bytes32 id;
bytes32 bridge;
SymbiosisMetaRouteData symbiosisData;
}
struct SwapArgsSymbiosis {
address fromToken;
address bridgeToken;
address destToken;
address symbiosisMaker;
address partner;
uint256 partnerFeeRate;
uint256 amount;
uint256 estimatedDstTokenAmount;
uint256 dstChainId;
uint256[] srcDistribution;
bytes32 id;
bytes32 bridge;
SymbiosisMetaRouteData symbiosisData;
bytes aggregatorInfo;
}
event SymbiosisRouterSet(address symbiosisRouter);
event SymbiosisGatewaySet(address symbiosisGateway);
event NativeWrapSet(address _nativeWrap);
constructor(
address _weth,
address _otherToken,
uint256[] memory _pathCountAndSplit,
address[] memory _factories,
address _switchViewAddress,
address _switchEventAddress,
address _symbiosisRouter,
address _symbiosisGateway,
address _feeCollector
) SwitchV2(
_weth,
_otherToken,
_pathCountAndSplit[0],
_pathCountAndSplit[1],
_factories,
_switchViewAddress,
_switchEventAddress,
_feeCollector
)
public
{
symbiosisRouter = _symbiosisRouter;
symbiosisGateway = _symbiosisGateway;
nativeWrap = _weth;
}
function setSymbiosisRouter(address _symbiosisRouter) external onlyOwner {
symbiosisRouter = _symbiosisRouter;
emit SymbiosisRouterSet(_symbiosisRouter);
}
function setSymbiosisGateway(address _symbiosisGateWay) external onlyOwner {
symbiosisGateway = _symbiosisGateWay;
emit SymbiosisGatewaySet(_symbiosisGateWay);
}
function setNativeWrap(address _newNativeWrap) external onlyOwner {
nativeWrap = _newNativeWrap;
emit NativeWrapSet(nativeWrap);
}
function transferBySymbiosis(
TransferArgsSymbiosis 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) {
ISymbiosisRouter(symbiosisRouter).metaRoute{value: amountAfterFee}(
ISymbiosisRouter.MetaRouteTransaction(
transferArgs.symbiosisData.firstSwapCalldata,
transferArgs.symbiosisData.secondSwapCalldata,
transferArgs.symbiosisData.approvedTokens,
transferArgs.symbiosisData.firstDexRouter,
transferArgs.symbiosisData.secondDexRouter,
amountAfterFee,
transferArgs.symbiosisData.nativeIn,
transferArgs.symbiosisData.relayRecipient,
transferArgs.symbiosisData.otherSideCalldata
)
);
} else {
// Give Symbiosis bridge approval
IERC20(transferArgs.fromToken).safeApprove(symbiosisGateway, 0);
IERC20(transferArgs.fromToken).safeApprove(symbiosisGateway, amountAfterFee);
ISymbiosisRouter(symbiosisRouter).metaRoute(
ISymbiosisRouter.MetaRouteTransaction(
transferArgs.symbiosisData.firstSwapCalldata,
transferArgs.symbiosisData.secondSwapCalldata,
transferArgs.symbiosisData.approvedTokens,
transferArgs.symbiosisData.firstDexRouter,
transferArgs.symbiosisData.secondDexRouter,
amountAfterFee,
transferArgs.symbiosisData.nativeIn,
transferArgs.symbiosisData.relayRecipient,
transferArgs.symbiosisData.otherSideCalldata
)
);
}
_emitCrossChainTransferRequest(
transferArgs,
bytes32(0),
amountAfterFee,
msg.sender,
DataTypes.SwapStatus.Succeeded
);
}
function swapBySymbiosis(
SwapArgsSymbiosis 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.aggregatorInfo.length > 0) {
returnAmount = _swapThruAggregator(swapArgs, amountAfterFee);
} else {
(returnAmount, ) = _swapBeforeSymbiosis(swapArgs, amountAfterFee);
}
}
bool isNativeBridgeToken = IERC20(swapArgs.bridgeToken).isETH();
if (isNativeBridgeToken) {
ISymbiosisRouter(symbiosisRouter).metaRoute{value: returnAmount}(
ISymbiosisRouter.MetaRouteTransaction(
swapArgs.symbiosisData.firstSwapCalldata,
swapArgs.symbiosisData.secondSwapCalldata,
swapArgs.symbiosisData.approvedTokens,
swapArgs.symbiosisData.firstDexRouter,
swapArgs.symbiosisData.secondDexRouter,
returnAmount,
swapArgs.symbiosisData.nativeIn,
swapArgs.symbiosisData.relayRecipient,
swapArgs.symbiosisData.otherSideCalldata
)
);
} else {
IERC20(bridgeToken).universalApprove(symbiosisGateway, returnAmount);
ISymbiosisRouter(symbiosisRouter).metaRoute(
ISymbiosisRouter.MetaRouteTransaction(
swapArgs.symbiosisData.firstSwapCalldata,
swapArgs.symbiosisData.secondSwapCalldata,
swapArgs.symbiosisData.approvedTokens,
swapArgs.symbiosisData.firstDexRouter,
swapArgs.symbiosisData.secondDexRouter,
returnAmount,
swapArgs.symbiosisData.nativeIn,
swapArgs.symbiosisData.relayRecipient,
swapArgs.symbiosisData.otherSideCalldata
)
);
}
_emitCrossChainSwapRequest(
swapArgs,
bytes32(0),
returnAmount,
msg.sender,
DataTypes.SwapStatus.Succeeded
);
}
function _swapBeforeSymbiosis(
SwapArgsSymbiosis 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 _swapThruAggregator(
SwapArgsSymbiosis calldata swapArgs,
uint256 amount
)
private
returns (uint256 returnAmount)
{
// break function to avoid stack too deep error
returnAmount = _swapInternalWithAggregator(
IERC20(swapArgs.fromToken),
IERC20(swapArgs.bridgeToken),
amount,
address(this),
swapArgs.aggregatorInfo
);
}
function _emitCrossChainTransferRequest(
TransferArgsSymbiosis 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(
SwapArgsSymbiosis 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 "@openzeppelin/contracts/access/Ownable.sol";
contract OnChainAllowList is Ownable {
mapping(address => bool) public allowlist;
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyInAllowlist(address _addresses) {
_checkAllowlist(_addresses);
_;
}
/**
* @notice Add to allowlist
*/
function addToAllowlist(address address_) external onlyOwner
{
allowlist[address_] = true;
}
/**
* @notice Add to allowlist in batch
*/
function addToAllowlistBatch(address[] calldata addresses) external onlyOwner
{
for (uint i = 0; i < addresses.length; i++) {
allowlist[addresses[i]] = true;
}
}
/**
* @notice Remove from allowlist
*/
function removeFromAllowlist(address address_) external onlyOwner
{
delete allowlist[address_];
}
/**
* @notice Remove from allowlist in batch
*/
function removeFromAllowlistBatch(address[] calldata addresses) external onlyOwner
{
for (uint i = 0; i < addresses.length; i++) {
delete allowlist[addresses[i]];
}
}
/**
* @notice Function with allowlist
*/
function addressInAllowlist(address address_) external view returns(bool)
{
return allowlist[address_];
}
/**
* @dev Throws if address is not in allowlist
*/
function _checkAllowlist(address address_) internal view virtual {
require(allowlist[address_], "Address is not in allowlist");
}
}// 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";
import "../lib/DataTypes.sol";
import "../core/Allowlist.sol";
contract SwitchV2 is Ownable, SwitchRoot, ReentrancyGuard, OnChainAllowList {
using UniswapExchangeLib for IUniswapExchange;
using UniversalERC20 for IERC20;
using SafeERC20 for IERC20;
ISwitchView public switchView;
ISwitchEvent public switchEvent;
address public reward;
address public feeCollector;
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 DefaultSwingCutSet(uint256 defaultSwingCut);
event SwitchEventSet(ISwitchEvent switchEvent);
constructor(
address _weth,
address _otherToken,
uint256 _pathCount,
uint256 _pathSplit,
address[] memory _factories,
address _switchViewAddress,
address _switchEventAddress,
address _feeCollector
) SwitchRoot(_weth, _otherToken, _pathCount, _pathSplit, _factories)
public
{
switchView = ISwitchView(_switchViewAddress);
switchEvent = ISwitchEvent(_switchEventAddress);
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 setDefaultSwingCut(uint256 _defaultSwingCut) external onlyOwner {
defaultSwingCut = _defaultSwingCut;
emit DefaultSwingCutSet(_defaultSwingCut);
}
function setSwitchEvent(ISwitchEvent _switchEvent) external onlyOwner {
switchEvent = _switchEvent;
emit SwitchEventSet(_switchEvent);
}
function getTokenBalance(address token) external view 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 getFeeInfo(
uint256 amount,
address partner,
uint256 partnerFeeRate
)
public
view
returns (
uint256 partnerFee,
uint256 remainAmount
)
{
partnerFee = partnerFeeRate * amount / FEE_BASE;
remainAmount = amount - partnerFee;
}
function _swapInternalWithAggregator(
IERC20 fromToken,
IERC20 destToken,
uint256 amount,
address recipient,
bytes memory aggregatorInfo
)
internal
returns (
uint256 totalAmount
)
{
if (fromToken == destToken) {
revert("it's not allowed to swap with same token");
}
DataTypes.FullSwapData memory fullSwapData = abi.decode(
aggregatorInfo,
(DataTypes.FullSwapData));
_callAggregator(fromToken, amount, fullSwapData);
totalAmount = destToken.universalBalanceOf(address(this));
if (totalAmount > 0) {
destToken.universalTransfer(recipient, totalAmount);
}
switchEvent.emitSwapped(msg.sender, recipient, fromToken, destToken, amount, totalAmount, 0);
}
function _callAggregator(
IERC20 token,
uint256 amount,
DataTypes.FullSwapData memory swapData
)
internal
onlyInAllowlist(swapData.spender) onlyInAllowlist(swapData.swapContract)
{
uint256 ethAmountToTransfert = 0;
if (token.isETH()) {
require(address(this).balance >= amount, "ETH balance is insufficient");
ethAmountToTransfert = amount;
} else {
token.universalApprove(swapData.spender, amount);
}
(bool success,) = swapData.swapContract.call{ value: ethAmountToTransfert }(swapData.swapData);
require(success, "Dex Aggregator 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
)
{
amountAfterFee = amount;
if (partnerFeeRate > 0) {
uint256 swingCut = IFeeCollector(feeCollector).getPartnerSwingCut(partner);
if (swingCut == 0) swingCut = defaultSwingCut;
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;
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;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
interface ISymbiosisRouter {
struct MetaRouteTransaction {
bytes firstSwapCalldata;
bytes secondSwapCalldata;
address[] approvedTokens;
address firstDexRouter;
address secondDexRouter;
uint256 amount;
bool nativeIn;
address relayRecipient;
bytes otherSideCalldata;
}
function metaRoute(
MetaRouteTransaction calldata _metarouteTransaction
) external payable;
}// 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":"_symbiosisRouter","type":"address"},{"internalType":"address","name":"_symbiosisGateway","type":"address"},{"internalType":"address","name":"_feeCollector","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"Forbidden","type":"error"},{"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":"_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":"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":"symbiosisGateway","type":"address"}],"name":"SymbiosisGatewaySet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"symbiosisRouter","type":"address"}],"name":"SymbiosisRouterSet","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":[{"internalType":"address","name":"address_","type":"address"}],"name":"addToAllowlist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"addresses","type":"address[]"}],"name":"addToAllowlistBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"address_","type":"address"}],"name":"addressInAllowlist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"allowlist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":"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":"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":[{"internalType":"address","name":"address_","type":"address"}],"name":"removeFromAllowlist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"addresses","type":"address[]"}],"name":"removeFromAllowlistBatch","outputs":[],"stateMutability":"nonpayable","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":"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":"_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":"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":"_symbiosisGateWay","type":"address"}],"name":"setSymbiosisGateway","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_symbiosisRouter","type":"address"}],"name":"setSymbiosisRouter","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 SwitchV2.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","name":"symbiosisMaker","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"},{"components":[{"internalType":"bytes","name":"firstSwapCalldata","type":"bytes"},{"internalType":"bytes","name":"secondSwapCalldata","type":"bytes"},{"internalType":"address[]","name":"approvedTokens","type":"address[]"},{"internalType":"address","name":"firstDexRouter","type":"address"},{"internalType":"address","name":"secondDexRouter","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bool","name":"nativeIn","type":"bool"},{"internalType":"address","name":"relayRecipient","type":"address"},{"internalType":"bytes","name":"otherSideCalldata","type":"bytes"}],"internalType":"struct SwitchSymbiosis.SymbiosisMetaRouteData","name":"symbiosisData","type":"tuple"},{"internalType":"bytes","name":"aggregatorInfo","type":"bytes"}],"internalType":"struct SwitchSymbiosis.SwapArgsSymbiosis","name":"swapArgs","type":"tuple"}],"name":"swapBySymbiosis","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":[],"name":"symbiosisGateway","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbiosisRouter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"fromToken","type":"address"},{"internalType":"address","name":"destToken","type":"address"},{"internalType":"address","name":"symbiosisMaker","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"},{"components":[{"internalType":"bytes","name":"firstSwapCalldata","type":"bytes"},{"internalType":"bytes","name":"secondSwapCalldata","type":"bytes"},{"internalType":"address[]","name":"approvedTokens","type":"address[]"},{"internalType":"address","name":"firstDexRouter","type":"address"},{"internalType":"address","name":"secondDexRouter","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bool","name":"nativeIn","type":"bool"},{"internalType":"address","name":"relayRecipient","type":"address"},{"internalType":"bytes","name":"otherSideCalldata","type":"bytes"}],"internalType":"struct SwitchSymbiosis.SymbiosisMetaRouteData","name":"symbiosisData","type":"tuple"}],"internalType":"struct SwitchSymbiosis.TransferArgsSymbiosis","name":"transferArgs","type":"tuple"}],"name":"transferBySymbiosis","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
6080604052600180546001600160a01b031990811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee179091556002805490911690556105dc600f553480156200004957600080fd5b5060405162004bac38038062004bac8339810160408190526200006c9162000374565b888888600081518110620000845762000084620004c4565b602002602001015189600181518110620000a257620000a2620004c4565b6020026020010151898989878787878787620000cd620000c76200021860201b60201c565b6200021c565b600680546001600160a01b038088166001600160a01b031992831617909255600780549287169290911691909117905560048390556005829055805160035560005b815181101562000180576008828281518110620001305762000130620004c4565b60209081029190910181015182546001810184556000938452919092200180546001600160a01b0319166001600160a01b03909216919091179055806200017781620004da565b9150506200010f565b505060016009555050600b80546001600160a01b03199081166001600160a01b0397881617909155600c80548216958716959095179094555050600e80548316918416919091179055600d8054339083161790556010805482169a83169a909a17909955601180548a16988216989098179097555050601280549096169b9094169a909a179093555062000504975050505050505050565b3390565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146200028457600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715620002ca57620002ca62000289565b604052919050565b60006001600160401b03821115620002ee57620002ee62000289565b5060051b60200190565b600082601f8301126200030a57600080fd5b81516020620003236200031d83620002d2565b6200029f565b82815260059290921b840181019181810190868411156200034357600080fd5b8286015b8481101562000369576200035b816200026c565b835291830191830162000347565b509695505050505050565b60008060008060008060008060006101208a8c0312156200039457600080fd5b6200039f8a6200026c565b9850620003af60208b016200026c565b60408b01519098506001600160401b0380821115620003cd57600080fd5b818c0191508c601f830112620003e257600080fd5b8151620003f36200031d82620002d2565b8082825260208201915060208360051b86010192508f8311156200041657600080fd5b6020850194505b828510156200043a5784518252602094850194909101906200041d565b60608f0151909b5093505050808211156200045457600080fd5b50620004638c828d01620002f8565b9650506200047460808b016200026c565b94506200048460a08b016200026c565b93506200049460c08b016200026c565b9250620004a460e08b016200026c565b9150620004b56101008b016200026c565b90509295985092959850929598565b634e487b7160e01b600052603260045260246000fd5b6000600019821415620004fd57634e487b7160e01b600052601160045260246000fd5b5060010190565b61469880620005146000396000f3fe6080604052600436106102725760003560e01c806388d2755b1161014f578063b4c76fe0116100c1578063e772ff371161007a578063e772ff3714610773578063ea15afc3146107ac578063ecefc705146107cc578063f2fde38b146107e2578063f640d50814610802578063f8e86ece1461082257610272565b8063b4c76fe0146106ab578063c415b95c146106cb578063c93d732d146106eb578063d08508bf146106fe578063d6821ed81461071e578063e5932c401461075357610272565b8063a42dce8011610113578063a42dce80146105d5578063a734f06e146105f5578063a7cd52cb14610615578063a85f329814610655578063ab30469514610675578063b128baba1461068b57610272565b806388d2755b1461054b5780638c7351571461056b5780638c821e901461058b5780638da5cb5b146105a157806390f3f208146105bf57610272565b8063538ba4f9116101e85780635c3d258f116101ac5780635c3d258f146104885780635da93d7e146104a85780636076a0b4146104c857806363c15b34146104f6578063672383c414610516578063715018a61461053657610272565b8063538ba4f9146103e857806353fd7bf11461040857806356230573146104285780635b5a66a7146104485780635b769f3c1461046857610272565b80633aecd0e31161023a5780633aecd0e3146103245780633fc8cef314610352578063433b3c05146103725780634399fa5614610392578063457bfa2f146103b257806352b721f8146103d257610272565b806305b4859814610281578063228cb7331461029457806323a9495e146102d157806330a5199f146102f157806331428a8714610304575b3332141561027f57600080fd5b005b61027f61028f366004613ba0565b610842565b3480156102a057600080fd5b50600d546102b4906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156102dd57600080fd5b5061027f6102ec366004613bdb565b610f0d565b61027f6102ff366004613bf4565b610f51565b34801561031057600080fd5b50600b546102b4906001600160a01b031681565b34801561033057600080fd5b5061034461033f366004613c44565b6115aa565b6040519081526020016102c8565b34801561035e57600080fd5b506006546102b4906001600160a01b031681565b34801561037e57600080fd5b506007546102b4906001600160a01b031681565b34801561039e57600080fd5b50600c546102b4906001600160a01b031681565b3480156103be57600080fd5b506012546102b4906001600160a01b031681565b3480156103de57600080fd5b50610344600f5481565b3480156103f457600080fd5b506002546102b4906001600160a01b031681565b34801561041457600080fd5b5061027f610423366004613c44565b6115c5565b34801561043457600080fd5b5061027f610443366004613c61565b61161b565b34801561045457600080fd5b5061027f610463366004613c44565b611691565b34801561047457600080fd5b5061027f610483366004613c44565b6116e7565b34801561049457600080fd5b5061027f6104a3366004613bdb565b61173d565b3480156104b457600080fd5b5061027f6104c3366004613c44565b61177a565b3480156104d457600080fd5b506104e86104e3366004613cd5565b6117a3565b6040516102c8929190613d1b565b34801561050257600080fd5b5061027f610511366004613c44565b61184c565b34801561052257600080fd5b506102b4610531366004613bdb565b6118a2565b34801561054257600080fd5b5061027f6118cc565b34801561055757600080fd5b506010546102b4906001600160a01b031681565b34801561057757600080fd5b5061027f610586366004613c44565b6118e0565b34801561059757600080fd5b5061034460045481565b3480156105ad57600080fd5b506000546001600160a01b03166102b4565b3480156105cb57600080fd5b5061034460055481565b3480156105e157600080fd5b5061027f6105f0366004613c44565b611936565b34801561060157600080fd5b506001546102b4906001600160a01b031681565b34801561062157600080fd5b50610645610630366004613c44565b600a6020526000908152604090205460ff1681565b60405190151581526020016102c8565b34801561066157600080fd5b5061027f610670366004613bdb565b61198c565b34801561068157600080fd5b5061034460035481565b34801561069757600080fd5b506011546102b4906001600160a01b031681565b3480156106b757600080fd5b5061027f6106c6366004613c44565b6119c9565b3480156106d757600080fd5b50600e546102b4906001600160a01b031681565b6103446106f9366004613d69565b611a1f565b34801561070a57600080fd5b5061027f610719366004613c61565b611f29565b34801561072a57600080fd5b5061073e610739366004613da4565b611fa3565b604080519283526020830191909152016102c8565b34801561075f57600080fd5b5061027f61076e366004613c44565b611fd3565b34801561077f57600080fd5b5061064561078e366004613c44565b6001600160a01b03166000908152600a602052604090205460ff1690565b3480156107b857600080fd5b5061027f6107c7366004613e6d565b612029565b3480156107d857600080fd5b5061034461271081565b3480156107ee57600080fd5b5061027f6107fd366004613c44565b6120e7565b34801561080e57600080fd5b5061027f61081d366004613f00565b61215d565b34801561082e57600080fd5b5061027f61083d366004613c44565b61217f565b61084a6121ab565b60008160c00135116108775760405162461bcd60e51b815260040161086e90613f42565b60405180910390fd5b8061010001354614156108cc5760405162461bcd60e51b815260206004820152601d60248201527f43616e6e6f742062726964676520746f2073616d65206e6574776f726b000000604482015260640161086e565b6108f4333060c08401356108e36020860186613c44565b6001600160a01b0316929190612205565b6000806109266109076020850185613c44565b60c085013561091c60a0870160808801613c44565b8660a001356122f7565b9050600061093a6040850160208601613c44565b905061094c6040850160208601613c44565b6001600160a01b03166109626020860186613c44565b6001600160a01b03161415610979578192506109b0565b60006109896101a0860186613f86565b905011156109a25761099b848361256d565b92506109b0565b6109ac84836125e0565b5092505b60006109d36109c56040870160208801613c44565b6001600160a01b03166127f1565b90508015610c5a576010546040805161012081019091526001600160a01b039091169063a11b119890869080610a0d6101808b018b613fd3565b610a179080613f86565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250602001610a5f6101808b018b613fd3565b610a6d906020810190613f86565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250602001610ab56101808b018b613fd3565b610ac3906040810190613ff4565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250602001610b086101808b018b613fd3565b610b19906080810190606001613c44565b6001600160a01b03168152602001610b356101808b018b613fd3565b610b469060a0810190608001613c44565b6001600160a01b0316815260208101899052604001610b696101808b018b613fd3565b610b7a9060e081019060c00161404b565b15158152602001610b8f6101808b018b613fd3565b610ba19061010081019060e001613c44565b6001600160a01b03168152602001610bbd6101808b018b613fd3565b610bcc90610100810190613f86565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509152506040516001600160e01b031960e085901b168152610c239190600401614104565b6000604051808303818588803b158015610c3c57600080fd5b505af1158015610c50573d6000803e3d6000fd5b5050505050610eed565b601154610c74906001600160a01b0384811691168661282a565b6010546040805161012081019091526001600160a01b039091169063a11b11989080610ca46101808a018a613fd3565b610cae9080613f86565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250602001610cf66101808a018a613fd3565b610d04906020810190613f86565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250602001610d4c6101808a018a613fd3565b610d5a906040810190613ff4565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250602001610d9f6101808a018a613fd3565b610db0906080810190606001613c44565b6001600160a01b03168152602001610dcc6101808a018a613fd3565b610ddd9060a0810190608001613c44565b6001600160a01b0316815260208101889052604001610e006101808a018a613fd3565b610e119060e081019060c00161404b565b15158152602001610e266101808a018a613fd3565b610e389061010081019060e001613c44565b6001600160a01b03168152602001610e546101808a018a613fd3565b610e6390610100810190613f86565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509152506040516001600160e01b031960e084901b168152610eba9190600401614104565b600060405180830381600087803b158015610ed457600080fd5b505af1158015610ee8573d6000803e3d6000fd5b505050505b610efc85600086336001612905565b50505050610f0a6001600955565b50565b610f156129bc565b60058190556040518181527f11e8ee12d79dc7314b845f4e82465af5bd3d2214081526061af36de8364eaa2e906020015b60405180910390a150565b610f596121ab565b60008160a0013511610f7d5760405162461bcd60e51b815260040161086e90613f42565b610f8e610100820160e083016141e8565b6001600160401b0316461415610fe65760405162461bcd60e51b815260206004820152601d60248201527f43616e6e6f742062726964676520746f2073616d65206e6574776f726b000000604482015260640161086e565b610ffd333060a08401356108e36020860186613c44565b600061102e61100f6020840184613c44565b60a08401356110246080860160608701613c44565b85608001356122f7565b905060006110426109c56020850185613c44565b905080156112c9576010546040805161012081019091526001600160a01b039091169063a11b11989084908061107c610140890189613fd3565b6110869080613f86565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050908252506020016110ce610140890189613fd3565b6110dc906020810190613f86565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250602001611124610140890189613fd3565b611132906040810190613ff4565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250602001611177610140890189613fd3565b611188906080810190606001613c44565b6001600160a01b031681526020016111a4610140890189613fd3565b6111b59060a0810190608001613c44565b6001600160a01b03168152602081018790526040016111d8610140890189613fd3565b6111e99060e081019060c00161404b565b151581526020016111fe610140890189613fd3565b6112109061010081019060e001613c44565b6001600160a01b0316815260200161122c610140890189613fd3565b61123b90610100810190613f86565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509152506040516001600160e01b031960e085901b1681526112929190600401614104565b6000604051808303818588803b1580156112ab57600080fd5b505af11580156112bf573d6000803e3d6000fd5b505050505061158f565b6011546112f8906001600160a01b031660006112e86020870187613c44565b6001600160a01b03169190612a16565b601154611316906001600160a01b0316836112e86020870187613c44565b6010546040805161012081019091526001600160a01b039091169063a11b11989080611346610140880188613fd3565b6113509080613f86565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250602001611398610140880188613fd3565b6113a6906020810190613f86565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050908252506020016113ee610140880188613fd3565b6113fc906040810190613ff4565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250602001611441610140880188613fd3565b611452906080810190606001613c44565b6001600160a01b0316815260200161146e610140880188613fd3565b61147f9060a0810190608001613c44565b6001600160a01b03168152602081018690526040016114a2610140880188613fd3565b6114b39060e081019060c00161404b565b151581526020016114c8610140880188613fd3565b6114da9061010081019060e001613c44565b6001600160a01b031681526020016114f6610140880188613fd3565b61150590610100810190613f86565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509152506040516001600160e01b031960e084901b16815261155c9190600401614104565b600060405180830381600087803b15801561157657600080fd5b505af115801561158a573d6000803e3d6000fd5b505050505b61159e83600084336001612b6d565b5050610f0a6001600955565b60006115bf6001600160a01b03831630612be8565b92915050565b6115cd6129bc565b600c80546001600160a01b0319166001600160a01b0383169081179091556040519081527f35e63b7fefc2b1fb2ed78adeed6688b187514d96c2d7d56222e52f3e41c2fb2f90602001610f46565b6116236129bc565b60005b8181101561168c57600a600084848481811061164457611644614211565b90506020020160208101906116599190613c44565b6001600160a01b031681526020810191909152604001600020805460ff19169055806116848161423d565b915050611626565b505050565b6116996129bc565b601280546001600160a01b0319166001600160a01b0383169081179091556040519081527fb3bfb91ec7a3f9a14278772a47b34685afb9cdd7ef683fab8a790ccdd667264790602001610f46565b6116ef6129bc565b600680546001600160a01b0319166001600160a01b0383169081179091556040519081527f41408be49f75701fe4bb8484ce88d68f1d82e03cb4eb44263b6682ce2dbd32f090602001610f46565b6117456129bc565b600f8190556040518181527f8f817f25bf47abe304b519d80d1a633064758c57d280731736fe82ad20816c5590602001610f46565b6117826129bc565b6001600160a01b03166000908152600a60205260409020805460ff19169055565b600b5460405163181da82d60e21b81526001600160a01b03868116600483015285811660248301526044820185905260648201849052600092606092911690636076a0b49060840160006040518083038186803b15801561180357600080fd5b505afa158015611817573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261183f9190810190614258565b9097909650945050505050565b6118546129bc565b601080546001600160a01b0319166001600160a01b0383169081179091556040519081527f04ba9cd50e738032e7c0417ffbbc8dbd97d0a808f7d40b33d37b40211b7b37a790602001610f46565b600881815481106118b257600080fd5b6000918252602090912001546001600160a01b0316905081565b6118d46129bc565b6118de6000612c82565b565b6118e86129bc565b601180546001600160a01b0319166001600160a01b0383169081179091556040519081527f350be0988d0dcfc45d1beb115379cf4bd8b76411a13b291cfb5840ac4246ecc190602001610f46565b61193e6129bc565b600e80546001600160a01b0319166001600160a01b0383169081179091556040519081527f12e1d17016b94668449f97876f4a8d5cc2c19f314db337418894734037cc19d490602001610f46565b6119946129bc565b60048190556040518181527f70f24e12a9db25e0d80cbcde19ffef47d6a7c52c1089db4c71e53ce1856577fc90602001610f46565b6119d16129bc565b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527f17780f3919f73af11f29e4157534858a06c91294d64b679fe4e49340122cd32290602001610f46565b6000611a296121ab565b816080013582606001351015611a9f5760405162461bcd60e51b815260206004820152603560248201527f657870656374656452657475726e206d75737420626520657175616c206f72206044820152743630b933b2b9103a3430b71036b4b72932ba3ab93760591b606482015260840161086e565b611aaf6040830160208401613c44565b6001600160a01b0316611ac56020840184613c44565b6001600160a01b03161415611aec5760405162461bcd60e51b815260040161086e906142f4565b60008060005b611b00610100860186613ff4565b9050811015611b7e576000611b19610100870187613ff4565b83818110611b2957611b29614211565b905060200201351115611b6c57611b44610100860186613ff4565b82818110611b5457611b54614211565b9050602002013583611b66919061433c565b92508091505b80611b768161423d565b915050611af2565b5081611bdd57611b946109c56020860186613c44565b15611bd05760405133903480156108fc02916000818181858888f19350505050158015611bc5573d6000803e3d6000fd5b503492505050611f1a565b5050506040810135611f1a565b611bf4333060408701356108e36020890189613c44565b6000611c25611c066020870187613c44565b6040870135611c1b60c0890160a08a01613c44565b8860c001356122f7565b9050611c91611c38610100870187613ff4565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250859250879150869050611c7c60208b018b613c44565b611c8c60408c0160208d01613c44565b612cd2565b93508315611eab578460800135841015611cf95760405162461bcd60e51b8152602060048201526024808201527f5377697463683a2052657475726e20616d6f756e7420776173206e6f7420656e6044820152630deeaced60e31b606482015260840161086e565b8460600135841115611e1b57611d3e611d19610100870160e08801613c44565b6060870135611d2e6040890160208a01613c44565b6001600160a01b03169190612f02565b50600d54611d6d906001600160a01b0316611d5d606088013587614354565b611d2e6040890160208a01613c44565b50600c546001600160a01b031663391fdc2433611d91610100890160e08a01613c44565b611d9e60208a018a613c44565b611dae60408b0160208c01613c44565b60408b013560608c0135611dc2818d614354565b6040518863ffffffff1660e01b8152600401611de4979695949392919061436b565b600060405180830381600087803b158015611dfe57600080fd5b505af1158015611e12573d6000803e3d6000fd5b50505050611f16565b611e40611e2f610100870160e08801613c44565b85611d2e6040890160208a01613c44565b50600c546001600160a01b031663391fdc2433611e64610100890160e08a01613c44565b611e7160208a018a613c44565b611e8160408b0160208c01613c44565b8a604001358a60006040518863ffffffff1660e01b8152600401611de4979695949392919061436b565b6040850135611ed030611ec16020890189613c44565b6001600160a01b031690612be8565b1115611ef257611eec336040870135611d2e6020890189613c44565b50611f16565b611f1433611f0730611ec160208a018a613c44565b611d2e6020890189613c44565b505b5050505b611f246001600955565b919050565b611f316129bc565b60005b8181101561168c576001600a6000858585818110611f5457611f54614211565b9050602002016020810190611f699190613c44565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580611f9b8161423d565b915050611f34565b600080612710611fb386856143af565b611fbd91906143e4565b9150611fc98286614354565b9050935093915050565b611fdb6129bc565b600d80546001600160a01b0319166001600160a01b0383169081179091556040519081527f53a596d7be747a5a4f4d39a6a36476d2eed407c93f6f2ba8a96c8b971240d5cd90602001610f46565b6120316129bc565b805160036000828254612044919061433c565b90915550600090505b81518110156120b757600882828151811061206a5761206a614211565b60209081029190910181015182546001810184556000938452919092200180546001600160a01b0319166001600160a01b03909216919091179055806120af8161423d565b91505061204d565b507fbbc63a7f378af7e269ef19f3fe0d08f044c91ee72930c0d045a58be58580f3d381604051610f4691906143f8565b6120ef6129bc565b6001600160a01b0381166121545760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161086e565b610f0a81612c82565b6121656129bc565b6121796001600160a01b0384168284612f02565b50505050565b6121876129bc565b6001600160a01b03166000908152600a60205260409020805460ff19166001179055565b600260095414156121fe5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161086e565b6002600955565b8061220f57612179565b612218846127f1565b156122e2576001600160a01b038316331480156122355750803410155b6122955760405162461bcd60e51b815260206004820152602b60248201527f57726f6e6720757365616765206f66204554482e756e6976657273616c54726160448201526a6e7366657246726f6d282960a81b606482015260840161086e565b6001600160a01b03821630146122dd576040516001600160a01b0383169082156108fc029083906000818181858888f193505050501580156122db573d6000803e3d6000fd5b505b612179565b6121796001600160a01b038516848484612f7d565b82811561256557600e54604051637b8c4cdf60e01b81526001600160a01b0385811660048301526000921690637b8c4cdf9060240160206040518083038186803b15801561234457600080fd5b505afa158015612358573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061237c919061440b565b9050806123885750600f545b6000612396612710806143af565b826123a188876143af565b6123ab91906143af565b6123b591906143e4565b90506000816127106123c789886143af565b6123d191906143e4565b6123db9190614354565b90506123ef886001600160a01b03166127f1565b1561248257600e546001600160a01b031663eedd56e161240f848461433c565b6040516001600160e01b031960e084901b1681526001600160a01b03808d16600483015260248201869052604482018790528a1660648201526084016000604051808303818588803b15801561246457600080fd5b505af1158015612478573d6000803e3d6000fd5b505050505061253e565b600e5461249d906001600160a01b038a811691166000612a16565b600e546124c8906001600160a01b03166124b7848461433c565b6001600160a01b038b169190612a16565b600e5460405163eedd56e160e01b81526001600160a01b038a81166004830152602482018490526044820185905288811660648301529091169063eedd56e190608401600060405180830381600087803b15801561252557600080fd5b505af1158015612539573d6000803e3d6000fd5b505050505b61271061254b88876143af565b61255591906143e4565b61255f9088614354565b93505050505b949350505050565b60006125d961257f6020850185613c44565b61258f6040860160208701613c44565b843061259f6101a0890189613f86565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612fb592505050565b9392505050565b60008080805b6125f4610120870187613ff4565b905081101561267257600061260d610120880188613ff4565b8381811061261d5761261d614211565b90506020020135111561266057612638610120870187613ff4565b8281811061264857612648614211565b905060200201358361265a919061433c565b92508091505b8061266a8161423d565b9150506125e6565b50600082116126c35760405162461bcd60e51b815260206004820152601a60248201527f696e76616c696420646973747269627574696f6e20706172616d000000000000604482015260640161086e565b6127186126d4610120870187613ff4565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250889250869150859050611c7c60208b018b613c44565b9250600083116127615760405162461bcd60e51b81526020600482015260146024820152730a6eec2e040ccc2d2d8cac840cce4deda40c8caf60631b604482015260640161086e565b600c546001600160a01b031663391fdc24333061278160208a018a613c44565b61279160408b0160208c01613c44565b898960006040518863ffffffff1660e01b81526004016127b7979695949392919061436b565b600060405180830381600087803b1580156127d157600080fd5b505af11580156127e5573d6000803e3d6000fd5b50505050509250929050565b60006001600160a01b03821615806115bf57506001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1492915050565b612833836127f1565b61168c57806128515761168c6001600160a01b038416836000612a16565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e9060440160206040518083038186803b15801561289c57600080fd5b505afa1580156128b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128d4919061440b565b905080156128f1576128f16001600160a01b038516846000612a16565b6121796001600160a01b0385168484612a16565b600c546001600160a01b0316630aea28c7610140870135866101608901358661293160208c018c613c44565b61294160408d0160208e01613c44565b61295160608e0160408f01613c44565b8d60c001358c8f60e001358c6040518c63ffffffff1660e01b81526004016129839b9a99989796959493929190614424565b600060405180830381600087803b15801561299d57600080fd5b505af11580156129b1573d6000803e3d6000fd5b505050505050505050565b6000546001600160a01b031633146118de5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161086e565b801580612a9f5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b158015612a6557600080fd5b505afa158015612a79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a9d919061440b565b155b612b0a5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b606482015260840161086e565b6040516001600160a01b03831660248201526044810182905261168c90849063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526130b6565b600c546001600160a01b0316630aea28c76101008701358661012089013586612b9960208c018c613c44565b612ba660208d018d613c44565b612bb660408e0160208f01613c44565b8d60a001358c8f60c001358c6040518c63ffffffff1660e01b81526004016129839b9a99989796959493929190614424565b6000612bf3836127f1565b15612c0957506001600160a01b038116316115bf565b6040516370a0823160e01b81526001600160a01b0383811660048301528416906370a082319060240160206040518083038186803b158015612c4a57600080fd5b505afa158015612c5e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125d9919061440b565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000600454600354612ce491906143af565b87511115612d645760405162461bcd60e51b815260206004820152604160248201527f5377697463683a20446973747269627574696f6e2061727261792073686f756c60448201527f64206e6f742065786365656420666163746f726965732061727261792073697a6064820152606560f81b608482015260a40161086e565b856000805b8951811015612ef557898181518110612d8457612d84614211565b602002602001015160001415612d9957612ee3565b6000888b8381518110612dae57612dae614211565b60200260200101518b612dc191906143af565b612dcb91906143e4565b905087821415612dd85750825b612de28185614354565b935060045482612df291906144ad565b612e3d57612e36878783600860045487612e0c91906143e4565b81548110612e1c57612e1c614211565b6000918252602090912001546001600160a01b031661318b565b9250612ed5565b600454612e4a90836144ad565b60011415612e9257612e36878783600860045487612e6891906143e4565b81548110612e7857612e78614211565b6000918252602090912001546001600160a01b03166131a2565b612ed2878783600860045487612ea891906143e4565b81548110612eb857612eb8614211565b6000918252602090912001546001600160a01b03166131bf565b92505b612edf838661433c565b9450505b80612eed8161423d565b915050612d69565b5050509695505050505050565b600081612f11575060016125d9565b612f1a846127f1565b15612f5f576040516001600160a01b0384169083156108fc029084906000818181858888f19350505050158015612f55573d6000803e3d6000fd5b50600190506125d9565b612f736001600160a01b03851684846131dc565b5060019392505050565b6040516001600160a01b03808516602483015283166044820152606481018290526121799085906323b872dd60e01b90608401612b36565b6000846001600160a01b0316866001600160a01b03161415612fe95760405162461bcd60e51b815260040161086e906142f4565b600082806020019051810190612fff91906144c1565b905061300c87868361320c565b61301f6001600160a01b03871630612be8565b9150811561303d5761303b6001600160a01b0387168584612f02565b505b600c54604051630e47f70960e21b81526001600160a01b039091169063391fdc249061307a90339088908c908c908c908a9060009060040161436b565b600060405180830381600087803b15801561309457600080fd5b505af11580156130a8573d6000803e3d6000fd5b505050505095945050505050565b600061310b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661336e9092919063ffffffff16565b905080516000148061312c57508080602001905181019061312c91906145a7565b61168c5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161086e565b60006131998585858561337d565b95945050505050565b6006546000906131999086906001600160a01b03168686866137e9565b6007546000906131999086906001600160a01b03168686866137e9565b6040516001600160a01b03831660248201526044810182905261168c90849063a9059cbb60e01b90606401612b36565b806020015161321a8161380c565b81516132258161380c565b6000613239866001600160a01b03166127f1565b15613295578447101561328e5760405162461bcd60e51b815260206004820152601b60248201527f4554482062616c616e636520697320696e73756666696369656e740000000000604482015260640161086e565b50836132af565b60208401516132af906001600160a01b038816908761282a565b600084600001516001600160a01b03168286604001516040516132d291906145c4565b60006040518083038185875af1925050503d806000811461330f576040519150601f19603f3d011682016040523d82523d6000602084013e613314565b606091505b50509050806133655760405162461bcd60e51b815260206004820152601f60248201527f4465782041676772656761746f7220657865637574696f6e206661696c656400604482015260640161086e565b50505050505050565b60606125658484600085613874565b6000613391856001600160a01b03166127f1565b1561340057600660009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0846040518263ffffffff1660e01b81526004016000604051808303818588803b1580156133e657600080fd5b505af11580156133fa573d6000803e3d6000fd5b50505050505b6000613414866001600160a01b03166127f1565b61341e578561342b565b6006546001600160a01b03165b90506000613441866001600160a01b03166127f1565b61344b5785613458565b6006546001600160a01b03165b60405163e6a4390560e01b81526001600160a01b038481166004830152808316602483015291925060009186169063e6a439059060440160206040518083038186803b1580156134a757600080fd5b505afa1580156134bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134df91906145d6565b90506000806134f96001600160a01b03841686868b61394f565b91975092509050811561355e57826001600160a01b031663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561354157600080fd5b505af1158015613555573d6000803e3d6000fd5b505050506135d2565b80156135d25760405163bc25cf7760e01b81527346fd07da395799f113a7584563b8cb886f33c2bc60048201526001600160a01b0384169063bc25cf7790602401600060405180830381600087803b1580156135b957600080fd5b505af11580156135cd573d6000803e3d6000fd5b505050505b6135e66001600160a01b038616848a612f02565b50836001600160a01b0316856001600160a01b0316101561367b5760405163022c0d9f60e01b8152600060048201819052602482018890523060448301526080606483015260848201526001600160a01b0384169063022c0d9f9060a401600060405180830381600087803b15801561365e57600080fd5b505af1158015613672573d6000803e3d6000fd5b505050506136f1565b60405163022c0d9f60e01b8152600481018790526000602482018190523060448301526080606483015260848201526001600160a01b0384169063022c0d9f9060a401600060405180830381600087803b1580156136d857600080fd5b505af11580156136ec573d6000803e3d6000fd5b505050505b613703896001600160a01b03166127f1565b156137dc576006546040516370a0823160e01b81523060048201526001600160a01b0390911690632e1a7d4d9082906370a082319060240160206040518083038186803b15801561375357600080fd5b505afa158015613767573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061378b919061440b565b6040518263ffffffff1660e01b81526004016137a991815260200190565b600060405180830381600087803b1580156137c357600080fd5b505af11580156137d7573d6000803e3d6000fd5b505050505b5050505050949350505050565b600061380285856137fc8989888861337d565b8561337d565b9695505050505050565b6001600160a01b0381166000908152600a602052604090205460ff16610f0a5760405162461bcd60e51b815260206004820152601b60248201527f41646472657373206973206e6f7420696e20616c6c6f776c6973740000000000604482015260640161086e565b6060824710156138d55760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161086e565b600080866001600160a01b031685876040516138f191906145c4565b60006040518083038185875af1925050503d806000811461392e576040519150601f19603f3d011682016040523d82523d6000602084013e613933565b606091505b509150915061394487838387613aea565b979650505050505050565b60008080806139676001600160a01b03881689612be8565b9050600061397e6001600160a01b0388168a612be8565b90506000808a6001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b1580156139bc57600080fd5b505afa1580156139d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139f4919061460a565b5091509150886001600160a01b03168a6001600160a01b03161115613a1557905b816001600160701b0316841080613a345750806001600160701b031683105b955085158015613a5e5750816001600160701b0316841180613a5e5750806001600160701b031683115b94506000613a6e896103e56143af565b90506000613a8585846001600160701b0316613b60565b613a8f90836143af565b9050600082613aa788876001600160701b0316613b60565b613ab3906103e86143af565b613abd919061433c565b90508015613ad457613acf81836143e4565b613ad7565b60005b9950505050505050509450945094915050565b60608315613b56578251613b4f576001600160a01b0385163b613b4f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161086e565b5081612565565b6125658383613b76565b6000818310613b6f57816125d9565b5090919050565b815115613b865781518083602001fd5b8060405162461bcd60e51b815260040161086e919061464f565b600060208284031215613bb257600080fd5b81356001600160401b03811115613bc857600080fd5b82016101c081850312156125d957600080fd5b600060208284031215613bed57600080fd5b5035919050565b600060208284031215613c0657600080fd5b81356001600160401b03811115613c1c57600080fd5b820161016081850312156125d957600080fd5b6001600160a01b0381168114610f0a57600080fd5b600060208284031215613c5657600080fd5b81356125d981613c2f565b60008060208385031215613c7457600080fd5b82356001600160401b0380821115613c8b57600080fd5b818501915085601f830112613c9f57600080fd5b813581811115613cae57600080fd5b8660208260051b8501011115613cc357600080fd5b60209290920196919550909350505050565b60008060008060808587031215613ceb57600080fd5b8435613cf681613c2f565b93506020850135613d0681613c2f565b93969395505050506040820135916060013590565b6000604082018483526020604081850152818551808452606086019150828701935060005b81811015613d5c57845183529383019391830191600101613d40565b5090979650505050505050565b600060208284031215613d7b57600080fd5b81356001600160401b03811115613d9157600080fd5b820161012081850312156125d957600080fd5b600080600060608486031215613db957600080fd5b833592506020840135613dcb81613c2f565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b604051606081016001600160401b0381118282101715613e1457613e14613ddc565b60405290565b604051601f8201601f191681016001600160401b0381118282101715613e4257613e42613ddc565b604052919050565b60006001600160401b03821115613e6357613e63613ddc565b5060051b60200190565b60006020808385031215613e8057600080fd5b82356001600160401b03811115613e9657600080fd5b8301601f81018513613ea757600080fd5b8035613eba613eb582613e4a565b613e1a565b81815260059190911b82018301908381019087831115613ed957600080fd5b928401925b82841015613944578335613ef181613c2f565b82529284019290840190613ede565b600080600060608486031215613f1557600080fd5b8335613f2081613c2f565b9250602084013591506040840135613f3781613c2f565b809150509250925092565b60208082526024908201527f54686520616d6f756e74206d7573742062652067726561746572207468616e206040820152637a65726f60e01b606082015260800190565b6000808335601e19843603018112613f9d57600080fd5b8301803591506001600160401b03821115613fb757600080fd5b602001915036819003821315613fcc57600080fd5b9250929050565b6000823561011e19833603018112613fea57600080fd5b9190910192915050565b6000808335601e1984360301811261400b57600080fd5b8301803591506001600160401b0382111561402557600080fd5b6020019150600581901b3603821315613fcc57600080fd5b8015158114610f0a57600080fd5b60006020828403121561405d57600080fd5b81356125d98161403d565b60005b8381101561408357818101518382015260200161406b565b838111156121795750506000910152565b600081518084526140ac816020860160208601614068565b601f01601f19169290920160200192915050565b600081518084526020808501945080840160005b838110156140f95781516001600160a01b0316875295820195908201906001016140d4565b509495945050505050565b6020815260008251610120806020850152614123610140850183614094565b91506020850151601f19808685030160408701526141418483614094565b9350604087015191508086850301606087015261415e84836140c0565b93506060870151915061417c60808701836001600160a01b03169052565b60808701516001600160a01b03811660a0880152915060a087015160c087015260c087015191506141b160e087018315159052565b60e087015191506101006141cf818801846001600160a01b03169052565b8701518685039091018387015290506138028382614094565b6000602082840312156141fa57600080fd5b81356001600160401b03811681146125d957600080fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060001982141561425157614251614227565b5060010190565b6000806040838503121561426b57600080fd5b825191506020808401516001600160401b0381111561428957600080fd5b8401601f8101861361429a57600080fd5b80516142a8613eb582613e4a565b81815260059190911b820183019083810190888311156142c757600080fd5b928401925b828410156142e5578351825292840192908401906142cc565b80955050505050509250929050565b60208082526028908201527f69742773206e6f7420616c6c6f77656420746f2073776170207769746820736160408201526736b2903a37b5b2b760c11b606082015260800190565b6000821982111561434f5761434f614227565b500190565b60008282101561436657614366614227565b500390565b6001600160a01b03978816815295871660208701529386166040860152919094166060840152608083019390935260a082019290925260c081019190915260e00190565b60008160001904831182151516156143c9576143c9614227565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826143f3576143f36143ce565b500490565b6020815260006125d960208301846140c0565b60006020828403121561441d57600080fd5b5051919050565b8b8152602081018b9052604081018a90526001600160a01b038981166060830152888116608083015287811660a0830152861660c082015260e081018590526101008101849052610120810183905261016081016004831061449657634e487b7160e01b600052602160045260246000fd5b826101408301529c9b505050505050505050505050565b6000826144bc576144bc6143ce565b500690565b600060208083850312156144d457600080fd5b82516001600160401b03808211156144eb57600080fd5b90840190606082870312156144ff57600080fd5b614507613df2565b825161451281613c2f565b81528284015161452181613c2f565b8185015260408301518281111561453757600080fd5b80840193505086601f84011261454c57600080fd5b82518281111561455e5761455e613ddc565b614570601f8201601f19168601613e1a565b9250808352878582860101111561458657600080fd5b61459581868501878701614068565b50604081019190915295945050505050565b6000602082840312156145b957600080fd5b81516125d98161403d565b60008251613fea818460208701614068565b6000602082840312156145e857600080fd5b81516125d981613c2f565b80516001600160701b0381168114611f2457600080fd5b60008060006060848603121561461f57600080fd5b614628846145f3565b9250614636602085016145f3565b9150604084015163ffffffff81168114613f3757600080fd5b6020815260006125d9602083018461409456fea2646970667358221220b22866a01c7c43033d57b70fb66cffd561e76fa66da655b15116d635008cbb4f64736f6c6343000809003300000000000000000000000053000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000001800000000000000000000000005e8ac2dc9f31bbab954877c771935eb88aa47a2b00000000000000000000000090880881bbce94503c0fc974c9b3e1d8e3692fb9000000000000000000000000624ffe62eba13e6057878bca1d7a9e35651e1d9c00000000000000000000000049952ff32fcbc3408d447e1e91da2b44bd2d1afe00000000000000000000000042df81c742cae6f6d91e136b1aa5c7e14cb394fb00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x6080604052600436106102725760003560e01c806388d2755b1161014f578063b4c76fe0116100c1578063e772ff371161007a578063e772ff3714610773578063ea15afc3146107ac578063ecefc705146107cc578063f2fde38b146107e2578063f640d50814610802578063f8e86ece1461082257610272565b8063b4c76fe0146106ab578063c415b95c146106cb578063c93d732d146106eb578063d08508bf146106fe578063d6821ed81461071e578063e5932c401461075357610272565b8063a42dce8011610113578063a42dce80146105d5578063a734f06e146105f5578063a7cd52cb14610615578063a85f329814610655578063ab30469514610675578063b128baba1461068b57610272565b806388d2755b1461054b5780638c7351571461056b5780638c821e901461058b5780638da5cb5b146105a157806390f3f208146105bf57610272565b8063538ba4f9116101e85780635c3d258f116101ac5780635c3d258f146104885780635da93d7e146104a85780636076a0b4146104c857806363c15b34146104f6578063672383c414610516578063715018a61461053657610272565b8063538ba4f9146103e857806353fd7bf11461040857806356230573146104285780635b5a66a7146104485780635b769f3c1461046857610272565b80633aecd0e31161023a5780633aecd0e3146103245780633fc8cef314610352578063433b3c05146103725780634399fa5614610392578063457bfa2f146103b257806352b721f8146103d257610272565b806305b4859814610281578063228cb7331461029457806323a9495e146102d157806330a5199f146102f157806331428a8714610304575b3332141561027f57600080fd5b005b61027f61028f366004613ba0565b610842565b3480156102a057600080fd5b50600d546102b4906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156102dd57600080fd5b5061027f6102ec366004613bdb565b610f0d565b61027f6102ff366004613bf4565b610f51565b34801561031057600080fd5b50600b546102b4906001600160a01b031681565b34801561033057600080fd5b5061034461033f366004613c44565b6115aa565b6040519081526020016102c8565b34801561035e57600080fd5b506006546102b4906001600160a01b031681565b34801561037e57600080fd5b506007546102b4906001600160a01b031681565b34801561039e57600080fd5b50600c546102b4906001600160a01b031681565b3480156103be57600080fd5b506012546102b4906001600160a01b031681565b3480156103de57600080fd5b50610344600f5481565b3480156103f457600080fd5b506002546102b4906001600160a01b031681565b34801561041457600080fd5b5061027f610423366004613c44565b6115c5565b34801561043457600080fd5b5061027f610443366004613c61565b61161b565b34801561045457600080fd5b5061027f610463366004613c44565b611691565b34801561047457600080fd5b5061027f610483366004613c44565b6116e7565b34801561049457600080fd5b5061027f6104a3366004613bdb565b61173d565b3480156104b457600080fd5b5061027f6104c3366004613c44565b61177a565b3480156104d457600080fd5b506104e86104e3366004613cd5565b6117a3565b6040516102c8929190613d1b565b34801561050257600080fd5b5061027f610511366004613c44565b61184c565b34801561052257600080fd5b506102b4610531366004613bdb565b6118a2565b34801561054257600080fd5b5061027f6118cc565b34801561055757600080fd5b506010546102b4906001600160a01b031681565b34801561057757600080fd5b5061027f610586366004613c44565b6118e0565b34801561059757600080fd5b5061034460045481565b3480156105ad57600080fd5b506000546001600160a01b03166102b4565b3480156105cb57600080fd5b5061034460055481565b3480156105e157600080fd5b5061027f6105f0366004613c44565b611936565b34801561060157600080fd5b506001546102b4906001600160a01b031681565b34801561062157600080fd5b50610645610630366004613c44565b600a6020526000908152604090205460ff1681565b60405190151581526020016102c8565b34801561066157600080fd5b5061027f610670366004613bdb565b61198c565b34801561068157600080fd5b5061034460035481565b34801561069757600080fd5b506011546102b4906001600160a01b031681565b3480156106b757600080fd5b5061027f6106c6366004613c44565b6119c9565b3480156106d757600080fd5b50600e546102b4906001600160a01b031681565b6103446106f9366004613d69565b611a1f565b34801561070a57600080fd5b5061027f610719366004613c61565b611f29565b34801561072a57600080fd5b5061073e610739366004613da4565b611fa3565b604080519283526020830191909152016102c8565b34801561075f57600080fd5b5061027f61076e366004613c44565b611fd3565b34801561077f57600080fd5b5061064561078e366004613c44565b6001600160a01b03166000908152600a602052604090205460ff1690565b3480156107b857600080fd5b5061027f6107c7366004613e6d565b612029565b3480156107d857600080fd5b5061034461271081565b3480156107ee57600080fd5b5061027f6107fd366004613c44565b6120e7565b34801561080e57600080fd5b5061027f61081d366004613f00565b61215d565b34801561082e57600080fd5b5061027f61083d366004613c44565b61217f565b61084a6121ab565b60008160c00135116108775760405162461bcd60e51b815260040161086e90613f42565b60405180910390fd5b8061010001354614156108cc5760405162461bcd60e51b815260206004820152601d60248201527f43616e6e6f742062726964676520746f2073616d65206e6574776f726b000000604482015260640161086e565b6108f4333060c08401356108e36020860186613c44565b6001600160a01b0316929190612205565b6000806109266109076020850185613c44565b60c085013561091c60a0870160808801613c44565b8660a001356122f7565b9050600061093a6040850160208601613c44565b905061094c6040850160208601613c44565b6001600160a01b03166109626020860186613c44565b6001600160a01b03161415610979578192506109b0565b60006109896101a0860186613f86565b905011156109a25761099b848361256d565b92506109b0565b6109ac84836125e0565b5092505b60006109d36109c56040870160208801613c44565b6001600160a01b03166127f1565b90508015610c5a576010546040805161012081019091526001600160a01b039091169063a11b119890869080610a0d6101808b018b613fd3565b610a179080613f86565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250602001610a5f6101808b018b613fd3565b610a6d906020810190613f86565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250602001610ab56101808b018b613fd3565b610ac3906040810190613ff4565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250602001610b086101808b018b613fd3565b610b19906080810190606001613c44565b6001600160a01b03168152602001610b356101808b018b613fd3565b610b469060a0810190608001613c44565b6001600160a01b0316815260208101899052604001610b696101808b018b613fd3565b610b7a9060e081019060c00161404b565b15158152602001610b8f6101808b018b613fd3565b610ba19061010081019060e001613c44565b6001600160a01b03168152602001610bbd6101808b018b613fd3565b610bcc90610100810190613f86565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509152506040516001600160e01b031960e085901b168152610c239190600401614104565b6000604051808303818588803b158015610c3c57600080fd5b505af1158015610c50573d6000803e3d6000fd5b5050505050610eed565b601154610c74906001600160a01b0384811691168661282a565b6010546040805161012081019091526001600160a01b039091169063a11b11989080610ca46101808a018a613fd3565b610cae9080613f86565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250602001610cf66101808a018a613fd3565b610d04906020810190613f86565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250602001610d4c6101808a018a613fd3565b610d5a906040810190613ff4565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250602001610d9f6101808a018a613fd3565b610db0906080810190606001613c44565b6001600160a01b03168152602001610dcc6101808a018a613fd3565b610ddd9060a0810190608001613c44565b6001600160a01b0316815260208101889052604001610e006101808a018a613fd3565b610e119060e081019060c00161404b565b15158152602001610e266101808a018a613fd3565b610e389061010081019060e001613c44565b6001600160a01b03168152602001610e546101808a018a613fd3565b610e6390610100810190613f86565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509152506040516001600160e01b031960e084901b168152610eba9190600401614104565b600060405180830381600087803b158015610ed457600080fd5b505af1158015610ee8573d6000803e3d6000fd5b505050505b610efc85600086336001612905565b50505050610f0a6001600955565b50565b610f156129bc565b60058190556040518181527f11e8ee12d79dc7314b845f4e82465af5bd3d2214081526061af36de8364eaa2e906020015b60405180910390a150565b610f596121ab565b60008160a0013511610f7d5760405162461bcd60e51b815260040161086e90613f42565b610f8e610100820160e083016141e8565b6001600160401b0316461415610fe65760405162461bcd60e51b815260206004820152601d60248201527f43616e6e6f742062726964676520746f2073616d65206e6574776f726b000000604482015260640161086e565b610ffd333060a08401356108e36020860186613c44565b600061102e61100f6020840184613c44565b60a08401356110246080860160608701613c44565b85608001356122f7565b905060006110426109c56020850185613c44565b905080156112c9576010546040805161012081019091526001600160a01b039091169063a11b11989084908061107c610140890189613fd3565b6110869080613f86565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050908252506020016110ce610140890189613fd3565b6110dc906020810190613f86565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250602001611124610140890189613fd3565b611132906040810190613ff4565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250602001611177610140890189613fd3565b611188906080810190606001613c44565b6001600160a01b031681526020016111a4610140890189613fd3565b6111b59060a0810190608001613c44565b6001600160a01b03168152602081018790526040016111d8610140890189613fd3565b6111e99060e081019060c00161404b565b151581526020016111fe610140890189613fd3565b6112109061010081019060e001613c44565b6001600160a01b0316815260200161122c610140890189613fd3565b61123b90610100810190613f86565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509152506040516001600160e01b031960e085901b1681526112929190600401614104565b6000604051808303818588803b1580156112ab57600080fd5b505af11580156112bf573d6000803e3d6000fd5b505050505061158f565b6011546112f8906001600160a01b031660006112e86020870187613c44565b6001600160a01b03169190612a16565b601154611316906001600160a01b0316836112e86020870187613c44565b6010546040805161012081019091526001600160a01b039091169063a11b11989080611346610140880188613fd3565b6113509080613f86565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250602001611398610140880188613fd3565b6113a6906020810190613f86565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050908252506020016113ee610140880188613fd3565b6113fc906040810190613ff4565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505090825250602001611441610140880188613fd3565b611452906080810190606001613c44565b6001600160a01b0316815260200161146e610140880188613fd3565b61147f9060a0810190608001613c44565b6001600160a01b03168152602081018690526040016114a2610140880188613fd3565b6114b39060e081019060c00161404b565b151581526020016114c8610140880188613fd3565b6114da9061010081019060e001613c44565b6001600160a01b031681526020016114f6610140880188613fd3565b61150590610100810190613f86565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509152506040516001600160e01b031960e084901b16815261155c9190600401614104565b600060405180830381600087803b15801561157657600080fd5b505af115801561158a573d6000803e3d6000fd5b505050505b61159e83600084336001612b6d565b5050610f0a6001600955565b60006115bf6001600160a01b03831630612be8565b92915050565b6115cd6129bc565b600c80546001600160a01b0319166001600160a01b0383169081179091556040519081527f35e63b7fefc2b1fb2ed78adeed6688b187514d96c2d7d56222e52f3e41c2fb2f90602001610f46565b6116236129bc565b60005b8181101561168c57600a600084848481811061164457611644614211565b90506020020160208101906116599190613c44565b6001600160a01b031681526020810191909152604001600020805460ff19169055806116848161423d565b915050611626565b505050565b6116996129bc565b601280546001600160a01b0319166001600160a01b0383169081179091556040519081527fb3bfb91ec7a3f9a14278772a47b34685afb9cdd7ef683fab8a790ccdd667264790602001610f46565b6116ef6129bc565b600680546001600160a01b0319166001600160a01b0383169081179091556040519081527f41408be49f75701fe4bb8484ce88d68f1d82e03cb4eb44263b6682ce2dbd32f090602001610f46565b6117456129bc565b600f8190556040518181527f8f817f25bf47abe304b519d80d1a633064758c57d280731736fe82ad20816c5590602001610f46565b6117826129bc565b6001600160a01b03166000908152600a60205260409020805460ff19169055565b600b5460405163181da82d60e21b81526001600160a01b03868116600483015285811660248301526044820185905260648201849052600092606092911690636076a0b49060840160006040518083038186803b15801561180357600080fd5b505afa158015611817573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261183f9190810190614258565b9097909650945050505050565b6118546129bc565b601080546001600160a01b0319166001600160a01b0383169081179091556040519081527f04ba9cd50e738032e7c0417ffbbc8dbd97d0a808f7d40b33d37b40211b7b37a790602001610f46565b600881815481106118b257600080fd5b6000918252602090912001546001600160a01b0316905081565b6118d46129bc565b6118de6000612c82565b565b6118e86129bc565b601180546001600160a01b0319166001600160a01b0383169081179091556040519081527f350be0988d0dcfc45d1beb115379cf4bd8b76411a13b291cfb5840ac4246ecc190602001610f46565b61193e6129bc565b600e80546001600160a01b0319166001600160a01b0383169081179091556040519081527f12e1d17016b94668449f97876f4a8d5cc2c19f314db337418894734037cc19d490602001610f46565b6119946129bc565b60048190556040518181527f70f24e12a9db25e0d80cbcde19ffef47d6a7c52c1089db4c71e53ce1856577fc90602001610f46565b6119d16129bc565b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527f17780f3919f73af11f29e4157534858a06c91294d64b679fe4e49340122cd32290602001610f46565b6000611a296121ab565b816080013582606001351015611a9f5760405162461bcd60e51b815260206004820152603560248201527f657870656374656452657475726e206d75737420626520657175616c206f72206044820152743630b933b2b9103a3430b71036b4b72932ba3ab93760591b606482015260840161086e565b611aaf6040830160208401613c44565b6001600160a01b0316611ac56020840184613c44565b6001600160a01b03161415611aec5760405162461bcd60e51b815260040161086e906142f4565b60008060005b611b00610100860186613ff4565b9050811015611b7e576000611b19610100870187613ff4565b83818110611b2957611b29614211565b905060200201351115611b6c57611b44610100860186613ff4565b82818110611b5457611b54614211565b9050602002013583611b66919061433c565b92508091505b80611b768161423d565b915050611af2565b5081611bdd57611b946109c56020860186613c44565b15611bd05760405133903480156108fc02916000818181858888f19350505050158015611bc5573d6000803e3d6000fd5b503492505050611f1a565b5050506040810135611f1a565b611bf4333060408701356108e36020890189613c44565b6000611c25611c066020870187613c44565b6040870135611c1b60c0890160a08a01613c44565b8860c001356122f7565b9050611c91611c38610100870187613ff4565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250859250879150869050611c7c60208b018b613c44565b611c8c60408c0160208d01613c44565b612cd2565b93508315611eab578460800135841015611cf95760405162461bcd60e51b8152602060048201526024808201527f5377697463683a2052657475726e20616d6f756e7420776173206e6f7420656e6044820152630deeaced60e31b606482015260840161086e565b8460600135841115611e1b57611d3e611d19610100870160e08801613c44565b6060870135611d2e6040890160208a01613c44565b6001600160a01b03169190612f02565b50600d54611d6d906001600160a01b0316611d5d606088013587614354565b611d2e6040890160208a01613c44565b50600c546001600160a01b031663391fdc2433611d91610100890160e08a01613c44565b611d9e60208a018a613c44565b611dae60408b0160208c01613c44565b60408b013560608c0135611dc2818d614354565b6040518863ffffffff1660e01b8152600401611de4979695949392919061436b565b600060405180830381600087803b158015611dfe57600080fd5b505af1158015611e12573d6000803e3d6000fd5b50505050611f16565b611e40611e2f610100870160e08801613c44565b85611d2e6040890160208a01613c44565b50600c546001600160a01b031663391fdc2433611e64610100890160e08a01613c44565b611e7160208a018a613c44565b611e8160408b0160208c01613c44565b8a604001358a60006040518863ffffffff1660e01b8152600401611de4979695949392919061436b565b6040850135611ed030611ec16020890189613c44565b6001600160a01b031690612be8565b1115611ef257611eec336040870135611d2e6020890189613c44565b50611f16565b611f1433611f0730611ec160208a018a613c44565b611d2e6020890189613c44565b505b5050505b611f246001600955565b919050565b611f316129bc565b60005b8181101561168c576001600a6000858585818110611f5457611f54614211565b9050602002016020810190611f699190613c44565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580611f9b8161423d565b915050611f34565b600080612710611fb386856143af565b611fbd91906143e4565b9150611fc98286614354565b9050935093915050565b611fdb6129bc565b600d80546001600160a01b0319166001600160a01b0383169081179091556040519081527f53a596d7be747a5a4f4d39a6a36476d2eed407c93f6f2ba8a96c8b971240d5cd90602001610f46565b6120316129bc565b805160036000828254612044919061433c565b90915550600090505b81518110156120b757600882828151811061206a5761206a614211565b60209081029190910181015182546001810184556000938452919092200180546001600160a01b0319166001600160a01b03909216919091179055806120af8161423d565b91505061204d565b507fbbc63a7f378af7e269ef19f3fe0d08f044c91ee72930c0d045a58be58580f3d381604051610f4691906143f8565b6120ef6129bc565b6001600160a01b0381166121545760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161086e565b610f0a81612c82565b6121656129bc565b6121796001600160a01b0384168284612f02565b50505050565b6121876129bc565b6001600160a01b03166000908152600a60205260409020805460ff19166001179055565b600260095414156121fe5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161086e565b6002600955565b8061220f57612179565b612218846127f1565b156122e2576001600160a01b038316331480156122355750803410155b6122955760405162461bcd60e51b815260206004820152602b60248201527f57726f6e6720757365616765206f66204554482e756e6976657273616c54726160448201526a6e7366657246726f6d282960a81b606482015260840161086e565b6001600160a01b03821630146122dd576040516001600160a01b0383169082156108fc029083906000818181858888f193505050501580156122db573d6000803e3d6000fd5b505b612179565b6121796001600160a01b038516848484612f7d565b82811561256557600e54604051637b8c4cdf60e01b81526001600160a01b0385811660048301526000921690637b8c4cdf9060240160206040518083038186803b15801561234457600080fd5b505afa158015612358573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061237c919061440b565b9050806123885750600f545b6000612396612710806143af565b826123a188876143af565b6123ab91906143af565b6123b591906143e4565b90506000816127106123c789886143af565b6123d191906143e4565b6123db9190614354565b90506123ef886001600160a01b03166127f1565b1561248257600e546001600160a01b031663eedd56e161240f848461433c565b6040516001600160e01b031960e084901b1681526001600160a01b03808d16600483015260248201869052604482018790528a1660648201526084016000604051808303818588803b15801561246457600080fd5b505af1158015612478573d6000803e3d6000fd5b505050505061253e565b600e5461249d906001600160a01b038a811691166000612a16565b600e546124c8906001600160a01b03166124b7848461433c565b6001600160a01b038b169190612a16565b600e5460405163eedd56e160e01b81526001600160a01b038a81166004830152602482018490526044820185905288811660648301529091169063eedd56e190608401600060405180830381600087803b15801561252557600080fd5b505af1158015612539573d6000803e3d6000fd5b505050505b61271061254b88876143af565b61255591906143e4565b61255f9088614354565b93505050505b949350505050565b60006125d961257f6020850185613c44565b61258f6040860160208701613c44565b843061259f6101a0890189613f86565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612fb592505050565b9392505050565b60008080805b6125f4610120870187613ff4565b905081101561267257600061260d610120880188613ff4565b8381811061261d5761261d614211565b90506020020135111561266057612638610120870187613ff4565b8281811061264857612648614211565b905060200201358361265a919061433c565b92508091505b8061266a8161423d565b9150506125e6565b50600082116126c35760405162461bcd60e51b815260206004820152601a60248201527f696e76616c696420646973747269627574696f6e20706172616d000000000000604482015260640161086e565b6127186126d4610120870187613ff4565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250889250869150859050611c7c60208b018b613c44565b9250600083116127615760405162461bcd60e51b81526020600482015260146024820152730a6eec2e040ccc2d2d8cac840cce4deda40c8caf60631b604482015260640161086e565b600c546001600160a01b031663391fdc24333061278160208a018a613c44565b61279160408b0160208c01613c44565b898960006040518863ffffffff1660e01b81526004016127b7979695949392919061436b565b600060405180830381600087803b1580156127d157600080fd5b505af11580156127e5573d6000803e3d6000fd5b50505050509250929050565b60006001600160a01b03821615806115bf57506001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1492915050565b612833836127f1565b61168c57806128515761168c6001600160a01b038416836000612a16565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e9060440160206040518083038186803b15801561289c57600080fd5b505afa1580156128b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128d4919061440b565b905080156128f1576128f16001600160a01b038516846000612a16565b6121796001600160a01b0385168484612a16565b600c546001600160a01b0316630aea28c7610140870135866101608901358661293160208c018c613c44565b61294160408d0160208e01613c44565b61295160608e0160408f01613c44565b8d60c001358c8f60e001358c6040518c63ffffffff1660e01b81526004016129839b9a99989796959493929190614424565b600060405180830381600087803b15801561299d57600080fd5b505af11580156129b1573d6000803e3d6000fd5b505050505050505050565b6000546001600160a01b031633146118de5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161086e565b801580612a9f5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b158015612a6557600080fd5b505afa158015612a79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a9d919061440b565b155b612b0a5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b606482015260840161086e565b6040516001600160a01b03831660248201526044810182905261168c90849063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526130b6565b600c546001600160a01b0316630aea28c76101008701358661012089013586612b9960208c018c613c44565b612ba660208d018d613c44565b612bb660408e0160208f01613c44565b8d60a001358c8f60c001358c6040518c63ffffffff1660e01b81526004016129839b9a99989796959493929190614424565b6000612bf3836127f1565b15612c0957506001600160a01b038116316115bf565b6040516370a0823160e01b81526001600160a01b0383811660048301528416906370a082319060240160206040518083038186803b158015612c4a57600080fd5b505afa158015612c5e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125d9919061440b565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000600454600354612ce491906143af565b87511115612d645760405162461bcd60e51b815260206004820152604160248201527f5377697463683a20446973747269627574696f6e2061727261792073686f756c60448201527f64206e6f742065786365656420666163746f726965732061727261792073697a6064820152606560f81b608482015260a40161086e565b856000805b8951811015612ef557898181518110612d8457612d84614211565b602002602001015160001415612d9957612ee3565b6000888b8381518110612dae57612dae614211565b60200260200101518b612dc191906143af565b612dcb91906143e4565b905087821415612dd85750825b612de28185614354565b935060045482612df291906144ad565b612e3d57612e36878783600860045487612e0c91906143e4565b81548110612e1c57612e1c614211565b6000918252602090912001546001600160a01b031661318b565b9250612ed5565b600454612e4a90836144ad565b60011415612e9257612e36878783600860045487612e6891906143e4565b81548110612e7857612e78614211565b6000918252602090912001546001600160a01b03166131a2565b612ed2878783600860045487612ea891906143e4565b81548110612eb857612eb8614211565b6000918252602090912001546001600160a01b03166131bf565b92505b612edf838661433c565b9450505b80612eed8161423d565b915050612d69565b5050509695505050505050565b600081612f11575060016125d9565b612f1a846127f1565b15612f5f576040516001600160a01b0384169083156108fc029084906000818181858888f19350505050158015612f55573d6000803e3d6000fd5b50600190506125d9565b612f736001600160a01b03851684846131dc565b5060019392505050565b6040516001600160a01b03808516602483015283166044820152606481018290526121799085906323b872dd60e01b90608401612b36565b6000846001600160a01b0316866001600160a01b03161415612fe95760405162461bcd60e51b815260040161086e906142f4565b600082806020019051810190612fff91906144c1565b905061300c87868361320c565b61301f6001600160a01b03871630612be8565b9150811561303d5761303b6001600160a01b0387168584612f02565b505b600c54604051630e47f70960e21b81526001600160a01b039091169063391fdc249061307a90339088908c908c908c908a9060009060040161436b565b600060405180830381600087803b15801561309457600080fd5b505af11580156130a8573d6000803e3d6000fd5b505050505095945050505050565b600061310b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661336e9092919063ffffffff16565b905080516000148061312c57508080602001905181019061312c91906145a7565b61168c5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161086e565b60006131998585858561337d565b95945050505050565b6006546000906131999086906001600160a01b03168686866137e9565b6007546000906131999086906001600160a01b03168686866137e9565b6040516001600160a01b03831660248201526044810182905261168c90849063a9059cbb60e01b90606401612b36565b806020015161321a8161380c565b81516132258161380c565b6000613239866001600160a01b03166127f1565b15613295578447101561328e5760405162461bcd60e51b815260206004820152601b60248201527f4554482062616c616e636520697320696e73756666696369656e740000000000604482015260640161086e565b50836132af565b60208401516132af906001600160a01b038816908761282a565b600084600001516001600160a01b03168286604001516040516132d291906145c4565b60006040518083038185875af1925050503d806000811461330f576040519150601f19603f3d011682016040523d82523d6000602084013e613314565b606091505b50509050806133655760405162461bcd60e51b815260206004820152601f60248201527f4465782041676772656761746f7220657865637574696f6e206661696c656400604482015260640161086e565b50505050505050565b60606125658484600085613874565b6000613391856001600160a01b03166127f1565b1561340057600660009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0846040518263ffffffff1660e01b81526004016000604051808303818588803b1580156133e657600080fd5b505af11580156133fa573d6000803e3d6000fd5b50505050505b6000613414866001600160a01b03166127f1565b61341e578561342b565b6006546001600160a01b03165b90506000613441866001600160a01b03166127f1565b61344b5785613458565b6006546001600160a01b03165b60405163e6a4390560e01b81526001600160a01b038481166004830152808316602483015291925060009186169063e6a439059060440160206040518083038186803b1580156134a757600080fd5b505afa1580156134bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134df91906145d6565b90506000806134f96001600160a01b03841686868b61394f565b91975092509050811561355e57826001600160a01b031663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561354157600080fd5b505af1158015613555573d6000803e3d6000fd5b505050506135d2565b80156135d25760405163bc25cf7760e01b81527346fd07da395799f113a7584563b8cb886f33c2bc60048201526001600160a01b0384169063bc25cf7790602401600060405180830381600087803b1580156135b957600080fd5b505af11580156135cd573d6000803e3d6000fd5b505050505b6135e66001600160a01b038616848a612f02565b50836001600160a01b0316856001600160a01b0316101561367b5760405163022c0d9f60e01b8152600060048201819052602482018890523060448301526080606483015260848201526001600160a01b0384169063022c0d9f9060a401600060405180830381600087803b15801561365e57600080fd5b505af1158015613672573d6000803e3d6000fd5b505050506136f1565b60405163022c0d9f60e01b8152600481018790526000602482018190523060448301526080606483015260848201526001600160a01b0384169063022c0d9f9060a401600060405180830381600087803b1580156136d857600080fd5b505af11580156136ec573d6000803e3d6000fd5b505050505b613703896001600160a01b03166127f1565b156137dc576006546040516370a0823160e01b81523060048201526001600160a01b0390911690632e1a7d4d9082906370a082319060240160206040518083038186803b15801561375357600080fd5b505afa158015613767573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061378b919061440b565b6040518263ffffffff1660e01b81526004016137a991815260200190565b600060405180830381600087803b1580156137c357600080fd5b505af11580156137d7573d6000803e3d6000fd5b505050505b5050505050949350505050565b600061380285856137fc8989888861337d565b8561337d565b9695505050505050565b6001600160a01b0381166000908152600a602052604090205460ff16610f0a5760405162461bcd60e51b815260206004820152601b60248201527f41646472657373206973206e6f7420696e20616c6c6f776c6973740000000000604482015260640161086e565b6060824710156138d55760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161086e565b600080866001600160a01b031685876040516138f191906145c4565b60006040518083038185875af1925050503d806000811461392e576040519150601f19603f3d011682016040523d82523d6000602084013e613933565b606091505b509150915061394487838387613aea565b979650505050505050565b60008080806139676001600160a01b03881689612be8565b9050600061397e6001600160a01b0388168a612be8565b90506000808a6001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b1580156139bc57600080fd5b505afa1580156139d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139f4919061460a565b5091509150886001600160a01b03168a6001600160a01b03161115613a1557905b816001600160701b0316841080613a345750806001600160701b031683105b955085158015613a5e5750816001600160701b0316841180613a5e5750806001600160701b031683115b94506000613a6e896103e56143af565b90506000613a8585846001600160701b0316613b60565b613a8f90836143af565b9050600082613aa788876001600160701b0316613b60565b613ab3906103e86143af565b613abd919061433c565b90508015613ad457613acf81836143e4565b613ad7565b60005b9950505050505050509450945094915050565b60608315613b56578251613b4f576001600160a01b0385163b613b4f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161086e565b5081612565565b6125658383613b76565b6000818310613b6f57816125d9565b5090919050565b815115613b865781518083602001fd5b8060405162461bcd60e51b815260040161086e919061464f565b600060208284031215613bb257600080fd5b81356001600160401b03811115613bc857600080fd5b82016101c081850312156125d957600080fd5b600060208284031215613bed57600080fd5b5035919050565b600060208284031215613c0657600080fd5b81356001600160401b03811115613c1c57600080fd5b820161016081850312156125d957600080fd5b6001600160a01b0381168114610f0a57600080fd5b600060208284031215613c5657600080fd5b81356125d981613c2f565b60008060208385031215613c7457600080fd5b82356001600160401b0380821115613c8b57600080fd5b818501915085601f830112613c9f57600080fd5b813581811115613cae57600080fd5b8660208260051b8501011115613cc357600080fd5b60209290920196919550909350505050565b60008060008060808587031215613ceb57600080fd5b8435613cf681613c2f565b93506020850135613d0681613c2f565b93969395505050506040820135916060013590565b6000604082018483526020604081850152818551808452606086019150828701935060005b81811015613d5c57845183529383019391830191600101613d40565b5090979650505050505050565b600060208284031215613d7b57600080fd5b81356001600160401b03811115613d9157600080fd5b820161012081850312156125d957600080fd5b600080600060608486031215613db957600080fd5b833592506020840135613dcb81613c2f565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b604051606081016001600160401b0381118282101715613e1457613e14613ddc565b60405290565b604051601f8201601f191681016001600160401b0381118282101715613e4257613e42613ddc565b604052919050565b60006001600160401b03821115613e6357613e63613ddc565b5060051b60200190565b60006020808385031215613e8057600080fd5b82356001600160401b03811115613e9657600080fd5b8301601f81018513613ea757600080fd5b8035613eba613eb582613e4a565b613e1a565b81815260059190911b82018301908381019087831115613ed957600080fd5b928401925b82841015613944578335613ef181613c2f565b82529284019290840190613ede565b600080600060608486031215613f1557600080fd5b8335613f2081613c2f565b9250602084013591506040840135613f3781613c2f565b809150509250925092565b60208082526024908201527f54686520616d6f756e74206d7573742062652067726561746572207468616e206040820152637a65726f60e01b606082015260800190565b6000808335601e19843603018112613f9d57600080fd5b8301803591506001600160401b03821115613fb757600080fd5b602001915036819003821315613fcc57600080fd5b9250929050565b6000823561011e19833603018112613fea57600080fd5b9190910192915050565b6000808335601e1984360301811261400b57600080fd5b8301803591506001600160401b0382111561402557600080fd5b6020019150600581901b3603821315613fcc57600080fd5b8015158114610f0a57600080fd5b60006020828403121561405d57600080fd5b81356125d98161403d565b60005b8381101561408357818101518382015260200161406b565b838111156121795750506000910152565b600081518084526140ac816020860160208601614068565b601f01601f19169290920160200192915050565b600081518084526020808501945080840160005b838110156140f95781516001600160a01b0316875295820195908201906001016140d4565b509495945050505050565b6020815260008251610120806020850152614123610140850183614094565b91506020850151601f19808685030160408701526141418483614094565b9350604087015191508086850301606087015261415e84836140c0565b93506060870151915061417c60808701836001600160a01b03169052565b60808701516001600160a01b03811660a0880152915060a087015160c087015260c087015191506141b160e087018315159052565b60e087015191506101006141cf818801846001600160a01b03169052565b8701518685039091018387015290506138028382614094565b6000602082840312156141fa57600080fd5b81356001600160401b03811681146125d957600080fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060001982141561425157614251614227565b5060010190565b6000806040838503121561426b57600080fd5b825191506020808401516001600160401b0381111561428957600080fd5b8401601f8101861361429a57600080fd5b80516142a8613eb582613e4a565b81815260059190911b820183019083810190888311156142c757600080fd5b928401925b828410156142e5578351825292840192908401906142cc565b80955050505050509250929050565b60208082526028908201527f69742773206e6f7420616c6c6f77656420746f2073776170207769746820736160408201526736b2903a37b5b2b760c11b606082015260800190565b6000821982111561434f5761434f614227565b500190565b60008282101561436657614366614227565b500390565b6001600160a01b03978816815295871660208701529386166040860152919094166060840152608083019390935260a082019290925260c081019190915260e00190565b60008160001904831182151516156143c9576143c9614227565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826143f3576143f36143ce565b500490565b6020815260006125d960208301846140c0565b60006020828403121561441d57600080fd5b5051919050565b8b8152602081018b9052604081018a90526001600160a01b038981166060830152888116608083015287811660a0830152861660c082015260e081018590526101008101849052610120810183905261016081016004831061449657634e487b7160e01b600052602160045260246000fd5b826101408301529c9b505050505050505050505050565b6000826144bc576144bc6143ce565b500690565b600060208083850312156144d457600080fd5b82516001600160401b03808211156144eb57600080fd5b90840190606082870312156144ff57600080fd5b614507613df2565b825161451281613c2f565b81528284015161452181613c2f565b8185015260408301518281111561453757600080fd5b80840193505086601f84011261454c57600080fd5b82518281111561455e5761455e613ddc565b614570601f8201601f19168601613e1a565b9250808352878582860101111561458657600080fd5b61459581868501878701614068565b50604081019190915295945050505050565b6000602082840312156145b957600080fd5b81516125d98161403d565b60008251613fea818460208701614068565b6000602082840312156145e857600080fd5b81516125d981613c2f565b80516001600160701b0381168114611f2457600080fd5b60008060006060848603121561461f57600080fd5b614628846145f3565b9250614636602085016145f3565b9150604084015163ffffffff81168114613f3757600080fd5b6020815260006125d9602083018461409456fea2646970667358221220b22866a01c7c43033d57b70fb66cffd561e76fa66da655b15116d635008cbb4f64736f6c63430008090033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000053000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000001800000000000000000000000005e8ac2dc9f31bbab954877c771935eb88aa47a2b00000000000000000000000090880881bbce94503c0fc974c9b3e1d8e3692fb9000000000000000000000000624ffe62eba13e6057878bca1d7a9e35651e1d9c00000000000000000000000049952ff32fcbc3408d447e1e91da2b44bd2d1afe00000000000000000000000042df81c742cae6f6d91e136b1aa5c7e14cb394fb00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _weth (address): 0x5300000000000000000000000000000000000004
Arg [1] : _otherToken (address): 0x0000000000000000000000000000000000000000
Arg [2] : _pathCountAndSplit (uint256[]): 2,0
Arg [3] : _factories (address[]): 0x0000000000000000000000000000000000000000
Arg [4] : _switchViewAddress (address): 0x5e8AC2DC9f31Bbab954877C771935eb88aa47A2B
Arg [5] : _switchEventAddress (address): 0x90880881Bbce94503c0fC974c9B3E1D8E3692fb9
Arg [6] : _symbiosisRouter (address): 0x624FFe62eBa13e6057878bCA1D7A9E35651E1D9c
Arg [7] : _symbiosisGateway (address): 0x49952ff32FcBc3408D447E1E91Da2b44BD2D1AFE
Arg [8] : _feeCollector (address): 0x42df81c742CAe6F6D91E136b1AA5C7e14CB394FB
-----Encoded View---------------
14 Constructor Arguments found :
Arg [0] : 0000000000000000000000005300000000000000000000000000000000000004
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000120
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000180
Arg [4] : 0000000000000000000000005e8ac2dc9f31bbab954877c771935eb88aa47a2b
Arg [5] : 00000000000000000000000090880881bbce94503c0fc974c9b3e1d8e3692fb9
Arg [6] : 000000000000000000000000624ffe62eba13e6057878bca1d7a9e35651e1d9c
Arg [7] : 00000000000000000000000049952ff32fcbc3408d447e1e91da2b44bd2d1afe
Arg [8] : 00000000000000000000000042df81c742cae6f6d91e136b1aa5c7e14cb394fb
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [11] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [12] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [13] : 0000000000000000000000000000000000000000000000000000000000000000
Loading...
Loading
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.