Source Code
Latest 25 from a total of 9,752 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Swap | 30189803 | 2 days ago | IN | 0 ETH | 0.00001728 | ||||
| Swap | 29509222 | 18 days ago | IN | 0 ETH | 0.00001019 | ||||
| Swap | 29218743 | 24 days ago | IN | 0 ETH | 0.00000024 | ||||
| Swap | 28972349 | 30 days ago | IN | 0.00097716 ETH | 0.00000028 | ||||
| Swap | 28876821 | 32 days ago | IN | 0 ETH | 0.00000014 | ||||
| Swap | 28794048 | 34 days ago | IN | 0 ETH | 0.00000018 | ||||
| Swap | 28209785 | 48 days ago | IN | 0.00034 ETH | 0 | ||||
| Swap | 27942072 | 54 days ago | IN | 0 ETH | 0.00000002 | ||||
| Swap | 27940598 | 54 days ago | IN | 0 ETH | 0.00000002 | ||||
| Swap | 27940580 | 54 days ago | IN | 0 ETH | 0.00000032 | ||||
| Swap | 27940549 | 54 days ago | IN | 0 ETH | 0.00000002 | ||||
| Swap | 27940419 | 54 days ago | IN | 0 ETH | 0.00000002 | ||||
| Swap | 27652084 | 61 days ago | IN | 0 ETH | 0 | ||||
| Swap | 27647191 | 61 days ago | IN | 0 ETH | 0 | ||||
| Swap | 27614162 | 62 days ago | IN | 0 ETH | 0.00000016 | ||||
| Swap | 27608952 | 62 days ago | IN | 0 ETH | 0.00000032 | ||||
| Swap | 27594072 | 62 days ago | IN | 0 ETH | 0 | ||||
| Swap | 27585298 | 62 days ago | IN | 0 ETH | 0 | ||||
| Swap | 27583875 | 62 days ago | IN | 0 ETH | 0.00000032 | ||||
| Swap | 27583868 | 62 days ago | IN | 0 ETH | 0.00000031 | ||||
| Swap | 27583103 | 62 days ago | IN | 0 ETH | 0.00000034 | ||||
| Swap | 27582970 | 62 days ago | IN | 0 ETH | 0 | ||||
| Swap | 27580051 | 62 days ago | IN | 0 ETH | 0 | ||||
| Swap | 27569002 | 63 days ago | IN | 0 ETH | 0.00000022 | ||||
| Swap | 27568954 | 63 days ago | IN | 0 ETH | 0 |
Advanced mode: Intended for advanced users or developers and will display all Internal Transactions including zero value transfers.
Latest 25 internal transactions (View All)
Advanced mode:
| Parent Transaction Hash | Block | From | To | ||||
|---|---|---|---|---|---|---|---|
| 30189803 | 2 days ago | 0.00033844 ETH | |||||
| 30189803 | 2 days ago | 0.00033844 ETH | |||||
| 30189803 | 2 days ago | 0 ETH | |||||
| 30189803 | 2 days ago | 0 ETH | |||||
| 30189803 | 2 days ago | 0 ETH | |||||
| 30189803 | 2 days ago | 0 ETH | |||||
| 30189803 | 2 days ago | 0 ETH | |||||
| 30189803 | 2 days ago | 0 ETH | |||||
| 30189803 | 2 days ago | 0 ETH | |||||
| 30189803 | 2 days ago | 0 ETH | |||||
| 30189803 | 2 days ago | 0 ETH | |||||
| 30189803 | 2 days ago | 0 ETH | |||||
| 30189803 | 2 days ago | 0 ETH | |||||
| 30189803 | 2 days ago | 0 ETH | |||||
| 30189803 | 2 days ago | 0 ETH | |||||
| 30189803 | 2 days ago | 0 ETH | |||||
| 30189803 | 2 days ago | 0 ETH | |||||
| 30189803 | 2 days ago | 0 ETH | |||||
| 30189803 | 2 days ago | 0 ETH | |||||
| 30189803 | 2 days ago | 0 ETH | |||||
| 30189803 | 2 days ago | 0 ETH | |||||
| 30189803 | 2 days ago | 0 ETH | |||||
| 30189803 | 2 days ago | 0 ETH | |||||
| 30189699 | 2 days ago | 0 ETH | |||||
| 30189699 | 2 days ago | 0 ETH |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
WowmaxRouter
Compiler Version
v0.8.7+commit.e28d00a7
Optimization Enabled:
Yes with 800 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.7;
import "./interfaces/IWETH.sol";
import "./interfaces/IWowmaxRouter.sol";
import "./libraries/UniswapV2.sol";
import "./libraries/UniswapV3.sol";
import "./libraries/Curve.sol";
import "./libraries/PancakeSwapStable.sol";
import "./libraries/DODOV2.sol";
import "./libraries/DODOV1.sol";
import "./libraries/DODOV3.sol";
import "./libraries/Hashflow.sol";
import "./libraries/Saddle.sol";
import "./libraries/Wombat.sol";
import "./libraries/Level.sol";
import "./libraries/Fulcrom.sol";
import "./libraries/WooFi.sol";
import "./libraries/Elastic.sol";
import "./libraries/AlgebraV1.sol";
import "./libraries/SyncSwap.sol";
import "./libraries/Vooi.sol";
import "./libraries/VelocoreV2.sol";
import "./libraries/Iziswap.sol";
import "./libraries/Velodrome.sol";
import "./libraries/BalancerV2.sol";
import "./libraries/MaverickV1.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./WowmaxSwapReentrancyGuard.sol";
/**
* @title WOWMAX Router
* @notice Router for stateless execution of swaps against multiple DEX protocols.
*
* The WowmaxRouter contract encompasses three primary responsibilities:
* 1. Facilitating the exchange of user tokens based on a provided exchange route.
* 2. Ensuring validation of the received output amounts for users, guaranteeing their alignment
* within the designated slippage range.
* 3. Transferring any surplus amounts to the treasury, thereby functioning as a service fee.
*
* The WowmaxRouter contract does not hold any tokens between swap operations. Tokens should not be transferred directly
* to the contract. If, by any chance, tokens are transferred directly to the contract, they are most likely to be lost.
*/
contract WowmaxRouter is IWowmaxRouter, Ownable, WowmaxSwapReentrancyGuard {
/**
* @dev WETH contract
*/
IWETH public WETH;
/**
* @dev Treasury address
*/
address public treasury;
/**
* @dev Max fee percentage. All contract percentage values have two extra digits for precision. Default value is 1%
*/
uint256 public maxFeePercentage = 100;
/**
* @dev Max allowed slippage percentage, default value is 20%
*/
uint256 public maxSlippage = 2000;
// Mapping of protocol names
bytes32 internal constant UNISWAP_V2 = "UNISWAP_V2";
bytes32 internal constant UNISWAP_V3 = "UNISWAP_V3";
bytes32 internal constant UNISWAP_V2_ROUTER = "UNISWAP_V2_ROUTER";
bytes32 internal constant CURVE = "CURVE";
bytes32 internal constant DODO_V1 = "DODO_V1";
bytes32 internal constant DODO_V2 = "DODO_V2";
bytes32 internal constant DODO_V3 = "DODO_V3";
bytes32 internal constant HASHFLOW = "HASHFLOW";
bytes32 internal constant PANCAKESWAP_STABLE = "PANCAKESWAP_STABLE";
bytes32 internal constant SADDLE = "SADDLE";
bytes32 internal constant WOMBAT = "WOMBAT";
bytes32 internal constant LEVEL = "LEVEL";
bytes32 internal constant FULCROM = "FULCROM";
bytes32 internal constant WOOFI = "WOOFI";
bytes32 internal constant ELASTIC = "ELASTIC";
bytes32 internal constant ALGEBRA_V1 = "ALGEBRA_V1";
bytes32 internal constant ALGEBRA_V1_9 = "ALGEBRA_V1_9";
bytes32 internal constant SYNCSWAP = "SYNCSWAP";
bytes32 internal constant VOOI = "VOOI";
bytes32 internal constant VELOCORE_V2 = "VELOCORE_V2";
bytes32 internal constant IZISWAP = "IZISWAP";
bytes32 internal constant VELODROME = "VELODROME";
bytes32 internal constant BALANCER_V2 = "BALANCER_V2";
bytes32 internal constant MAVERICK_V1 = "MAVERICK_V1";
using SafeERC20 for IERC20;
/**
* @dev sets the WETH and treasury addresses
*/
constructor(address _weth, address _treasury) {
require(_weth != address(0), "WOWMAX: Wrong WETH address");
require(_treasury != address(0), "WOWMAX: Wrong treasury address");
WETH = IWETH(_weth);
treasury = _treasury;
}
/**
* @dev fallback function to receive native tokens
*/
receive() external payable {}
/**
* @dev fallback function to process various protocols callback functions
*/
fallback() external onlyDuringSwap {
(bool success, int256 amount0Delta, int256 amount1Delta, bytes calldata data) = UniswapV3.decodeCallback({
dataWithSelector: msg.data
});
require(success, "WOWMAX: unsupported callback");
UniswapV3.invokeCallback(amount0Delta, amount1Delta, data);
}
// Admin functions
/**
* @dev withdraws tokens from a contract, in case of leftovers after a swap, invalid swap requests,
* or direct transfers. Only callable by the owner.
* @param token Token to be withdrawn
* @param amount Amount to be withdrawn
*/
function withdraw(address token, uint256 amount) external onlyOwner {
IERC20(token).safeTransfer(treasury, amount);
}
/**
* @dev withdraws native tokens from a contract, in case of leftovers after a swap or invalid swap requests.
* Only callable by the owner.
* @param amount Amount to be withdrawn
*/
function withdrawETH(uint256 amount) external onlyOwner {
(bool sent, ) = payable(treasury).call{ value: amount }("");
require(sent, "Wowmax: Failed to send native tokens");
}
/**
* @dev sets the max fee percentage. Only callable by the owner.
* @param _maxFeePercentage Max fee percentage
*/
function setMaxFeePercentage(uint256 _maxFeePercentage) external onlyOwner {
maxFeePercentage = _maxFeePercentage;
}
/**
* @dev sets the max allowed slippage. Only callable by the owner.
* @param _maxSlippage Max allowed slippage percentage
*/
function setMaxSlippage(uint256 _maxSlippage) external onlyOwner {
maxSlippage = _maxSlippage;
}
// Callbacks
/**
* @dev callback for Maverick V1 pools. Not allowed to be executed outside of a swap operation
* @param amountToPay Amount to be paid
* @param amountOut Amount to be received
* @param data Additional data to be passed to the callback function
*/
function swapCallback(uint256 amountToPay, uint256 amountOut, bytes calldata data) external onlyDuringSwap {
MaverickV1.invokeCallback(amountToPay, amountOut, data);
}
/**
* @dev callback for Algebra V1 pairs. Not allowed to be executed outside of a swap operation
* @param amount0Delta Amount of token0 to be transferred to the caller
* @param amount1Delta Amount of token1 to be transferred to the caller
* @param data Additional data to be passed to the callback function
*/
function algebraSwapCallback(
int256 amount0Delta,
int256 amount1Delta,
bytes calldata data
) external onlyDuringSwap {
AlgebraV1.invokeCallback(amount0Delta, amount1Delta, data);
}
/**
* @notice Called to msg.sender in iZiSwapPool#swapX2Y(DesireY) call
* @param x Amount of tokenX trader will pay
* @param data Any dadta passed though by the msg.sender via the iZiSwapPool#swapX2Y(DesireY) call
*/
function swapX2YCallback(uint256 x, uint256 /*y*/, bytes calldata data) external onlyDuringSwap {
Iziswap.transferTokens(x, data);
}
/**
* @notice Called to msg.sender in iZiSwapPool#swapY2X(DesireX) call
* @param y Amount of tokenY trader will pay
* @param data Any dadta passed though by the msg.sender via the iZiSwapPool#swapY2X(DesireX) call
*/
function swapY2XCallback(uint256 /*x*/, uint256 y, bytes calldata data) external onlyDuringSwap {
Iziswap.transferTokens(y, data);
}
/**
* @notice Callback for DODO v3 Pools
* @param token Token to be transferred to the caller
* @param value Amount of tokens to be transferred to the caller
* @param data Additional data to be passed to the callback function
*/
function d3MMSwapCallBack(address token, uint256 value, bytes calldata data) external {
DODOV3.invokeCallback(token, value, data);
}
// Swap functions
/**
* @inheritdoc IWowmaxRouter
*/
function swap(
ExchangeRequest calldata request
) external virtual payable override reentrancyProtectedSwap returns (uint256[] memory amountsOut) {
amountsOut = _swap(request);
}
/**
* @dev swap inner logic
*/
function _swap(
ExchangeRequest calldata request
) internal returns (uint256[] memory amountsOut) {
checkRequest(request);
uint256 amountIn = receiveTokens(request);
for (uint256 i = 0; i < request.exchangeRoutes.length; i++) {
exchange(request.exchangeRoutes[i]);
}
amountsOut = sendTokens(request);
emit SwapExecuted(
msg.sender,
request.from == address(0) ? address(WETH) : request.from,
amountIn,
request.to,
amountsOut
);
}
/**
* @dev receives tokens from the caller
* @param request Exchange request that contains the token to be received parameters.
*/
function receiveTokens(ExchangeRequest calldata request) private returns (uint256) {
uint256 amountIn;
if (msg.value > 0 && request.from == address(0) && request.amountIn == 0) {
amountIn = msg.value;
WETH.deposit{ value: amountIn }();
} else {
if (request.amountIn > 0) {
amountIn = request.amountIn;
IERC20(request.from).safeTransferFrom(msg.sender, address(this), amountIn);
}
}
return amountIn;
}
/**
* @dev sends swapped received tokens to the caller and treasury
* @param request Exchange request that contains output tokens parameters
*/
function sendTokens(ExchangeRequest calldata request) private returns (uint256[] memory amountsOut) {
amountsOut = new uint256[](request.to.length);
uint256 amountOut;
IERC20 token;
for (uint256 i = 0; i < request.to.length; i++) {
token = IERC20(request.to[i]);
amountOut = token.balanceOf(address(this));
uint256 feeAmount;
if (amountOut > request.amountOutExpected[i]) {
feeAmount = amountOut - request.amountOutExpected[i];
uint256 maxFeeAmount = (amountOut * maxFeePercentage) / 10000;
if (feeAmount > maxFeeAmount) {
feeAmount = maxFeeAmount;
amountsOut[i] = amountOut - feeAmount;
} else {
amountsOut[i] = request.amountOutExpected[i];
}
} else {
require(
amountOut >= (request.amountOutExpected[i] * (10000 - request.slippage[i])) / 10000,
"WOWMAX: Insufficient output amount"
);
amountsOut[i] = amountOut;
}
if (address(token) == address(WETH)) {
WETH.withdraw(amountOut);
}
transfer(token, treasury, feeAmount);
transfer(token, msg.sender, amountsOut[i]);
}
}
/**
* @dev transfers token to the recipient
* @param token Token to be transferred
* @param to Recipient address
* @param amount Amount to be transferred
*/
function transfer(IERC20 token, address to, uint256 amount) private {
//slither-disable-next-line incorrect-equality
if (amount == 0) {
return;
}
if (address(token) == address(WETH)) {
//slither-disable-next-line arbitrary-send-eth //recipient is either a msg.sender or a treasury
(bool sent, ) = payable(to).call{ value: amount }("");
require(sent, "Wowmax: Failed to send native tokens");
} else {
token.safeTransfer(to, amount);
}
}
/**
* @dev executes an exchange operation according to the provided route
* @param exchangeRoute Route to be executed
*/
function exchange(ExchangeRoute calldata exchangeRoute) private returns (uint256) {
uint256 amountIn = IERC20(exchangeRoute.from).balanceOf(address(this));
uint256 amountOut;
for (uint256 i = 0; i < exchangeRoute.swaps.length; i++) {
amountOut += executeSwap(
exchangeRoute.from,
(amountIn * exchangeRoute.swaps[i].part) / exchangeRoute.parts,
exchangeRoute.swaps[i]
);
}
return amountOut;
}
/**
* @dev executes a swap operation according to the provided parameters
* @param from Token to be swapped
* @param amountIn Amount to be swapped
* @param swapData Swap data that contains the swap parameters
*/
function executeSwap(address from, uint256 amountIn, Swap calldata swapData) private returns (uint256) {
if (swapData.family == UNISWAP_V3) {
return UniswapV3.swap(amountIn, swapData);
} else if (swapData.family == HASHFLOW) {
return Hashflow.swap(from, amountIn, swapData);
} else if (swapData.family == WOMBAT) {
return Wombat.swap(from, amountIn, swapData);
} else if (swapData.family == LEVEL) {
return Level.swap(from, amountIn, swapData);
} else if (swapData.family == DODO_V2) {
return DODOV2.swap(from, amountIn, swapData);
} else if (swapData.family == DODO_V3) {
return DODOV3.swap(from, amountIn, swapData);
} else if (swapData.family == WOOFI) {
return WooFi.swap(from, amountIn, swapData);
} else if (swapData.family == UNISWAP_V2) {
return UniswapV2.swap(from, amountIn, swapData);
} else if (swapData.family == CURVE) {
return Curve.swap(from, amountIn, swapData);
} else if (swapData.family == PANCAKESWAP_STABLE) {
return PancakeSwapStable.swap(from, amountIn, swapData);
} else if (swapData.family == DODO_V1) {
return DODOV1.swap(from, amountIn, swapData);
} else if (swapData.family == BALANCER_V2) {
return BalancerV2.swap(from, amountIn, swapData);
} else if (swapData.family == MAVERICK_V1) {
return MaverickV1.swap(amountIn, swapData);
} else if (swapData.family == SADDLE) {
return Saddle.swap(from, amountIn, swapData);
} else if (swapData.family == FULCROM) {
return Fulcrom.swap(from, amountIn, swapData);
} else if (swapData.family == UNISWAP_V2_ROUTER) {
return UniswapV2.routerSwap(from, amountIn, swapData);
} else if (swapData.family == ELASTIC) {
return Elastic.swap(from, amountIn, swapData);
} else if (swapData.family == ALGEBRA_V1) {
return AlgebraV1.swap(from, amountIn, swapData);
} else if (swapData.family == ALGEBRA_V1_9) {
return AlgebraV1.swap(from, amountIn, swapData);
} else if (swapData.family == SYNCSWAP) {
return SyncSwap.swap(from, amountIn, swapData);
} else if (swapData.family == VOOI) {
return Vooi.swap(from, amountIn, swapData);
} else if (swapData.family == VELOCORE_V2) {
return VelocoreV2.swap(address(WETH), from, amountIn, swapData);
} else if (swapData.family == IZISWAP) {
return Iziswap.swap(from, amountIn, swapData);
} else if (swapData.family == VELODROME) {
return Velodrome.swap(from, amountIn, swapData);
} else {
revert("WOWMAX: Unknown DEX family");
}
}
// Checks and verifications
/**
* @dev checks the swap request parameters
* @param request Exchange request to be checked
*/
function checkRequest(ExchangeRequest calldata request) private view {
require(request.to.length > 0, "WOWMAX: No output tokens specified");
require(request.to.length == request.amountOutExpected.length, "WOWMAX: Wrong amountOutExpected length");
require(request.to.length == request.slippage.length, "WOWMAX: Wrong slippage length");
for (uint256 i = 0; i < request.to.length; i++) {
require(request.to[i] != address(0), "WOWMAX: Wrong output token address");
require(request.amountOutExpected[i] > 0, "WOWMAX: Wrong amountOutExpected value");
require(request.slippage[i] <= maxSlippage, "WOWMAX: Slippage is too high");
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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 anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing 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 v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.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.8.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/draft-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;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
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));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
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");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
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");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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
* ====
*
* [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://diligence.consensys.net/posts/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.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.7;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/**
* @title Wrapped Ether contract interface
*/
interface IWETH is IERC20 {
/**
* @dev `msg.value` of ETH sent to this contract grants caller account a matching increase in WETH token balance.
*/
function deposit() external payable;
/**
* @dev Burn WETH token from caller account and withdraw matching ETH to the same.
* @param wad Amount of WETH token to burn.
*/
function withdraw(uint wad) external;
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.7;
/**
* @title IWowmaxRouter
* @notice Interface for the Wowmax Router, describes the functions that can be called from the router
* and corresponding data structures
*/
interface IWowmaxRouter {
/**
* @notice Swap operation details structure
* @param to Target token address
* @param part Part of the currently owned tokens to be swapped. Total number of parts
* is defined in the ExchangeRoute structure
* @param addr Contract address that performs the swap
* @param family Contract DEX family
* @param data Additional data that is required for a specific DEX protocol
*/
struct Swap {
address to;
uint256 part;
address addr;
bytes32 family;
bytes data;
}
/**
* @notice Exchange route details structure
* @param from Source token address
* @param parts Total number of parts of the currently owned tokens
* @param swaps Array of swaps for a specified token
*/
struct ExchangeRoute {
address from;
uint256 parts;
Swap[] swaps;
}
/**
* @notice Exchange request details structure
* @param from Source token address
* @param amountIn Source token amount to swap
* @param to Array of target token addresses
* @param exchangeRoutes Array of exchange routes
* @param slippage Array of slippage tolerance values for each target token
* @param amountOutExpected Array fo expected output amounts for each target token
*/
struct ExchangeRequest {
address from;
uint256 amountIn;
address[] to;
ExchangeRoute[] exchangeRoutes;
uint256[] slippage;
uint256[] amountOutExpected;
}
/**
* @notice Emitted when a swap is executed
* @param account Account that initiated the swap
* @param from Source token address
* @param amountIn Source token amount that was swapped
* @param to Array of target token addresses
* @param amountOut Array of amounts that were received for each target token
*/
event SwapExecuted(
address indexed account,
address indexed from,
uint256 amountIn,
address[] to,
uint256[] amountOut
);
/**
* @notice Executes a token swap
* @dev if from token is address(0) and amountIn is 0,
* then chain native token is used as a source token, and value is used as an input amount
* @param request Exchange request to be executed
* @return amountsOut Array of output amounts that were received for each target token
*/
function swap(ExchangeRequest calldata request) external payable returns (uint256[] memory amountsOut);
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.7;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../interfaces/IWowmaxRouter.sol";
/**
* @title Algebra V1 pool interface
*/
interface IAlgebraV1Pool {
/**
* @notice Swap token0 for token1, or token1 for token0
* @dev The caller of this method receives a callback in the form of IAlgebraSwapCallback# AlgebraSwapCallback
* @param recipient The address to receive the output of the swap
* @param zeroToOne The direction of the swap, true for token0 to token1, false for token1 to token0
* @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)
* @param limitSqrtPrice The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this
* value after the swap. If one for zero, the price cannot be greater than this value after the swap
* @param data Any data to be passed through to the callback. If using the Router it should contain
* SwapRouter#SwapCallbackData
* @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive
* @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive
*/
function swap(
address recipient,
bool zeroToOne,
int256 amountSpecified,
uint160 limitSqrtPrice,
bytes calldata data
) external returns (int256 amount0, int256 amount1);
/**
* @dev Returns the address of the first token of the Uniswap v3 based pair
* @return Address of the first token of the pair
*/
function token0() external view returns (address);
/**
* @dev Returns the address of the second token of the Uniswap v3 based pair
* @return Address of the second token of the pair
*/
function token1() external view returns (address);
}
/**
* @title Algebra V1 library
* @notice Functions to swap tokens on Algebra V1 based protocols
*/
library AlgebraV1 {
using SafeERC20 for IERC20;
/**
* @dev Swaps tokens on a Algebra V1 based protocol contract
* @param from Address of token to swap from
* @param amountIn Amount of token to swap
* @param swapData Swap operation details. The `data` field should contain two int128 values,
* which are the indices of the tokens to swap from and to
* @return amountOut Amount of tokens received
*/
function swap(
address from,
uint256 amountIn,
IWowmaxRouter.Swap memory swapData
) internal returns (uint256 amountOut) {
bool zeroToOne = from == IAlgebraV1Pool(swapData.addr).token0();
uint160 sqrtPriceLimitX96 = zeroToOne ? 4295128740 : 1461446703485210103287273052203988822378723970341;
(int256 amount0, int256 amount1) = IAlgebraV1Pool(swapData.addr).swap(
address(this),
zeroToOne,
int256(amountIn),
sqrtPriceLimitX96,
new bytes(0)
);
amountOut = uint(zeroToOne ? -amount1 : -amount0);
}
/**
* @dev Performs Algebra V1 callback, sends required amounts of tokens to the pair
* @param amount0Delta Amount of the first token to send
* @param amount1Delta Amount of the second token to send
*/
function invokeCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata /*_data*/) internal {
if (amount0Delta > 0 && amount1Delta < 0) {
IERC20(IAlgebraV1Pool(msg.sender).token0()).safeTransfer(msg.sender, uint256(amount0Delta));
} else if (amount0Delta < 0 && amount1Delta > 0) {
IERC20(IAlgebraV1Pool(msg.sender).token1()).safeTransfer(msg.sender, uint256(amount1Delta));
} else {
revert("WOWMAX: Algebra V1 invariant violation");
}
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.7;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../interfaces/IWowmaxRouter.sol";
/**
* @title Balancer Asset interface
*/
interface IBalancerAsset {
// solhint-disable-previous-line no-empty-blocks
}
/**
* @title Balancer vault interface
*/
interface IBalancerVault {
enum SwapKind {
GIVEN_IN,
GIVEN_OUT
}
/**
* @dev Data for a single swap executed by `swap`. `amount` is either `amountIn` or `amountOut` depending on
* the `kind` value.
*
* `assetIn` and `assetOut` are either token addresses, or the IAsset sentinel value for ETH (the zero address).
* Note that Pools never interact with ETH directly: it will be wrapped to or unwrapped from WETH by the Vault.
*
* The `userData` field is ignored by the Vault, but forwarded to the Pool in the `onSwap` hook, and may be
* used to extend swap behavior.
*/
struct SingleSwap {
bytes32 poolId;
SwapKind kind;
IBalancerAsset assetIn;
IBalancerAsset assetOut;
uint256 amount;
bytes userData;
}
/**
* @dev All tokens in a swap are either sent from the `sender` account to the Vault, or from the Vault to the
* `recipient` account.
*
* If the caller is not `sender`, it must be an authorized relayer for them.
*
* If `fromInternalBalance` is true, the `sender`'s Internal Balance will be preferred, performing an ERC20
* transfer for the difference between the requested amount and the User's Internal Balance (if any). The `sender`
* must have allowed the Vault to use their tokens via `IERC20.approve()`. This matches the behavior of
* `joinPool`.
*
* If `toInternalBalance` is true, tokens will be deposited to `recipient`'s internal balance instead of
* transferred. This matches the behavior of `exitPool`.
*
* Note that ETH cannot be deposited to or withdrawn from Internal Balance: attempting to do so will trigger a
* revert.
*/
struct FundManagement {
address sender;
bool fromInternalBalance;
address payable recipient;
bool toInternalBalance;
}
/**
* @dev Performs a swap with a single Pool.
*
* If the swap is 'given in' (the number of tokens to send to the Pool is known), it returns the amount of tokens
* taken from the Pool, which must be greater than or equal to `limit`.
*
* If the swap is 'given out' (the number of tokens to take from the Pool is known), it returns the amount of tokens
* sent to the Pool, which must be less than or equal to `limit`.
*
* Internal Balance usage and the recipient are determined by the `funds` struct.
*
* Emits a `Swap` event.
*/
function swap(
SingleSwap memory singleSwap,
FundManagement memory funds,
uint256 limit,
uint256 deadline
) external payable returns (uint256);
}
/**
* @title Balancer library
* @notice Functions to swap tokens on Balancer and compatible protocols
*/
library BalancerV2 {
using SafeERC20 for IERC20;
/**
* @dev Performs a swap through a Balancer based vault
* @param from Address of a token to swap from
* @param amountIn Amount of tokens to swap
* @param swapData Swap operation details. The `data` field should contain poolId and vault address
* @return amountOut Amount of tokens received
*/
function swap(
address from,
uint256 amountIn,
IWowmaxRouter.Swap memory swapData
) internal returns (uint256 amountOut) {
(bytes32 poolId, address vaultAddress) = abi.decode(swapData.data, (bytes32, address));
IBalancerVault.SingleSwap memory singleSwap = IBalancerVault.SingleSwap({
poolId: poolId,
kind: IBalancerVault.SwapKind.GIVEN_IN,
assetIn: IBalancerAsset(from),
assetOut: IBalancerAsset(swapData.to),
amount: amountIn,
userData: new bytes(0)
});
IBalancerVault.FundManagement memory funds = IBalancerVault.FundManagement({
sender: address(this),
fromInternalBalance: false,
recipient: payable(address(this)),
toInternalBalance: false
});
IERC20(from).safeIncreaseAllowance(vaultAddress, amountIn);
amountOut = IBalancerVault(vaultAddress).swap(singleSwap, funds, 0, type(uint256).max);
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.7;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../interfaces/IWowmaxRouter.sol";
/**
* @title Curve pool interface
*/
interface ICurvePool {
/**
* @dev Swaps tokens on a Curve based protocol contract
* @param i Index of token to swap from
* @param j Index of token to swap to
* @param dx Amount of token to swap
* @param min_dy Minimum amount of tokens to receive
*/
function exchange(int128 i, int128 j, uint256 dx, uint256 min_dy) external;
}
/**
* @title Curve library
* @notice Functions to swap tokens on Curve based protocols
*/
library Curve {
using SafeERC20 for IERC20;
/**
* @dev Swaps tokens on a Curve based protocol contract
* @param from Address of token to swap from
* @param amountIn Amount of token to swap
* @param swapData Swap operation details. The `data` field should contain two int128 values,
* which are the indices of the tokens to swap from and to
* @return amountOut Amount of tokens received
*/
function swap(
address from,
uint256 amountIn,
IWowmaxRouter.Swap memory swapData
) internal returns (uint256 amountOut) {
(int128 i, int128 j) = abi.decode(swapData.data, (int128, int128));
uint256 balanceBefore = IERC20(swapData.to).balanceOf(address(this));
//slither-disable-next-line unused-return //it's safe to ignore
IERC20(from).safeIncreaseAllowance(swapData.addr, amountIn);
ICurvePool(swapData.addr).exchange(i, j, amountIn, 0);
amountOut = IERC20(swapData.to).balanceOf(address(this)) - balanceBefore;
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.7;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../interfaces/IWowmaxRouter.sol";
/**
* @title DODO v1 pool interface
*/
interface IDODOV1Pool {
/**
* @dev Sells base token for quote token
* @param amount Amount of base token to sell
* @param minReceiveQuote Minimum amount of quote token to receive
* @param data Additional data to be used in callback hook
* @return amountOut Amount of quote token received
*/
function sellBaseToken(uint256 amount, uint256 minReceiveQuote, bytes calldata data) external returns (uint256);
/**
* @dev Buys base token with quote token
* @param amount Amount of base token to buy
* @param maxPayQuote Maximum amount of quote token to pay
* @param data Additional data to be used in callback hook
* @return amountOut Amount of base token received
*/
function buyBaseToken(uint256 amount, uint256 maxPayQuote, bytes calldata data) external returns (uint256);
}
/**
* @title DODO v1 library
* @notice Functions to swap tokens on DODO v1 protocol
*/
library DODOV1 {
using SafeERC20 for IERC20;
/**
* @dev Swaps tokens on a Curve based protocol contract
* @param from Address of token to swap from
* @param amountIn Amount of token to swap
* @param swapData Swap operation details. The `data` field should contain two int128 values, i and j,
* which are the indexes of the tokens to swap
* @return amountOut Amount of tokens received
*/
function swap(
address from,
uint256 amountIn,
IWowmaxRouter.Swap memory swapData
) internal returns (uint256 amountOut) {
//slither-disable-next-line unused-return //it's safe to ignore
IERC20(from).safeIncreaseAllowance(swapData.addr, amountIn);
amountOut = IDODOV1Pool(swapData.addr).sellBaseToken(amountIn, 0, "");
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.7;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../interfaces/IWowmaxRouter.sol";
/**
* @title DODO v2 pool interface
*/
interface IDODOV2Pool {
/**
* @dev Swaps tokens on a DODO v2 based protocol contract
* @param to Address of token to swap to
* @return amountOut Amount of tokens received
*/
function sellBase(address to) external returns (uint256);
/**
* @dev Swaps tokens on a DODO v2 based protocol contract
* @param to Address of token to swap to
* @return amountOut Amount of tokens received
*/
function sellQuote(address to) external returns (uint256);
}
/**
* @title DODO v2 library
* @notice Functions to swap tokens on DODO v2 protocol
*/
library DODOV2 {
uint8 internal constant BASE_TO_QUOTE = 0;
using SafeERC20 for IERC20;
/**
* @dev Swaps tokens on a DODO v2 pool contract
* @param from Address of token to swap from
* @param amountIn Amount of tokens to swap
* @param swapData Swap operation details. The `data` field should contain one uint8 value,
* which is the direction of the swap
* @return amountOut Amount of tokens received
*/
function swap(
address from,
uint256 amountIn,
IWowmaxRouter.Swap memory swapData
) internal returns (uint256 amountOut) {
IERC20(from).safeTransfer(swapData.addr, amountIn);
uint8 direction = abi.decode(swapData.data, (uint8));
if (direction == BASE_TO_QUOTE) {
amountOut = IDODOV2Pool(swapData.addr).sellBase(address(this));
} else {
amountOut = IDODOV2Pool(swapData.addr).sellQuote(address(this));
}
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.7;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../interfaces/IWowmaxRouter.sol";
/**
* @title DODO v3 pool interface
*/
interface IDODOV3Pool {
/**
* @dev Swaps tokens on a DODO v3 based protocol contract
* @param to Address to send swapped tokens to
* @param fromToken Address of a token to swap from
* @param toToken Address of a token to swap to
* @param fromAmount Amount of tokens to swap
* @param minReceiveAmount Minimal amount of tokens to receive
* @param data Data to be passed to the Dodo V3 Swap Callback contract
* @return Amount of tokens received
*/
function sellToken(
address to,
address fromToken,
address toToken,
uint256 fromAmount,
uint256 minReceiveAmount,
bytes calldata data
) external returns (uint256);
}
/**
* @title DODO v3 library
* @notice Functions to swap tokens on DODO v3 protocol
*/
library DODOV3 {
uint8 internal constant BASE_TO_QUOTE = 0;
using SafeERC20 for IERC20;
/**
* @dev Swaps tokens on a DODO v3 pool contract
* @param from Address of token to swap from
* @param amountIn Amount of tokens to swap
* @param swapData Swap operation details. The `data` field should be empty
* @return amountOut Amount of tokens received
*/
function swap(
address from,
uint256 amountIn,
IWowmaxRouter.Swap memory swapData
) internal returns (uint256 amountOut) {
return IDODOV3Pool(swapData.addr).sellToken(address(this), from, swapData.to, amountIn, 0, "");
}
/**
* @dev Callback function to receive tokens from DODO v3 pool contract
* @param token Address of token to receive
* @param amount Amount of tokens to receive
*/
function invokeCallback(address token, uint256 amount, bytes calldata /*data*/) internal {
IERC20(token).safeTransfer(msg.sender, amount);
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.7;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../interfaces/IWowmaxRouter.sol";
/**
* @title Elastic pool interface
*/
interface IElasticPool {
/**
* @notice Swap token0 -> token1, or vice versa
* @dev This method's caller receives a callback in the form of ISwapCallback#swapCallback
* @dev swaps will execute up to limitSqrtP or swapQty is fully used
* @param recipient The address to receive the swap output
* @param swapQty The swap quantity, which implicitly configures the swap as exact input (>0), or exact output (<0)
* @param isToken0 Whether the swapQty is specified in token0 (true) or token1 (false)
* @param limitSqrtP the limit of sqrt price after swapping
* could be MAX_SQRT_RATIO-1 when swapping 1 -> 0 and MIN_SQRT_RATIO+1 when swapping 0 -> 1 for no limit swap
* @param data Any data to be passed through to the callback
* @return qty0 Exact token0 qty sent to recipient if < 0. Minimally received quantity if > 0.
* @return qty1 Exact token1 qty sent to recipient if < 0. Minimally received quantity if > 0.
*/
function swap(
address recipient,
int256 swapQty,
bool isToken0,
uint160 limitSqrtP,
bytes calldata data
) external returns (int256 qty0, int256 qty1);
/**
* @dev Returns the address of the first token of the Uniswap v3 based pair
* @return Address of the first token of the pair
*/
function token0() external view returns (address);
/**
* @dev Returns the address of the second token of the Uniswap v3 based pair
* @return Address of the second token of the pair
*/
function token1() external view returns (address);
}
/**
* @title Elastic library
* @notice Functions to swap tokens on Elastic based protocols
*/
library Elastic {
using SafeERC20 for IERC20;
/**
* @dev Swaps tokens on Elastic based protocol contract
* @param from Address of token to swap from
* @param amountIn Amount of token to swap
* @param swapData Swap operation details. The `data` field should contain two int128 values,
* which are the indices of the tokens to swap from and to
* @return amountOut Amount of tokens received
*/
function swap(
address from,
uint256 amountIn,
IWowmaxRouter.Swap memory swapData
) internal returns (uint256 amountOut) {
bool isToken0 = from == IElasticPool(swapData.addr).token0();
uint160 sqrtPriceLimitX96 = isToken0 ? 4295128740 : 1461446703485210103287273052203988822378723970341;
(int256 amount0, int256 amount1) = IElasticPool(swapData.addr).swap(
address(this),
int256(amountIn),
isToken0,
sqrtPriceLimitX96,
new bytes(0)
);
amountOut = uint(isToken0 ? -amount1 : -amount0);
}
/**
* @dev Performs Elastic callback, sends required amounts of tokens to the pair
* @param deltaQty0 Amount of the first token to send
* @param deltaQty1 Amount of the second token to send
*/
function invokeCallback(int256 deltaQty0, int256 deltaQty1, bytes calldata /*_data*/) internal {
if (deltaQty0 > 0 && deltaQty1 < 0) {
IERC20(IElasticPool(msg.sender).token0()).safeTransfer(msg.sender, uint256(deltaQty0));
} else if (deltaQty0 < 0 && deltaQty1 > 0) {
IERC20(IElasticPool(msg.sender).token1()).safeTransfer(msg.sender, uint256(deltaQty1));
} else {
revert("WOWMAX: Elastic invariant violation");
}
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.7;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../interfaces/IWowmaxRouter.sol";
/**
* @title Fulcrom pool interface
*/
interface IFulcromPool {
/**
* @dev Swaps tokens on a Fulcrom based protocol contract
* @param _tokenIn Address of a token to swap from
* @param _tokenOut Address of a token to swap to
* @param _receiver Address to send swapped tokens to
* @return amountOut Amount of tokens received
*/
function swap(address _tokenIn, address _tokenOut, address _receiver) external returns (uint256);
}
/**
* @title Fulcrom library
* @notice Functions to swap tokens on Fulcrom protocol
*/
library Fulcrom {
using SafeERC20 for IERC20;
/**
* @dev Swaps tokens on a Fulcrom pool contract
* @param from Address of a token to swap from
* @param amountIn Amount of tokens to swap
* @param swapData Swap operation details. The `data` field should be empty
* @return amountOut Amount of tokens received
*/
function swap(
address from,
uint256 amountIn,
IWowmaxRouter.Swap memory swapData
) internal returns (uint256 amountOut) {
IERC20(from).safeTransfer(swapData.addr, amountIn);
amountOut = IFulcromPool(swapData.addr).swap(from, swapData.to, address(this));
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.7;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../interfaces/IWowmaxRouter.sol";
/**
* @title Hashflow Router interface
*/
interface IHashflowRouter {
struct RFQTQuote {
/// @notice The address of the HashflowPool to trade against.
address pool;
/**
* @notice The external account linked to the HashflowPool.
* If the HashflowPool holds funds, this should be address(0).
*/
address externalAccount;
/// @notice The recipient of the quoteToken at the end of the trade.
address trader;
/**
* @notice The account "effectively" making the trade (ultimately receiving the funds).
* This is commonly used by aggregators, where a proxy contract (the 'trader')
* receives the quoteToken, and the effective trader is the user initiating the call.
*
* This field DOES NOT influence movement of funds. However, it is used to check against
* quote replay.
*/
address effectiveTrader;
/// @notice The token that the trader sells.
address baseToken;
/// @notice The token that the trader buys.
address quoteToken;
/**
* @notice The amount of baseToken sold in this trade. The exchange rate
* is going to be preserved as the quoteTokenAmount / baseTokenAmount ratio.
*
* Most commonly, effectiveBaseTokenAmount will == baseTokenAmount.
*/
uint256 effectiveBaseTokenAmount;
/// @notice The max amount of baseToken sold.
uint256 baseTokenAmount;
/// @notice The amount of quoteToken bought when baseTokenAmount is sold.
uint256 quoteTokenAmount;
/// @notice The Unix timestamp (in seconds) when the quote expires.
/// @dev This gets checked against block.timestamp.
uint256 quoteExpiry;
/// @notice The nonce used by this effectiveTrader. Nonces are used to protect against replay.
uint256 nonce;
/// @notice Unique identifier for the quote.
/// @dev Generated off-chain via a distributed UUID generator.
bytes32 txid;
/// @notice Signature provided by the market maker (EIP-191).
bytes signature;
}
/**
* @notice Executes an intra-chain RFQ-T trade.
* @param quote The quote data to be executed.
*/
function tradeRFQT(RFQTQuote memory quote) external payable;
}
// @title Hashflow library
// @notice Functions to swap tokens on Hashflow protocol
library Hashflow {
using SafeERC20 for IERC20;
/**
* @dev Swaps tokens on a Hashflow router contract
* @param from Address of a token to swap from
* @param amountIn Amount of tokens to swap
* @param swapData Swap operation details. The `data` field should contain encoded RFQTQuote structure
* @return amountOut Amount of tokens received
*/
function swap(
address from,
uint256 amountIn,
IWowmaxRouter.Swap memory swapData
) internal returns (uint256 amountOut) {
IHashflowRouter.RFQTQuote memory quote = abi.decode(swapData.data, (IHashflowRouter.RFQTQuote));
//slither-disable-next-line unused-return //it's safe to ignore
IERC20(from).safeIncreaseAllowance(swapData.addr, amountIn);
if (amountIn < quote.baseTokenAmount) {
quote.effectiveBaseTokenAmount = amountIn;
}
uint256 balanceBefore = IERC20(swapData.to).balanceOf(address(this));
IHashflowRouter(swapData.addr).tradeRFQT(quote);
amountOut = IERC20(swapData.to).balanceOf(address(this)) - balanceBefore;
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.7;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../interfaces/IWowmaxRouter.sol";
/**
* @title Iziswap pool interface
*/
interface IIziswapPool {
/**
* @notice Swap tokenX for tokenY, given max amount of tokenX user willing to pay.
* @param recipient the address to receive tokenY
* @param amount the max amount of tokenX user willing to pay
* @param lowPt the lowest point(price) of x/y during swap
* @param data any data to be passed through to the callback
* @return amountX amount of tokenX acquired
* @return amountY amount of tokenY payed
*/
function swapX2Y(
address recipient,
uint128 amount,
int24 lowPt,
bytes calldata data
) external returns (uint256 amountX, uint256 amountY);
/**
* @notice Swap tokenY for tokenX, given max amount of tokenY user willing to pay.
* @param recipient the address to receive tokenX
* @param amount the max amount of tokenY user willing to pay
* @param highPt the highest point(price) of x/y during swap
* @param data any data to be passed through to the callback
* @return amountX amount of tokenX payed
* @return amountY amount of tokenY acquired
*/
function swapY2X(
address recipient,
uint128 amount,
int24 highPt,
bytes calldata data
) external returns (uint256 amountX, uint256 amountY);
}
/**
* @title Iziswap library
* @notice Functions to swap tokens on Iziswap based protocols
*/
library Iziswap {
uint256 constant X2Y = 0;
using SafeERC20 for IERC20;
/**
* @dev Swaps tokens on a Iziswap based protocol contract
* @param from Address of token to swap from
* @param amountIn Amount of token to swap
* @param swapData Swap operation details. The `data` field should contain two int128 values,
* which are the indices of the tokens to swap from and to
* @return amountOut Amount of tokens received
*/
function swap(
address from,
uint256 amountIn,
IWowmaxRouter.Swap memory swapData
) internal returns (uint256 amountOut) {
int24 pt = abi.decode(swapData.data, (int24));
//slither-disable-next-line unused-return //it's safe to ignore
bytes memory data = abi.encode(from);
if (from < swapData.to) {
(, amountOut) = IIziswapPool(swapData.addr).swapX2Y(address(this), uint128(amountIn), pt, data);
} else {
(amountOut, ) = IIziswapPool(swapData.addr).swapY2X(address(this), uint128(amountIn), pt, data);
}
}
function transferTokens(uint256 amount, bytes calldata data) internal {
address token = abi.decode(data, (address));
IERC20(token).safeTransfer(msg.sender, amount);
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.7;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../interfaces/IWowmaxRouter.sol";
/**
* @title Level pool interface
*/
interface ILevelPool {
/**
* @dev Swaps tokens on a Level based protocol contract
* @param _tokenIn Address of a token to swap from
* @param _tokenOut Address of a token to swap to
* @param _minOut Minimal amount of tokens to receive
* @param _to Address to send swapped tokens to
* @param extradata Data to be used in callback
*/
function swap(address _tokenIn, address _tokenOut, uint256 _minOut, address _to, bytes calldata extradata) external;
}
/**
* @title Level library
* @notice Functions to swap tokens on Level protocol
*/
library Level {
using SafeERC20 for IERC20;
/**
* @dev Swaps tokens on a Level pool contract
* @param from Address of a token to swap from
* @param amountIn Amount of tokens to swap
* @param swapData Swap operation details. The `data` field should be empty
* @return amountOut Amount of tokens received
*/
function swap(
address from,
uint256 amountIn,
IWowmaxRouter.Swap memory swapData
) internal returns (uint256 amountOut) {
IERC20(from).safeTransfer(swapData.addr, amountIn);
uint256 balanceBefore = IERC20(swapData.to).balanceOf(address(this));
ILevelPool(swapData.addr).swap(from, swapData.to, 0, address(this), new bytes(0));
amountOut = IERC20(swapData.to).balanceOf(address(this)) - balanceBefore;
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.7;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../interfaces/IWowmaxRouter.sol";
/**
* @title Maverick V1 pool interface
*/
interface IMaverickV1Pool {
/**
* @dev Swaps tokens on a Maverick v1 based pool
* @param recipient Address to send swapped tokens to
* @param amount Amount of tokens to swap
* @param tokenAIn Flag that indicates token direction. True for tokenA to tokenB direction,
* false for tokenB to tokenA
* @param exactOutput Flag that indicates whether the amount is exact output or input
* @param sqrtPriceLimit Price limit within which swap is processed
* @param data Additional data to be send in callback function
* @return amountIn Amount of the input token to be paid
* @return amountOut Amount of the output token to be received
*/
function swap(
address recipient,
uint256 amount,
bool tokenAIn,
bool exactOutput,
uint256 sqrtPriceLimit,
bytes calldata data
) external returns (uint256 amountIn, uint256 amountOut);
/**
* @dev Returns the address of the first token of the Maverick v1 based pair
* @return Address of the first token of the pair
*/
function tokenA() external view returns (address);
/**
* @dev Returns the address of the second token of the Maverick v1 based pair
* @return Address of the second token of the pair
*/
function tokenB() external view returns (address);
}
/**
* @title Maverick v1 library
* @notice Functions to swap tokens on Maverick v1 and compatible protocol
*/
library MaverickV1 {
using SafeERC20 for IERC20;
/**
* @dev Swaps tokens on a Maverick v1 based pair
* @param amountIn Amount of tokens to swap
* @param swapData Swap data. The `data` field should contain zeroForOne flag
* @return amountOut Amount of tokens received
*/
function swap(uint256 amountIn, IWowmaxRouter.Swap memory swapData) internal returns (uint256 amountOut) {
bool tokenAIn = abi.decode(swapData.data, (bool));
(, amountOut) = IMaverickV1Pool(swapData.addr).swap(address(this), amountIn, tokenAIn, false, 0, swapData.data);
}
/**
* @dev Performs Maverick v1 callback, sends required amounts of tokens to the pool
* @param amountToPay amount to pay
* @param _data encoded swap direction
*/
function invokeCallback(uint256 amountToPay, uint256 /*amountOut*/, bytes calldata _data) internal {
bool tokenAIn = abi.decode(_data, (bool));
if (tokenAIn) {
IERC20(IMaverickV1Pool(msg.sender).tokenA()).safeTransfer(msg.sender, amountToPay);
} else {
IERC20(IMaverickV1Pool(msg.sender).tokenB()).safeTransfer(msg.sender, amountToPay);
}
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.7;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../interfaces/IWowmaxRouter.sol";
/**
* @title PancakeSwap pool interface
*/
interface IPancakeStablePool {
/**
* @notice Exchange `dx` amount of `i` token to at least `min_dy` amount of `j` token
* @dev Same as Curve but uses uint256 instead of int128
* @param i Index of token to swap from
* @param j Index of token to swap to
* @param dx Amount of `i` token to swap from
* @param min_dy Minimum amount of `j` token to receive
*/
function exchange(uint256 i, uint256 j, uint256 dx, uint256 min_dy) external;
}
/**
* @title PancakeSwap library
* @notice Functions to swap tokens on PancakeSwap like protocols
*/
library PancakeSwapStable {
using SafeERC20 for IERC20;
/**
* @notice Swaps tokens on a PancakeSwap Stable like protocol contract
* @param from Address of token to swap from
* @param amountIn Amount of token to swap
* @param swapData Swap operation details. The `data` field should contain two int128 values,
* which are the indices of the tokens to swap from and to
* @return amountOut Amount of tokens received
*/
function swap(
address from,
uint256 amountIn,
IWowmaxRouter.Swap memory swapData
) internal returns (uint256 amountOut) {
(int128 i, int128 j) = abi.decode(swapData.data, (int128, int128));
uint256 balanceBefore = IERC20(swapData.to).balanceOf(address(this));
//slither-disable-next-line unused-return //it's safe to ignore
IERC20(from).safeIncreaseAllowance(swapData.addr, amountIn);
IPancakeStablePool(swapData.addr).exchange(uint256(uint128(i)), uint256(uint128(j)), amountIn, 0);
amountOut = IERC20(swapData.to).balanceOf(address(this)) - balanceBefore;
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.7;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../interfaces/IWowmaxRouter.sol";
/**
* @title Saddle pool interface
*/
interface ISaddlePool {
/**
* @dev Swaps tokens on a Saddle based protocol contract
* @param tokenIndexFrom Index of a token to swap from
* @param tokenIndexTo Index of a token to swap to
* @param dx Amount of tokens to swap
* @param minDy Minimum amount of tokens to receive
* @param deadline Timestamp after which transaction will revert
*/
function swap(uint8 tokenIndexFrom, uint8 tokenIndexTo, uint256 dx, uint256 minDy, uint256 deadline) external;
}
/**
* @title Saddle library
* @notice Functions to swap tokens on Saddle protocol
*/
library Saddle {
using SafeERC20 for IERC20;
/**
* @dev Swaps tokens on a Saddle pool contract
* @param from Address of a token to swap from
* @param amountIn Amount of tokens to swap
* @param swapData Swap operation details. The `data` field should contain two uint8 values,
* which are tokenIndexFrom and tokenIndexTo
* @return amountOut Amount of tokens received
*/
function swap(
address from,
uint256 amountIn,
IWowmaxRouter.Swap memory swapData
) internal returns (uint256 amountOut) {
(uint8 tokenIndexFrom, uint8 tokenIndexTo) = abi.decode(swapData.data, (uint8, uint8));
uint256 balanceBefore = IERC20(swapData.to).balanceOf(address(this));
//slither-disable-next-line unused-return //it's safe to ignore
IERC20(from).safeIncreaseAllowance(swapData.addr, amountIn);
ISaddlePool(swapData.addr).swap(tokenIndexFrom, tokenIndexTo, amountIn, 0, type(uint256).max);
amountOut = IERC20(swapData.to).balanceOf(address(this)) - balanceBefore;
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.7;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../interfaces/IWowmaxRouter.sol";
/**
* @title SyncSwap pool interface
*/
interface ISyncSwapPool {
/**
* @dev Token amount structure
* @param token Address of a token
* @param amount Amount of tokens
*/
struct TokenAmount {
address token;
uint amount;
}
/**
* @dev Swaps between tokens.
* @param data Swap operation details
* @param sender Address of the sender
* @param callback Callback address
* @param callbackData Callback data
* @return tokenAmount Amount of tokens received
*/
function swap(
bytes calldata data,
address sender,
address callback,
bytes calldata callbackData
) external returns (TokenAmount memory tokenAmount);
/**
* @dev Returns the address of the SyncSwap pool vault
* @return Vault address
*/
function vault() external view returns (address);
}
/**
* @title SyncSwap vault interface
*/
interface ISyncSwapVault {
/**
* @dev Deposits tokens to the SyncSwap vault
* @param token Address of a token to deposit
* @param to SyncSwap pool address
* @return amount Amount of tokens deposited
*/
function deposit(address token, address to) external payable returns (uint amount);
}
/**
* @title SyncSwap library
* @notice Functions to swap tokens on SyncSwap protocol
*/
library SyncSwap {
using SafeERC20 for IERC20;
/**
* @dev Swaps tokens on a SyncSwap pool contract
* @param from Address of a token to swap from
* @param amountIn Amount of tokens to swap
* @param swapData Swap operation details. The `data` field should be empty
* @return amountOut Amount of tokens received
*/
function swap(
address from,
uint256 amountIn,
IWowmaxRouter.Swap memory swapData
) internal returns (uint256 amountOut) {
ISyncSwapVault vault = ISyncSwapVault(ISyncSwapPool(swapData.addr).vault());
IERC20(from).safeTransfer(address(vault), amountIn);
vault.deposit(from, swapData.addr);
bytes memory data = abi.encode(from, address(this), uint8(2)); // from, to, withdrawMode (0 - default, 1 - unwrapped, 2 - wrapped)
ISyncSwapPool.TokenAmount memory out = ISyncSwapPool(swapData.addr).swap(
data,
address(0x0),
address(0x0),
new bytes(0)
);
return out.amount;
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.7;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../interfaces/IWowmaxRouter.sol";
/**
* @title Uniswap v2 pair interface
*/
interface IUniswapV2Pair {
/**
* @dev Returns the address of the first token of the Uniswap v2 based pair
* @return Address of the first token of the pair
*/
function token0() external view returns (address);
/**
* @dev Returns the address of the second token of the Uniswap v2 based pair
* @return Address of the second token of the pair
*/
function token1() external view returns (address);
/**
* @dev Returns the Uniswap v2 based pair reserves
* @return _reserve0 Reserve of the first token in the pair
* @return _reserve1 Reserve of the second token in the pair
* @return _blockTimestampLast Block timestamp of the last reserve update
*/
function getReserves() external view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast);
/**
* @dev Swaps tokens on a Uniswap v2 based pair
* @param amount0Out Amount of the first token to receive
* @param amount1Out Amount of the second token to receive
* @param to Address to send tokens to
* @param data Data to be send in callback function, if any
*/
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
/**
* @dev Returns the address of the Uniswap v2 based pair router
* @return Router address
*/
function router() external returns (address);
}
/**
* @title Uniswap v2 router interface
*/
interface IUniswapV2Router {
/**
* @dev Swaps tokens on a Uniswap v2 based router
* @param amountIn Amount of tokens to swap
* @param amountOutMin Minimal amount of tokens to receive
* @param path Sequence of tokens to perform swap through
* @param to Address to send swapped tokens to
* @param deadline Timestamp after which the transaction will revert,
* 0 if it is not defined
* @return amounts Amounts of tokens received for each swap step
*/
function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
}
/**
* @title Uniswap v2 library
* @notice Functions to swap tokens on Uniswap v2 and compatible protocols
*/
library UniswapV2 {
/**
* @dev Common fee denominator
*/
uint256 private constant FEE_DENOMINATOR = 10000;
using SafeERC20 for IERC20;
/**
* @dev Performs a direct swap through a Uniswap v2 based pair
* @param from Address of a token to swap from
* @param amountIn Amount of tokens to swap
* @param swapData Swap operation details. The `data` field should contain the fee value specific for the pair
* @return amountOut Amount of tokens received
*/
function swap(
address from,
uint256 amountIn,
IWowmaxRouter.Swap memory swapData
) internal returns (uint256 amountOut) {
IERC20(from).safeTransfer(swapData.addr, amountIn);
uint256 fee = abi.decode(swapData.data, (uint256));
bool directSwap = IUniswapV2Pair(swapData.addr).token0() == from;
(uint112 reserveIn, uint112 reserveOut) = getReserves(swapData.addr, directSwap);
amountOut = getAmountOut(amountIn, reserveIn, reserveOut, fee);
if (amountOut > 0) {
IUniswapV2Pair(swapData.addr).swap(
directSwap ? 0 : amountOut,
directSwap ? amountOut : 0,
address(this),
new bytes(0)
);
}
}
/**
* @dev Performs a swap through a Uniswap v2 based protocol using a router contract
* @param from Address of a token to swap from
* @param amountIn Amount of tokens to swap
* @param swapData Swap operation details
* data field should be empty
* @return amountOut Amount of tokens received
*/
function routerSwap(
address from,
uint256 amountIn,
IWowmaxRouter.Swap memory swapData
) internal returns (uint256 amountOut) {
IUniswapV2Router router = IUniswapV2Router(IUniswapV2Pair(swapData.addr).router());
IERC20(from).safeIncreaseAllowance(address(router), amountIn);
address[] memory path = new address[](2);
path[0] = from;
path[1] = swapData.to;
return router.swapExactTokensForTokens(amountIn, 0, path, address(this), type(uint256).max)[1];
}
/**
* @dev Returns the reserves of a Uniswap v2 based pair ordered according to swap direction
* @param pair Address of a Uniswap v2 based pair
* @param directSwap True if the first token of the pair is the token to swap from, false otherwise
* @return reserveIn Reserve of the token to swap from
* @return reserveOut Reserve of the token to swap to
*/
function getReserves(address pair, bool directSwap) private view returns (uint112 reserveIn, uint112 reserveOut) {
(uint112 reserve0, uint112 reserve1, ) = IUniswapV2Pair(pair).getReserves();
return directSwap ? (reserve0, reserve1) : (reserve1, reserve0);
}
/**
* @dev Returns the amount of tokens to be received for a given input amount and pair reserves
* @param amountIn Amount of tokens to swap
* @param reserveIn Reserve of the token to swap from
* @param reserveOut Reserve of the token to swap to
* @param fee Fee of the Uniswap v2 based pair. This value is specific for the pair
* and/or it's DEX, and should be provided externally
* @return amountOut Amount of tokens received
*/
function getAmountOut(
uint256 amountIn,
uint112 reserveIn,
uint112 reserveOut,
uint256 fee
) private pure returns (uint256 amountOut) {
uint256 amountInWithFee = amountIn * (FEE_DENOMINATOR - fee);
uint256 numerator = amountInWithFee * reserveOut;
uint256 denominator = reserveIn * FEE_DENOMINATOR + amountInWithFee;
amountOut = numerator / denominator;
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.7;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../interfaces/IWowmaxRouter.sol";
/**
* @title Uniswap v2 pair interface
*/
interface IUniswapV3Pool {
/**
* @dev Swaps tokens on a Uniswap v3 based pair
* @param recipient Address to send swapped tokens to
* @param zeroForOne Flag that indicates token direction. True for token0 to token1 direction,
* false for token1 to token0
* @param amountSpecified Amount of tokens to swap
* @param sqrtPriceLimitX96 Price limit within which swap is processed
* @param data Additional data to be send in callback function
* @return amount0 Amount of the first token received
* @return amount1 Amount of the second token received
*/
function swap(
address recipient,
bool zeroForOne,
int256 amountSpecified,
uint160 sqrtPriceLimitX96,
bytes calldata data
) external returns (int256 amount0, int256 amount1);
/**
* @dev Returns the address of the first token of the Uniswap v3 based pair
* @return Address of the first token of the pair
*/
function token0() external view returns (address);
/**
* @dev Returns the address of the second token of the Uniswap v3 based pair
* @return Address of the second token of the pair
*/
function token1() external view returns (address);
}
/**
* @title Uniswap v3 library
* @notice Functions to swap tokens on Uniswap v3 and compatible protocol
*/
library UniswapV3 {
using SafeERC20 for IERC20;
/**
* @dev Swaps tokens on a Uniswap v3 based pair
* @param amountIn Amount of tokens to swap
* @param swapData Swap data. The `data` field should contain zeroForOne flag
* @return amountOut Amount of tokens received
*/
function swap(uint256 amountIn, IWowmaxRouter.Swap memory swapData) internal returns (uint256 amountOut) {
bool zeroForOne = abi.decode(swapData.data, (bool));
uint160 sqrtPriceLimitX96 = zeroForOne ? 4295128740 : 1461446703485210103287273052203988822378723970341;
(int256 amount0, int256 amount1) = IUniswapV3Pool(swapData.addr).swap(
address(this),
zeroForOne,
int256(amountIn),
sqrtPriceLimitX96,
new bytes(0)
);
amountOut = uint(zeroForOne ? -amount1 : -amount0);
}
/**
* @dev Performs Uniswap v3 callback, sends required amounts of tokens to the pair
* @param amount0Delta Amount of the first token to send
* @param amount1Delta Amount of the second token to send
*/
function invokeCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata /*_data*/) internal {
if (amount0Delta > 0 && amount1Delta < 0) {
IERC20(IUniswapV3Pool(msg.sender).token0()).safeTransfer(msg.sender, uint256(amount0Delta));
} else if (amount0Delta < 0 && amount1Delta > 0) {
IERC20(IUniswapV3Pool(msg.sender).token1()).safeTransfer(msg.sender, uint256(amount1Delta));
} else {
revert("WOWMAX: Uniswap v3 invariant violation");
}
}
/**
* @notice Try to decode provided "dataWithSelector" as Uniswap V3 callback.
* @return Flag indicating whether decoding succeeded, followed by decoded amount0Delta, amount1Delta and data.
*/
function decodeCallback(
bytes calldata dataWithSelector
) internal pure returns (bool, int256, int256, bytes calldata) {
int256 amount0Delta;
int256 amount1Delta;
bytes calldata data;
assembly {
amount0Delta := calldataload(add(dataWithSelector.offset, 4))
amount1Delta := calldataload(add(dataWithSelector.offset, 36))
// get offset of bytes length: selector + (amount0Delta | amount1Delta | data length offset | data length | data).
// "length offset" is relative to start of first parameter in data.
let dataLenOffset := add(add(dataWithSelector.offset, 4), calldataload(add(dataWithSelector.offset, 68)))
data.length := calldataload(dataLenOffset)
data.offset := add(dataLenOffset, 32)
}
// validate that what we got matches what we expect
unchecked {
// account for padding in 32-byte word unaligned data
uint256 paddedDataLen = data.length;
uint256 remainder = data.length % 32;
if (remainder > 0) {
paddedDataLen = paddedDataLen + (32 - remainder);
}
// 132 = 4 (selector) + 64 ("sender", "amount0Delta", "amount1Delta" offsets) + 64 ("length offset" + "length" offsets)
if (dataWithSelector.length != (paddedDataLen + 132)) {
return (false, 0, 0, emptyBytesCalldata());
}
}
return (true, amount0Delta, amount1Delta, data);
}
function emptyBytesCalldata() private pure returns (bytes calldata) {
bytes calldata empty;
assembly {
empty.length := 0
empty.offset := 0
}
return empty;
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.7;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../interfaces/IWowmaxRouter.sol";
import "../interfaces/IWETH.sol";
/**
* @title Velocore vault interface
*/
interface IVelocoreVault {
/**
* @dev Swaps tokens on a Velocore based protocol
* @param pool Address of a Velocore pool contract
* @param method Swap method
* @param t1 Address of a token to swap from
* @param m1 Swap method for the first token
* @param a1 Amount of the first token to swap
* @param t2 Address of a token to swap to
* @param m2 Swap method for the second token
* @param a2 Amount of the second token to swap
* @param data Additional data to be used in swap
* @return amounts Amounts of tokens received
*/
function execute2(
address pool,
uint8 method,
address t1,
uint8 m1,
int128 a1,
address t2,
uint8 m2,
int128 a2,
bytes memory data
) external payable returns (int128[] memory);
function getPair(address tokenA, address tokenB) external view returns (address);
}
/**
* @title Velocore library
* @notice Functions to swap tokens on Velocore protocol
*/
library VelocoreV2 {
uint8 constant SWAP = 0;
uint8 constant EXACTLY = 0;
uint8 constant AT_MOST = 1;
address constant NATIVE_TOKEN = address(0x0);
using SafeERC20 for IERC20;
/**
* @dev Swaps tokens on a Velocore pool contract
* @param wrappedNativeToken Address of a wrapped native token
* @param from Address of a token to swap from
* @param amountIn Amount of tokens to swap
* @param swapData Swap operation details. The `data` field should contain vault address
* @return amountOut Amount of tokens received
*/
function swap(
address wrappedNativeToken,
address from,
uint256 amountIn,
IWowmaxRouter.Swap memory swapData
) internal returns (uint256 amountOut) {
address vaultAddress = abi.decode(swapData.data, (address));
IVelocoreVault vault = IVelocoreVault(vaultAddress);
address fromToken = from == wrappedNativeToken ? NATIVE_TOKEN : from;
address toToken = swapData.to == wrappedNativeToken ? NATIVE_TOKEN : swapData.to;
int128[] memory result;
if (fromToken == NATIVE_TOKEN) {
IWETH(wrappedNativeToken).withdraw(amountIn);
result = vault.execute2{ value: amountIn }(
swapData.addr,
SWAP,
fromToken,
EXACTLY,
int128(int256(amountIn)),
toToken,
AT_MOST,
0,
""
);
} else {
IERC20(fromToken).safeIncreaseAllowance(address(vault), amountIn);
result = vault.execute2(
swapData.addr,
SWAP,
fromToken,
EXACTLY,
int128(int256(amountIn)),
toToken,
AT_MOST,
0,
""
);
}
amountOut = uint256(int256(result[1]));
if (toToken == NATIVE_TOKEN) {
IWETH(wrappedNativeToken).deposit{ value: amountOut }();
}
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.7;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../interfaces/IWowmaxRouter.sol";
/**
* @title Velodrome pair interface
*/
interface IVelodromePair {
/**
* @dev Returns the Velodrome based pair amount out
* @param amountIn Amount to swap
* @param from Address of the token to swap from
* @return Amount of tokens to receive
*/
function getAmountOut(uint256 amountIn, address from) external view returns (uint256);
/**
* @dev Swaps tokens on a Velodrome based pair
* @param amount0Out Amount of the first token to receive
* @param amount1Out Amount of the second token to receive
* @param to Address to send tokens to
* @param data Data to be send in callback function, if any
*/
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
}
/**
* @title Velodrome library
* @notice Functions to swap tokens on Velodrome and compatible protocols
*/
library Velodrome {
using SafeERC20 for IERC20;
/**
* @dev Performs a swap through a Velodrome based pair
* @param from Address of a token to swap from
* @param amountIn Amount of tokens to swap
* @param swapData Swap operation details. The `data` field should contain from token index
* @return amountOut Amount of tokens received
*/
function swap(
address from,
uint256 amountIn,
IWowmaxRouter.Swap memory swapData
) internal returns (uint256 amountOut) {
uint256 fromIndex = abi.decode(swapData.data, (uint256));
amountOut = IVelodromePair(swapData.addr).getAmountOut(amountIn, from);
if (amountOut > 0) {
IERC20(from).safeTransfer(swapData.addr, amountIn);
IVelodromePair(swapData.addr).swap(
fromIndex == 0 ? 0 : amountOut,
fromIndex == 0 ? amountOut : 0,
address(this),
new bytes(0)
);
}
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.7;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../interfaces/IWowmaxRouter.sol";
/**
* @title Vooi pool interface
*/
interface IVooiPool {
/**
* @notice Swap fromToken for toToken, ensures deadline and minimumToAmount and sends quoted amount to `to` address
* @dev This function assumes tax free token.
* @param _fromID The token being inserted into Pool by user for swap
* @param _toID The token wanted by user, leaving the Pool
* @param _fromAmount The amount of from token inserted
* @param _minToAmount The minimum amount that will be accepted by user as result
* @param _to The user receiving the result of swap
* @param _deadline The deadline to be respected
*/
function swap(
uint256 _fromID,
uint256 _toID,
uint256 _fromAmount,
uint256 _minToAmount,
address _to,
uint256 _deadline
) external returns (uint256 actualToAmount, uint256 lpFeeAmount);
}
/**
* @title Vooi library
* @notice Functions to swap tokens on Vooi protocol
*/
library Vooi {
using SafeERC20 for IERC20;
/**
* @dev Swaps tokens on a Vooi pool contract
* @param from Address of a token to swap from
* @param amountIn Amount of tokens to swap
* @param swapData Swap operation details. The `data` field should be empty
* @return amountOut Amount of tokens received
*/
function swap(
address from,
uint256 amountIn,
IWowmaxRouter.Swap memory swapData
) internal returns (uint256 amountOut) {
(uint8 fromID, uint8 toID) = abi.decode(swapData.data, (uint8, uint8));
IERC20(from).safeIncreaseAllowance(swapData.addr, amountIn);
(amountOut, ) = IVooiPool(swapData.addr).swap(fromID, toID, amountIn, 0, address(this), type(uint256).max);
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.7;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../interfaces/IWowmaxRouter.sol";
/**
* @title Wombat pool interface
*/
interface IWombatPool {
/**
* @dev Swaps tokens on a Wombat based protocol contract
* @param fromToken Address of a token to swap from
* @param toToken Address of a token to swap to
* @param fromAmount Amount of tokens to swap
* @param minimumToAmount Minimal amount of tokens to receive
* @param to Address to send swapped tokens to
* @param deadline Timestamp after which the transaction will revert
* @return actualToAmount Actual amount of tokens received
* @return haircut Amount of tokens taken as fee
*/
function swap(
address fromToken,
address toToken,
uint256 fromAmount,
uint256 minimumToAmount,
address to,
uint256 deadline
) external returns (uint256 actualToAmount, uint256 haircut);
}
/**
* @title Wombat library
* @notice Functions to swap tokens on Wombat protocol
*/
library Wombat {
using SafeERC20 for IERC20;
/**
* @dev Swaps tokens on a Wombat pool contract
* @param from Address of a token to swap from
* @param amountIn Amount of tokens to swap
* @param swapData Swap operation details. The `data` field should be empty
* @return amountOut Amount of tokens received
*/
function swap(
address from,
uint256 amountIn,
IWowmaxRouter.Swap memory swapData
) internal returns (uint256 amountOut) {
IERC20(from).safeIncreaseAllowance(swapData.addr, amountIn);
(amountOut, ) = IWombatPool(swapData.addr).swap(
from,
swapData.to,
amountIn,
0,
address(this),
type(uint256).max
);
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.7;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../interfaces/IWowmaxRouter.sol";
/**
* @title WooFi pool interface
*/
interface IWooFiPool {
/**
* @dev Swaps tokens on a WooFi based protocol contract
* @param fromToken Address of a token to swap from
* @param toToken Address of a token to swap to
* @param fromAmount Amount of tokens to swap
* @param minToAmount Minimal amount of tokens to receive
* @param to Address to send swapped tokens to
* @param rebateTo The rebate address (optional, can be address ZERO)
* @return realToAmount Amount of tokens received
*/
function swap(
address fromToken,
address toToken,
uint256 fromAmount,
uint256 minToAmount,
address to,
address rebateTo
) external returns (uint256 realToAmount);
}
/**
* @title WooFi library
* @notice Functions to swap tokens on WooFi protocol
*/
library WooFi {
using SafeERC20 for IERC20;
/**
* @dev Swaps tokens on a WooFi pool contract
* @param from Address of a token to swap from
* @param amountIn Amount of tokens to swap
* @param swapData Swap operation details. The `data` field should be empty
* @return amountOut Amount of tokens received
*/
function swap(
address from,
uint256 amountIn,
IWowmaxRouter.Swap memory swapData
) internal returns (uint256 amountOut) {
IERC20(from).safeTransfer(swapData.addr, amountIn);
amountOut = IWooFiPool(swapData.addr).swap(from, swapData.to, amountIn, 0, address(this), address(0x0));
}
}// SPDX-License-Identifier: MIT
pragma solidity =0.8.7;
/**
* @dev Contract module that helps prevent reentrant swaps. Based on OpenZeppelin Contracts (last updated v4.8.0)
* (security/ReentrancyGuard.sol)
*/
abstract contract WowmaxSwapReentrancyGuard {
uint256 private constant _SWAP_IN_PROGRESS = 1;
uint256 private constant _SWAP_NOT_IN_PROGRESS = 2;
uint256 private _swapStatus;
/**
* @dev Prevents a contract from calling swap function again from within swap
*/
modifier reentrancyProtectedSwap() {
_beforeSwap();
_;
_afterSwap();
}
/**
* @dev Prevents operation from being called outside of swap
*/
modifier onlyDuringSwap() {
require(_swapStatus == _SWAP_IN_PROGRESS, "WOWMAX: not allowed outside of swap");
_;
}
constructor() {
_swapStatus = _SWAP_NOT_IN_PROGRESS;
}
/**
* @dev checks if swap is in progress and prevents reentrant calls
*/
function _beforeSwap() private {
require(_swapStatus != _SWAP_IN_PROGRESS, "WOWMAX: reentrant swap not allowed");
_swapStatus = _SWAP_IN_PROGRESS;
}
/**
* @dev sets swap status to not in progress
*/
function _afterSwap() private {
_swapStatus = _SWAP_NOT_IN_PROGRESS;
}
}{
"metadata": {
"bytecodeHash": "none"
},
"optimizer": {
"enabled": true,
"runs": 800
},
"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":"_treasury","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"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":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"address[]","name":"to","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"amountOut","type":"uint256[]"}],"name":"SwapExecuted","type":"event"},{"stateMutability":"nonpayable","type":"fallback"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"contract IWETH","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"algebraSwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"d3MMSwapCallBack","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"maxFeePercentage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSlippage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxFeePercentage","type":"uint256"}],"name":"setMaxFeePercentage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxSlippage","type":"uint256"}],"name":"setMaxSlippage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"address[]","name":"to","type":"address[]"},{"components":[{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"parts","type":"uint256"},{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"part","type":"uint256"},{"internalType":"address","name":"addr","type":"address"},{"internalType":"bytes32","name":"family","type":"bytes32"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct IWowmaxRouter.Swap[]","name":"swaps","type":"tuple[]"}],"internalType":"struct IWowmaxRouter.ExchangeRoute[]","name":"exchangeRoutes","type":"tuple[]"},{"internalType":"uint256[]","name":"slippage","type":"uint256[]"},{"internalType":"uint256[]","name":"amountOutExpected","type":"uint256[]"}],"internalType":"struct IWowmaxRouter.ExchangeRequest","name":"request","type":"tuple"}],"name":"swap","outputs":[{"internalType":"uint256[]","name":"amountsOut","type":"uint256[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountToPay","type":"uint256"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"swapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"swapX2YCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"y","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"swapY2XCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
608060405260646004556107d06005553480156200001c57600080fd5b506040516200501e3803806200501e8339810160408190526200003f91620001a2565b6200004a3362000135565b60026001556001600160a01b038216620000ab5760405162461bcd60e51b815260206004820152601a60248201527f574f574d41583a2057726f6e672057455448206164647265737300000000000060448201526064015b60405180910390fd5b6001600160a01b038116620001035760405162461bcd60e51b815260206004820152601e60248201527f574f574d41583a2057726f6e67207472656173757279206164647265737300006044820152606401620000a2565b600280546001600160a01b039384166001600160a01b03199182161790915560038054929093169116179055620001da565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146200019d57600080fd5b919050565b60008060408385031215620001b657600080fd5b620001c18362000185565b9150620001d16020840162000185565b90509250929050565b614e3480620001ea6000396000f3fe6080604052600436106101115760003560e01c80638da5cb5b116100a5578063bf654aac11610074578063f14210a611610059578063f14210a6146103d4578063f2fde38b146103f4578063f3fef3a31461041457610118565b8063bf654aac1461039e578063d3e1c284146103b457610118565b80638da5cb5b14610320578063923b8a2a1461033e578063a66cd0941461035e578063ad5c46481461037e57610118565b806343f68a49116100e157806343f68a491461028f57806361d027b3146102af578063715018a6146102e75780638c04166f146102fc57610118565b8062d5a9e814610204578063187806841461022d5780632c8958f61461024f5780633e88c8ab1461026f57610118565b3661011857005b34801561012457600080fd5b5060018054146101875760405162461bcd60e51b815260206004820152602360248201527f574f574d41583a206e6f7420616c6c6f776564206f757473696465206f66207360448201526207761760ec1b60648201526084015b60405180910390fd5b600080600036600061019a600036610434565b94509450945094509450846101f15760405162461bcd60e51b815260206004820152601c60248201527f574f574d41583a20756e737570706f727465642063616c6c6261636b00000000604482015260640161017e565b6101fd848484846104a9565b5050505050005b6102176102123660046143b7565b6105f9565b60405161022491906147db565b60405180910390f35b34801561023957600080fd5b5061024d61024836600461437c565b61061d565b005b34801561025b57600080fd5b5061024d61026a36600461437c565b610685565b34801561027b57600080fd5b5061024d61028a366004614111565b6106ee565b34801561029b57600080fd5b5061024d6102aa3660046145b2565b6106fa565b3480156102bb57600080fd5b506003546102cf906001600160a01b031681565b6040516001600160a01b039091168152602001610224565b3480156102f357600080fd5b5061024d610707565b34801561030857600080fd5b5061031260055481565b604051908152602001610224565b34801561032c57600080fd5b506000546001600160a01b03166102cf565b34801561034a57600080fd5b5061024d61035936600461437c565b61071b565b34801561036a57600080fd5b5061024d6103793660046145b2565b610784565b34801561038a57600080fd5b506002546102cf906001600160a01b031681565b3480156103aa57600080fd5b5061031260045481565b3480156103c057600080fd5b5061024d6103cf36600461437c565b610791565b3480156103e057600080fd5b5061024d6103ef3660046145b2565b6107f9565b34801561040057600080fd5b5061024d61040f3660046140ab565b6108b4565b34801561042057600080fd5b5061024d61042f3660046140e5565b610944565b600080803681600487810135906024808a01359160448b01358b0191820191013580601f811680156104695780602003820191505b608482018c1461048e576000808080809a509a509a509a509a5050505050505061049f565b506001995093975091955093509150505b9295509295909350565b6000841380156104b95750600083125b15610549576105443385336001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156104fc57600080fd5b505afa158015610510573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061053491906140c8565b6001600160a01b03169190610962565b6105f3565b6000841280156105595750600083135b1561059c576105443384336001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156104fc57600080fd5b60405162461bcd60e51b815260206004820152602660248201527f574f574d41583a20556e697377617020763320696e76617269616e742076696f6044820152653630ba34b7b760d11b606482015260840161017e565b50505050565b60606106036109df565b61060c82610a42565b90506106186002600155565b919050565b600180541461067a5760405162461bcd60e51b815260206004820152602360248201527f574f574d41583a206e6f7420616c6c6f776564206f757473696465206f66207360448201526207761760ec1b606482015260840161017e565b6105f3848383610b5d565b60018054146106e25760405162461bcd60e51b815260206004820152602360248201527f574f574d41583a206e6f7420616c6c6f776564206f757473696465206f66207360448201526207761760ec1b606482015260840161017e565b6105f384848484610b81565b6105f384848484610c7e565b610702610c92565b600555565b61070f610c92565b6107196000610cec565b565b60018054146107785760405162461bcd60e51b815260206004820152602360248201527f574f574d41583a206e6f7420616c6c6f776564206f757473696465206f66207360448201526207761760ec1b606482015260840161017e565b6105f384848484610d54565b61078c610c92565b600455565b60018054146107ee5760405162461bcd60e51b815260206004820152602360248201527f574f574d41583a206e6f7420616c6c6f776564206f757473696465206f66207360448201526207761760ec1b606482015260840161017e565b6105f3838383610b5d565b610801610c92565b6003546040516000916001600160a01b03169083908381818185875af1925050503d806000811461084e576040519150601f19603f3d011682016040523d82523d6000602084013e610853565b606091505b50509050806108b05760405162461bcd60e51b8152602060048201526024808201527f576f776d61783a204661696c656420746f2073656e64206e617469766520746f6044820152636b656e7360e01b606482015260840161017e565b5050565b6108bc610c92565b6001600160a01b0381166109385760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161017e565b61094181610cec565b50565b61094c610c92565b6003546108b0906001600160a01b038481169116835b6040516001600160a01b0383166024820152604481018290526109da90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b031990931692909217909152610df2565b505050565b600180541415610a3c5760405162461bcd60e51b815260206004820152602260248201527f574f574d41583a207265656e7472616e742073776170206e6f7420616c6c6f77604482015261195960f21b606482015260840161017e565b60018055565b6060610a4d82610ed7565b6000610a588361120b565b905060005b610a6a6060850185614b1a565b9050811015610abd57610aaa610a836060860186614b1a565b83818110610a9357610a93614dd8565b9050602002810190610aa59190614b64565b6112ea565b5080610ab581614d74565b915050610a5d565b50610ac783611445565b91506000610ad860208501856140ab565b6001600160a01b031614610af857610af360208401846140ab565b610b05565b6002546001600160a01b03165b6001600160a01b0316337f25a3ab87780ac0e2eeeb645d408cbc89d66c72590ae0e1f81bda8f3d3a8d121683610b3e6040880188614b1a565b87604051610b4f9493929190614a0f565b60405180910390a350919050565b6000610b6b828401846140ab565b90506105f36001600160a01b0382163386610962565b600084138015610b915750600083125b15610bd4576105443385336001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156104fc57600080fd5b600084128015610be45750600083135b15610c27576105443384336001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156104fc57600080fd5b60405162461bcd60e51b815260206004820152602660248201527f574f574d41583a20416c676562726120563120696e76617269616e742076696f6044820152653630ba34b7b760d11b606482015260840161017e565b6105f36001600160a01b0385163385610962565b6000546001600160a01b031633146107195760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161017e565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610d6282840184614298565b90508015610dad57610da83386336001600160a01b0316630fc63d106040518163ffffffff1660e01b815260040160206040518083038186803b1580156104fc57600080fd5b610deb565b610deb3386336001600160a01b0316635f64b55b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156104fc57600080fd5b5050505050565b6000610e47826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166118149092919063ffffffff16565b8051909150156109da5780806020019051810190610e6591906142b5565b6109da5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161017e565b6000610ee66040830183614b1a565b905011610f405760405162461bcd60e51b815260206004820152602260248201527f574f574d41583a204e6f206f757470757420746f6b656e732073706563696669604482015261195960f21b606482015260840161017e565b610f4d60a0820182614b1a565b9050610f5c6040830183614b1a565b905014610fd15760405162461bcd60e51b815260206004820152602660248201527f574f574d41583a2057726f6e6720616d6f756e744f757445787065637465642060448201527f6c656e6774680000000000000000000000000000000000000000000000000000606482015260840161017e565b610fde6080820182614b1a565b9050610fed6040830183614b1a565b90501461103c5760405162461bcd60e51b815260206004820152601d60248201527f574f574d41583a2057726f6e6720736c697070616765206c656e677468000000604482015260640161017e565b60005b61104c6040830183614b1a565b90508110156108b05760006110646040840184614b1a565b8381811061107457611074614dd8565b905060200201602081019061108991906140ab565b6001600160a01b031614156110eb5760405162461bcd60e51b815260206004820152602260248201527f574f574d41583a2057726f6e67206f757470757420746f6b656e206164647265604482015261737360f01b606482015260840161017e565b60006110fa60a0840184614b1a565b8381811061110a5761110a614dd8565b90506020020135116111845760405162461bcd60e51b815260206004820152602560248201527f574f574d41583a2057726f6e6720616d6f756e744f757445787065637465642060448201527f76616c7565000000000000000000000000000000000000000000000000000000606482015260840161017e565b6005546111946080840184614b1a565b838181106111a4576111a4614dd8565b9050602002013511156111f95760405162461bcd60e51b815260206004820152601c60248201527f574f574d41583a20536c69707061676520697320746f6f206869676800000000604482015260640161017e565b8061120381614d74565b91505061103f565b6000806000341180156112335750600061122860208501856140ab565b6001600160a01b0316145b801561124157506020830135155b156112ad575060025460408051630d0e30db60e41b8152905134926001600160a01b03169163d0e30db091849160048082019260009290919082900301818588803b15801561128f57600080fd5b505af11580156112a3573d6000803e3d6000fd5b50505050506112e4565b6020830135156112e45750602082018035906112e4903390309084906112d390886140ab565b6001600160a01b031692919061182d565b92915050565b6000806112fa60208401846140ab565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a082319060240160206040518083038186803b15801561133b57600080fd5b505afa15801561134f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061137391906145cb565b90506000805b6113866040860186614b1a565b905081101561143d5761141f61139f60208701876140ab565b60208701356113b16040890189614b1a565b858181106113c1576113c1614dd8565b90506020028101906113d39190614b7a565b6113e1906020013587614c71565b6113eb9190614c4f565b6113f86040890189614b1a565b8581811061140857611408614dd8565b905060200281019061141a9190614b7a565b611865565b6114299083614c37565b91508061143581614d74565b915050611379565b509392505050565b60606114546040830183614b1a565b905067ffffffffffffffff81111561146e5761146e614dee565b604051908082528060200260200182016040528015611497578160200160208202803683370190505b50905060008060005b6114ad6040860186614b1a565b905081101561180c576114c36040860186614b1a565b828181106114d3576114d3614dd8565b90506020020160208101906114e891906140ab565b6040516370a0823160e01b81523060048201529092506001600160a01b038316906370a082319060240160206040518083038186803b15801561152a57600080fd5b505afa15801561153e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061156291906145cb565b9250600061157360a0870187614b1a565b8381811061158357611583614dd8565b905060200201358411156116625761159e60a0870187614b1a565b838181106115ae576115ae614dd8565b90506020020135846115c09190614c90565b90506000612710600454866115d59190614c71565b6115df9190614c4f565b905080821115611619579050806115f68186614c90565b86848151811061160857611608614dd8565b60200260200101818152505061165c565b61162660a0880188614b1a565b8481811061163657611636614dd8565b9050602002013586848151811061164f5761164f614dd8565b6020026020010181815250505b50611748565b6127106116726080880188614b1a565b8481811061168257611682614dd8565b905060200201356127106116969190614c90565b6116a360a0890189614b1a565b858181106116b3576116b3614dd8565b905060200201356116c49190614c71565b6116ce9190614c4f565b8410156117285760405162461bcd60e51b815260206004820152602260248201527f574f574d41583a20496e73756666696369656e74206f757470757420616d6f756044820152611b9d60f21b606482015260840161017e565b8385838151811061173b5761173b614dd8565b6020026020010181815250505b6002546001600160a01b03848116911614156117bd57600254604051632e1a7d4d60e01b8152600481018690526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b1580156117a457600080fd5b505af11580156117b8573d6000803e3d6000fd5b505050505b6003546117d59084906001600160a01b031683611e8b565b6117f983338785815181106117ec576117ec614dd8565b6020026020010151611e8b565b508061180481614d74565b9150506114a0565b505050919050565b60606118238484600085611f6e565b90505b9392505050565b6040516001600160a01b03808516602483015283166044820152606481018290526105f39085906323b872dd60e01b9060840161098e565b60007f554e49535741505f563300000000000000000000000000000000000000000000826060013514156118ac576118a5836118a084614ca7565b612062565b9050611826565b7f48415348464c4f57000000000000000000000000000000000000000000000000826060013514156118eb576118a584846118e685614ca7565b61216f565b7f574f4d42415400000000000000000000000000000000000000000000000000008260600135141561192a576118a5848461192585614ca7565b61232a565b7f4c4556454c00000000000000000000000000000000000000000000000000000082606001351415611969576118a5848461196485614ca7565b6123f5565b7f444f444f5f563200000000000000000000000000000000000000000000000000826060013514156119a8576118a584846119a385614ca7565b612599565b7f444f444f5f563300000000000000000000000000000000000000000000000000826060013514156119e7576118a584846119e285614ca7565b6126df565b7f574f4f464900000000000000000000000000000000000000000000000000000082606001351415611a26576118a58484611a2185614ca7565b612790565b7f554e49535741505f56320000000000000000000000000000000000000000000082606001351415611a65576118a58484611a6085614ca7565b612805565b7f435552564500000000000000000000000000000000000000000000000000000082606001351415611aa4576118a58484611a9f85614ca7565b612994565b7f50414e43414b45535741505f535441424c45000000000000000000000000000082606001351415611ae3576118a58484611ade85614ca7565b612b51565b7f444f444f5f56310000000000000000000000000000000000000000000000000082606001351415611b22576118a58484611b1d85614ca7565b612c68565b7f42414c414e4345525f563200000000000000000000000000000000000000000082606001351415611b61576118a58484611b5c85614ca7565b612ccd565b7f4d4156455249434b5f563100000000000000000000000000000000000000000082606001351415611b9f576118a583611b9a84614ca7565b612e34565b7f534144444c45000000000000000000000000000000000000000000000000000082606001351415611bde576118a58484611bd985614ca7565b612ee1565b7f46554c43524f4d0000000000000000000000000000000000000000000000000082606001351415611c1d576118a58484611c1885614ca7565b612ff1565b7f554e49535741505f56325f524f5554455200000000000000000000000000000082606001351415611c5c576118a58484611c5785614ca7565b613051565b7f454c41535449430000000000000000000000000000000000000000000000000082606001351415611c9b576118a58484611c9685614ca7565b61320f565b7f414c47454252415f56310000000000000000000000000000000000000000000082606001351415611cda576118a58484611cd585614ca7565b613382565b7f414c47454252415f56315f39000000000000000000000000000000000000000082606001351415611d14576118a58484611cd585614ca7565b7f53594e435357415000000000000000000000000000000000000000000000000082606001351415611d53576118a58484611d4e85614ca7565b613484565b63564f4f4960e01b82606001351415611d79576118a58484611d7485614ca7565b61366d565b7f56454c4f434f52455f563200000000000000000000000000000000000000000082606001351415611dc5576002546118a5906001600160a01b03168585611dc086614ca7565b61375a565b7f495a49535741500000000000000000000000000000000000000000000000000082606001351415611e04576118a58484611dff85614ca7565b613a84565b7f56454c4f44524f4d45000000000000000000000000000000000000000000000082606001351415611e43576118a58484611e3e85614ca7565b613bb7565b60405162461bcd60e51b815260206004820152601a60248201527f574f574d41583a20556e6b6e6f776e204445582066616d696c79000000000000604482015260640161017e565b80611e9557505050565b6002546001600160a01b0384811691161415611f5a576000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611ef8576040519150601f19603f3d011682016040523d82523d6000602084013e611efd565b606091505b50509050806105f35760405162461bcd60e51b8152602060048201526024808201527f576f776d61783a204661696c656420746f2073656e64206e617469766520746f6044820152636b656e7360e01b606482015260840161017e565b6109da6001600160a01b0384168383610962565b606082471015611fe65760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161017e565b600080866001600160a01b031685876040516120029190614690565b60006040518083038185875af1925050503d806000811461203f576040519150601f19603f3d011682016040523d82523d6000602084013e612044565b606091505b509150915061205587838387613d1a565b925050505b949350505050565b600080826080015180602001905181019061207d91906142b5565b90506000816120a05773fffd8963efd1fc6a506488495d951d5263988d256120a7565b6401000276a45b604085810151815160008082526020820193849052630251596160e31b909352929350909182916001600160a01b03169063128acb08906120f390309088908c908990602481016146e6565b6040805180830381600087803b15801561210c57600080fd5b505af1158015612120573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121449190614358565b915091508361215b5761215682614d8f565b612164565b61216481614d8f565b979650505050505050565b600080826080015180602001905181019061218a91906143f2565b60408401519091506121a7906001600160a01b0387169086613d90565b8060e001518410156121bb5760c081018490525b82516040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b1580156121fe57600080fd5b505afa158015612212573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061223691906145cb565b905083604001516001600160a01b031663c52ac720836040518263ffffffff1660e01b8152600401612268919061483d565b600060405180830381600087803b15801561228257600080fd5b505af1158015612296573d6000803e3d6000fd5b505085516040516370a0823160e01b81523060048201528493506001600160a01b0390911691506370a082319060240160206040518083038186803b1580156122de57600080fd5b505afa1580156122f2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061231691906145cb565b6123209190614c90565b9695505050505050565b6040810151600090612347906001600160a01b0386169085613d90565b60408281015183519151639908fc8b60e01b81526001600160a01b0387811660048301529283166024820152604481018690526000606482015230608482015260001960a4820152911690639908fc8b9060c4016040805180830381600087803b1580156123b457600080fd5b505af11580156123c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123ec9190614358565b50949350505050565b6040810151600090612412906001600160a01b0386169085610962565b81516040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b15801561245557600080fd5b505afa158015612469573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061248d91906145cb565b6040848101518551825160008082526020820194859052631fa196a960e21b9094529394506001600160a01b0390911692637e865aa4926124d8928a929091903090602481016146ac565b600060405180830381600087803b1580156124f257600080fd5b505af1158015612506573d6000803e3d6000fd5b505084516040516370a0823160e01b81523060048201528493506001600160a01b0390911691506370a082319060240160206040518083038186803b15801561254e57600080fd5b505afa158015612562573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061258691906145cb565b6125909190614c90565b95945050505050565b60408101516000906125b6906001600160a01b0386169085610962565b600082608001518060200190518101906125d091906145e4565b905060ff8116612660576040808401519051632f58056d60e21b81523060048201526001600160a01b039091169063bd6015b490602401602060405180830381600087803b15801561262157600080fd5b505af1158015612635573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061265991906145cb565b915061143d565b6040808401519051636ec9facd60e11b81523060048201526001600160a01b039091169063dd93f59a90602401602060405180830381600087803b1580156126a757600080fd5b505af11580156126bb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061259091906145cb565b60408082015182519151637597a8d360e11b81523060048201526001600160a01b03868116602483015292831660448201526064810185905260006084820181905260c060a483015260c48201819052929091169063eb2f51a69060e4015b602060405180830381600087803b15801561275857600080fd5b505af115801561276c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061182391906145cb565b60408101516000906127ad906001600160a01b0386169085610962565b60408281015183519151633ee101c160e11b81526001600160a01b03878116600483015292831660248201526044810186905260006064820181905230608483015260a4820152911690637dc203829060c40161273e565b6040810151600090612822906001600160a01b0386169085610962565b6000826080015180602001905181019061283c91906145cb565b90506000856001600160a01b031684604001516001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561288757600080fd5b505afa15801561289b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128bf91906140c8565b6001600160a01b03161490506000806128dc866040015184613e51565b915091506128ec87838387613eea565b945084156129895785604001516001600160a01b031663022c0d9f846129125786612915565b60005b85612921576000612923565b875b604080516000815260208101918290526001600160e01b031960e086901b16909152612956929190309060248101614aec565b600060405180830381600087803b15801561297057600080fd5b505af1158015612984573d6000803e3d6000fd5b505050505b505050509392505050565b600080600083608001518060200190518101906129b19190614302565b85516040516370a0823160e01b81523060048201529294509092506000916001600160a01b03909116906370a082319060240160206040518083038186803b1580156129fc57600080fd5b505afa158015612a10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a3491906145cb565b6040860151909150612a51906001600160a01b0389169088613d90565b6040808601519051630f7c084960e21b8152600f85810b600483015284900b602482015260448101889052600060648201526001600160a01b0390911690633df02124906084015b600060405180830381600087803b158015612ab357600080fd5b505af1158015612ac7573d6000803e3d6000fd5b505086516040516370a0823160e01b81523060048201528493506001600160a01b0390911691506370a082319060240160206040518083038186803b158015612b0f57600080fd5b505afa158015612b23573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b4791906145cb565b6121649190614c90565b60008060008360800151806020019051810190612b6e9190614302565b85516040516370a0823160e01b81523060048201529294509092506000916001600160a01b03909116906370a082319060240160206040518083038186803b158015612bb957600080fd5b505afa158015612bcd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bf191906145cb565b6040860151909150612c0e906001600160a01b0389169088613d90565b6040808601519051630b68372160e31b81526fffffffffffffffffffffffffffffffff80861660048301528416602482015260448101889052600060648201526001600160a01b0390911690635b41b90890608401612a99565b6040810151600090612c85906001600160a01b0386169085613d90565b6040808301519051638dae733360e01b8152600481018590526000602482018190526060604483015260648201526001600160a01b0390911690638dae73339060840161273e565b60008060008360800151806020019051810190612cea91906142d2565b9150915060006040518060c0016040528084815260200160006001811115612d1457612d14614dc2565b81526001600160a01b03808a16602083015287511660408201526060810188905260800160006040519080825280601f01601f191660200182016040528015612d64576020820181803683370190505b5090526040805160808101825230808252600060208301819052928201526060810191909152909150612da16001600160a01b0389168489613d90565b6040516352bbbe2960e01b81526001600160a01b038416906352bbbe2990612dd690859085906000906000199060040161492f565b602060405180830381600087803b158015612df057600080fd5b505af1158015612e04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e2891906145cb565b98975050505050505050565b6000808260800151806020019051810190612e4f91906142b5565b905082604001516001600160a01b031663c51c902930868460008089608001516040518763ffffffff1660e01b8152600401612e909695949392919061479d565b6040805180830381600087803b158015612ea957600080fd5b505af1158015612ebd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125909190614358565b60008060008360800151806020019051810190612efe91906145ff565b85516040516370a0823160e01b81523060048201529294509092506000916001600160a01b03909116906370a082319060240160206040518083038186803b158015612f4957600080fd5b505afa158015612f5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f8191906145cb565b6040860151909150612f9e906001600160a01b0389169088613d90565b60408086015190516348b4aac360e11b815260ff808616600483015284166024820152604481018890526000606482015260001960848201526001600160a01b039091169063916955869060a401612a99565b604081015160009061300e906001600160a01b0386169085610962565b60408281015183519151634998b10960e11b81526001600160a01b038781166004830152928316602482015230604482015291169063933162129060640161273e565b60008082604001516001600160a01b031663f887ea406040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561309357600080fd5b505af11580156130a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130cb91906140c8565b90506130e16001600160a01b0386168286613d90565b604080516002808252606082018352600092602083019080368337019050509050858160008151811061311657613116614dd8565b60200260200101906001600160a01b031690816001600160a01b03168152505083600001518160018151811061314e5761314e614dd8565b6001600160a01b0392831660209182029290920101526040516338ed173960e01b8152908316906338ed1739906131949088906000908690309060001990600401614a7b565b600060405180830381600087803b1580156131ae57600080fd5b505af11580156131c2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526131ea919081019061420c565b6001815181106131fc576131fc614dd8565b6020026020010151925050509392505050565b60008082604001516001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561324f57600080fd5b505afa158015613263573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061328791906140c8565b6001600160a01b0316856001600160a01b03161490506000816132be5773fffd8963efd1fc6a506488495d951d5263988d256132c5565b6401000276a45b60408581015181516000808252602082019384905263092cc68360e21b909352929350909182916001600160a01b0316906324b31a0c906133119030908b908990899060248101614720565b6040805180830381600087803b15801561332a57600080fd5b505af115801561333e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133629190614358565b91509150836133795761337482614d8f565b612e28565b612e2881614d8f565b60008082604001516001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156133c257600080fd5b505afa1580156133d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133fa91906140c8565b6001600160a01b0316856001600160a01b03161490506000816134315773fffd8963efd1fc6a506488495d951d5263988d25613438565b6401000276a45b604085810151815160008082526020820193849052630251596160e31b909352929350909182916001600160a01b03169063128acb089061331190309088908c908990602481016146e6565b60008082604001516001600160a01b031663fbfa77cf6040518163ffffffff1660e01b815260040160206040518083038186803b1580156134c457600080fd5b505afa1580156134d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134fc91906140c8565b90506135126001600160a01b0386168286610962565b6040838101519051631f2c13e160e31b81526001600160a01b03878116600483015291821660248201529082169063f9609f0890604401602060405180830381600087803b15801561356357600080fd5b505af1158015613577573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061359b91906145cb565b50604080516001600160a01b03878116602083015230828401526002606080840191909152835180840390910181526080830180855287850151600080835260a0860196879052637132bb7f60e01b9096529194939190921691637132bb7f9161360d9186918691829160a4016147ee565b6040805180830381600087803b15801561362657600080fd5b505af115801561363a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061365e919061450a565b60200151979650505050505050565b6000806000836080015180602001905181019061368a91906145ff565b604086015191935091506136a9906001600160a01b0388169087613d90565b60408085015190516347b5ef5560e11b815260ff808516600483015283166024820152604481018790526000606482015230608482015260001960a48201526001600160a01b0390911690638f6bdeaa9060c4015b6040805180830381600087803b15801561371757600080fd5b505af115801561372b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061374f9190614358565b509695505050505050565b600080826080015180602001905181019061377591906140c8565b90508060006001600160a01b03878116908916146137935786613796565b60005b90506000886001600160a01b031686600001516001600160a01b0316146137be5785516137c1565b60005b905060606001600160a01b03831661390357604051632e1a7d4d60e01b8152600481018990526001600160a01b038b1690632e1a7d4d90602401600060405180830381600087803b15801561381557600080fd5b505af1158015613829573d6000803e3d6000fd5b50505060408089015190516342f3185360e11b81526001600160a01b039182166004820152600060248201819052868316604483015260648201819052600f8c900b608483015285831660a4830152600160c483015260e4820181905261012061010483015261012482015290861691506385e630a6908a90610144016000604051808303818588803b1580156138bf57600080fd5b505af11580156138d3573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f191682016040526138fc919081019061416d565b90506139e7565b6139176001600160a01b038416858a613d90565b60408781015190516342f3185360e11b81526001600160a01b039182166004820152600060248201819052858316604483015260648201819052600f8b900b608483015284831660a4830152600160c483015260e48201819052610120610104830152610124820152908516906385e630a69061014401600060405180830381600087803b1580156139a857600080fd5b505af11580156139bc573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526139e4919081019061416d565b90505b806001815181106139fa576139fa614dd8565b6020026020010151600f0b955060006001600160a01b0316826001600160a01b03161415613a7757896001600160a01b031663d0e30db0876040518263ffffffff1660e01b81526004016000604051808303818588803b158015613a5d57600080fd5b505af1158015613a71573d6000803e3d6000fd5b50505050505b5050505050949350505050565b6000808260800151806020019051810190613a9f9190614335565b604080516001600160a01b038816602082015291925060009101604051602081830303815290604052905083600001516001600160a01b0316866001600160a01b03161015613b785783604001516001600160a01b031663857f812f308785856040518563ffffffff1660e01b8152600401613b1e949392919061475a565b6040805180830381600087803b158015613b3757600080fd5b505af1158015613b4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b6f9190614358565b9350613bae9050565b83604001516001600160a01b0316632c481252308785856040518563ffffffff1660e01b81526004016136fe949392919061475a565b50509392505050565b6000808260800151806020019051810190613bd291906145cb565b60408085015190516378a051ad60e11b8152600481018790526001600160a01b03888116602483015292935091169063f140a35a9060440160206040518083038186803b158015613c2257600080fd5b505afa158015613c36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613c5a91906145cb565b9150811561143d576040830151613c7c906001600160a01b0387169086610962565b60408301516001600160a01b031663022c0d9f8215613c9b5783613c9e565b60005b8315613cab576000613cad565b845b604080516000815260208101918290526001600160e01b031960e086901b16909152613ce0929190309060248101614aec565b600060405180830381600087803b158015613cfa57600080fd5b505af1158015613d0e573d6000803e3d6000fd5b50505050509392505050565b60608315613d86578251613d7f576001600160a01b0385163b613d7f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161017e565b508161205a565b61205a8383613f58565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e9060440160206040518083038186803b158015613ddc57600080fd5b505afa158015613df0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e1491906145cb565b613e1e9190614c37565b6040516001600160a01b0385166024820152604481018290529091506105f390859063095ea7b360e01b9060640161098e565b600080600080856001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015613e9057600080fd5b505afa158015613ea4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ec89190614562565b509150915084613ed9578082613edc565b81815b9350935050505b9250929050565b600080613ef983612710614c90565b613f039087614c71565b90506000613f216dffffffffffffffffffffffffffff861683614c71565b9050600082613f426127106dffffffffffffffffffffffffffff8a16614c71565b613f4c9190614c37565b9050612e288183614c4f565b815115613f685781518083602001fd5b8060405162461bcd60e51b815260040161017e919061482a565b805161061881614e04565b60008083601f840112613f9f57600080fd5b50813567ffffffffffffffff811115613fb757600080fd5b602083019150836020828501011115613ee357600080fd5b600082601f830112613fe057600080fd5b8135613ff3613fee82614c0f565b614bba565b81815284602083860101111561400857600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f83011261403657600080fd5b8151614044613fee82614c0f565b81815284602083860101111561405957600080fd5b61205a826020830160208701614d48565b8051600f81900b811461061857600080fd5b80516dffffffffffffffffffffffffffff8116811461061857600080fd5b805160ff8116811461061857600080fd5b6000602082840312156140bd57600080fd5b813561182681614e04565b6000602082840312156140da57600080fd5b815161182681614e04565b600080604083850312156140f857600080fd5b823561410381614e04565b946020939093013593505050565b6000806000806060858703121561412757600080fd5b843561413281614e04565b935060208501359250604085013567ffffffffffffffff81111561415557600080fd5b61416187828801613f8d565b95989497509550505050565b6000602080838503121561418057600080fd5b825167ffffffffffffffff81111561419757600080fd5b8301601f810185136141a857600080fd5b80516141b6613fee82614beb565b80828252848201915084840188868560051b87010111156141d657600080fd5b600094505b83851015614200576141ec8161406a565b8352600194909401939185019185016141db565b50979650505050505050565b6000602080838503121561421f57600080fd5b825167ffffffffffffffff81111561423657600080fd5b8301601f8101851361424757600080fd5b8051614255613fee82614beb565b80828252848201915084840188868560051b870101111561427557600080fd5b600094505b8385101561420057805183526001949094019391850191850161427a565b6000602082840312156142aa57600080fd5b813561182681614e19565b6000602082840312156142c757600080fd5b815161182681614e19565b600080604083850312156142e557600080fd5b8251915060208301516142f781614e04565b809150509250929050565b6000806040838503121561431557600080fd5b61431e8361406a565b915061432c6020840161406a565b90509250929050565b60006020828403121561434757600080fd5b81518060020b811461182657600080fd5b6000806040838503121561436b57600080fd5b505080516020909101519092909150565b6000806000806060858703121561439257600080fd5b8435935060208501359250604085013567ffffffffffffffff81111561415557600080fd5b6000602082840312156143c957600080fd5b813567ffffffffffffffff8111156143e057600080fd5b820160c0818503121561182657600080fd5b60006020828403121561440457600080fd5b815167ffffffffffffffff8082111561441c57600080fd5b908301906101a0828603121561443157600080fd5b614439614b90565b61444283613f82565b815261445060208401613f82565b602082015261446160408401613f82565b604082015261447260608401613f82565b606082015261448360808401613f82565b608082015261449460a08401613f82565b60a082015260c0838101519082015260e08084015190820152610100808401519082015261012080840151908201526101408084015190820152610160808401519082015261018080840151838111156144ed57600080fd5b6144f988828701614025565b918301919091525095945050505050565b60006040828403121561451c57600080fd5b6040516040810181811067ffffffffffffffff8211171561453f5761453f614dee565b604052825161454d81614e04565b81526020928301519281019290925250919050565b60008060006060848603121561457757600080fd5b6145808461407c565b925061458e6020850161407c565b9150604084015163ffffffff811681146145a757600080fd5b809150509250925092565b6000602082840312156145c457600080fd5b5035919050565b6000602082840312156145dd57600080fd5b5051919050565b6000602082840312156145f657600080fd5b6118268261409a565b6000806040838503121561461257600080fd5b61461b8361409a565b915061432c6020840161409a565b600081518084526020808501945080840160005b838110156146595781518752958201959082019060010161463d565b509495945050505050565b6000815180845261467c816020860160208601614d48565b601f01601f19169290920160200192915050565b600082516146a2818460208701614d48565b9190910192915050565b60006001600160a01b038088168352808716602084015285604084015280851660608401525060a0608083015261216460a0830184614664565b60006001600160a01b038088168352861515602084015285604084015280851660608401525060a0608083015261216460a0830184614664565b60006001600160a01b038088168352866020840152851515604084015280851660608401525060a0608083015261216460a0830184614664565b6001600160a01b03851681526fffffffffffffffffffffffffffffffff841660208201528260020b60408201526080606082015260006123206080830184614664565b6001600160a01b03871681528560208201528415156040820152831515606082015282608082015260c060a08201526000612e2860c0830184614664565b6020815260006118266020830184614629565b6080815260006148016080830187614664565b6001600160a01b0386811660208501528516604084015282810360608401526121648185614664565b6020815260006118266020830184614664565b602081526148576020820183516001600160a01b03169052565b6000602083015161487360408401826001600160a01b03169052565b5060408301516001600160a01b03811660608401525060608301516001600160a01b03811660808401525060808301516001600160a01b03811660a08401525060a08301516001600160a01b03811660c08401525060c083015160e08381019190915283015161010080840191909152830151610120808401919091528301516101408084019190915283015161016080840191909152830151610180808401919091528301516101a08084015261205a6101c0840182614664565b60e08152845160e0820152600060208601516002811061495f57634e487b7160e01b600052602160045260246000fd5b61010083015260408601516001600160a01b031661012083015260608601516149946101408401826001600160a01b03169052565b50608086015161016083015260a086015160c06101808401526149bb6101a0840182614664565b9150506149fd60208301866001600160a01b03808251168352602082015115156020840152806040830151166040840152506060810151151560608301525050565b60a082019390935260c0015292915050565b84815260606020808301829052908201849052600090859060808401835b87811015614a5b578335614a4081614e04565b6001600160a01b031682529282019290820190600101614a2d565b508481036040860152614a6e8187614629565b9998505050505050505050565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015614acb5784516001600160a01b031683529383019391830191600101614aa6565b50506001600160a01b03969096166060850152505050608001529392505050565b8481528360208201526001600160a01b03831660408201526080606082015260006123206080830184614664565b6000808335601e19843603018112614b3157600080fd5b83018035915067ffffffffffffffff821115614b4c57600080fd5b6020019150600581901b3603821315613ee357600080fd5b60008235605e198336030181126146a257600080fd5b60008235609e198336030181126146a257600080fd5b6040516101a0810167ffffffffffffffff81118282101715614bb457614bb4614dee565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715614be357614be3614dee565b604052919050565b600067ffffffffffffffff821115614c0557614c05614dee565b5060051b60200190565b600067ffffffffffffffff821115614c2957614c29614dee565b50601f01601f191660200190565b60008219821115614c4a57614c4a614dac565b500190565b600082614c6c57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615614c8b57614c8b614dac565b500290565b600082821015614ca257614ca2614dac565b500390565b600060a08236031215614cb957600080fd5b60405160a0810167ffffffffffffffff8282108183111715614cdd57614cdd614dee565b8160405284359150614cee82614e04565b8183526020850135602084015260408501359150614d0b82614e04565b816040840152606085013560608401526080850135915080821115614d2f57600080fd5b50614d3c36828601613fcf565b60808301525092915050565b60005b83811015614d63578181015183820152602001614d4b565b838111156105f35750506000910152565b6000600019821415614d8857614d88614dac565b5060010190565b6000600160ff1b821415614da557614da5614dac565b5060000390565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461094157600080fd5b801515811461094157600080fdfea164736f6c6343000807000a0000000000000000000000004300000000000000000000000000000000000004000000000000000000000000bd4a0f12293c54e4e8ad221271cf0d395dd60a71
Deployed Bytecode
0x6080604052600436106101115760003560e01c80638da5cb5b116100a5578063bf654aac11610074578063f14210a611610059578063f14210a6146103d4578063f2fde38b146103f4578063f3fef3a31461041457610118565b8063bf654aac1461039e578063d3e1c284146103b457610118565b80638da5cb5b14610320578063923b8a2a1461033e578063a66cd0941461035e578063ad5c46481461037e57610118565b806343f68a49116100e157806343f68a491461028f57806361d027b3146102af578063715018a6146102e75780638c04166f146102fc57610118565b8062d5a9e814610204578063187806841461022d5780632c8958f61461024f5780633e88c8ab1461026f57610118565b3661011857005b34801561012457600080fd5b5060018054146101875760405162461bcd60e51b815260206004820152602360248201527f574f574d41583a206e6f7420616c6c6f776564206f757473696465206f66207360448201526207761760ec1b60648201526084015b60405180910390fd5b600080600036600061019a600036610434565b94509450945094509450846101f15760405162461bcd60e51b815260206004820152601c60248201527f574f574d41583a20756e737570706f727465642063616c6c6261636b00000000604482015260640161017e565b6101fd848484846104a9565b5050505050005b6102176102123660046143b7565b6105f9565b60405161022491906147db565b60405180910390f35b34801561023957600080fd5b5061024d61024836600461437c565b61061d565b005b34801561025b57600080fd5b5061024d61026a36600461437c565b610685565b34801561027b57600080fd5b5061024d61028a366004614111565b6106ee565b34801561029b57600080fd5b5061024d6102aa3660046145b2565b6106fa565b3480156102bb57600080fd5b506003546102cf906001600160a01b031681565b6040516001600160a01b039091168152602001610224565b3480156102f357600080fd5b5061024d610707565b34801561030857600080fd5b5061031260055481565b604051908152602001610224565b34801561032c57600080fd5b506000546001600160a01b03166102cf565b34801561034a57600080fd5b5061024d61035936600461437c565b61071b565b34801561036a57600080fd5b5061024d6103793660046145b2565b610784565b34801561038a57600080fd5b506002546102cf906001600160a01b031681565b3480156103aa57600080fd5b5061031260045481565b3480156103c057600080fd5b5061024d6103cf36600461437c565b610791565b3480156103e057600080fd5b5061024d6103ef3660046145b2565b6107f9565b34801561040057600080fd5b5061024d61040f3660046140ab565b6108b4565b34801561042057600080fd5b5061024d61042f3660046140e5565b610944565b600080803681600487810135906024808a01359160448b01358b0191820191013580601f811680156104695780602003820191505b608482018c1461048e576000808080809a509a509a509a509a5050505050505061049f565b506001995093975091955093509150505b9295509295909350565b6000841380156104b95750600083125b15610549576105443385336001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156104fc57600080fd5b505afa158015610510573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061053491906140c8565b6001600160a01b03169190610962565b6105f3565b6000841280156105595750600083135b1561059c576105443384336001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156104fc57600080fd5b60405162461bcd60e51b815260206004820152602660248201527f574f574d41583a20556e697377617020763320696e76617269616e742076696f6044820152653630ba34b7b760d11b606482015260840161017e565b50505050565b60606106036109df565b61060c82610a42565b90506106186002600155565b919050565b600180541461067a5760405162461bcd60e51b815260206004820152602360248201527f574f574d41583a206e6f7420616c6c6f776564206f757473696465206f66207360448201526207761760ec1b606482015260840161017e565b6105f3848383610b5d565b60018054146106e25760405162461bcd60e51b815260206004820152602360248201527f574f574d41583a206e6f7420616c6c6f776564206f757473696465206f66207360448201526207761760ec1b606482015260840161017e565b6105f384848484610b81565b6105f384848484610c7e565b610702610c92565b600555565b61070f610c92565b6107196000610cec565b565b60018054146107785760405162461bcd60e51b815260206004820152602360248201527f574f574d41583a206e6f7420616c6c6f776564206f757473696465206f66207360448201526207761760ec1b606482015260840161017e565b6105f384848484610d54565b61078c610c92565b600455565b60018054146107ee5760405162461bcd60e51b815260206004820152602360248201527f574f574d41583a206e6f7420616c6c6f776564206f757473696465206f66207360448201526207761760ec1b606482015260840161017e565b6105f3838383610b5d565b610801610c92565b6003546040516000916001600160a01b03169083908381818185875af1925050503d806000811461084e576040519150601f19603f3d011682016040523d82523d6000602084013e610853565b606091505b50509050806108b05760405162461bcd60e51b8152602060048201526024808201527f576f776d61783a204661696c656420746f2073656e64206e617469766520746f6044820152636b656e7360e01b606482015260840161017e565b5050565b6108bc610c92565b6001600160a01b0381166109385760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161017e565b61094181610cec565b50565b61094c610c92565b6003546108b0906001600160a01b038481169116835b6040516001600160a01b0383166024820152604481018290526109da90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b031990931692909217909152610df2565b505050565b600180541415610a3c5760405162461bcd60e51b815260206004820152602260248201527f574f574d41583a207265656e7472616e742073776170206e6f7420616c6c6f77604482015261195960f21b606482015260840161017e565b60018055565b6060610a4d82610ed7565b6000610a588361120b565b905060005b610a6a6060850185614b1a565b9050811015610abd57610aaa610a836060860186614b1a565b83818110610a9357610a93614dd8565b9050602002810190610aa59190614b64565b6112ea565b5080610ab581614d74565b915050610a5d565b50610ac783611445565b91506000610ad860208501856140ab565b6001600160a01b031614610af857610af360208401846140ab565b610b05565b6002546001600160a01b03165b6001600160a01b0316337f25a3ab87780ac0e2eeeb645d408cbc89d66c72590ae0e1f81bda8f3d3a8d121683610b3e6040880188614b1a565b87604051610b4f9493929190614a0f565b60405180910390a350919050565b6000610b6b828401846140ab565b90506105f36001600160a01b0382163386610962565b600084138015610b915750600083125b15610bd4576105443385336001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156104fc57600080fd5b600084128015610be45750600083135b15610c27576105443384336001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156104fc57600080fd5b60405162461bcd60e51b815260206004820152602660248201527f574f574d41583a20416c676562726120563120696e76617269616e742076696f6044820152653630ba34b7b760d11b606482015260840161017e565b6105f36001600160a01b0385163385610962565b6000546001600160a01b031633146107195760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161017e565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610d6282840184614298565b90508015610dad57610da83386336001600160a01b0316630fc63d106040518163ffffffff1660e01b815260040160206040518083038186803b1580156104fc57600080fd5b610deb565b610deb3386336001600160a01b0316635f64b55b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156104fc57600080fd5b5050505050565b6000610e47826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166118149092919063ffffffff16565b8051909150156109da5780806020019051810190610e6591906142b5565b6109da5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161017e565b6000610ee66040830183614b1a565b905011610f405760405162461bcd60e51b815260206004820152602260248201527f574f574d41583a204e6f206f757470757420746f6b656e732073706563696669604482015261195960f21b606482015260840161017e565b610f4d60a0820182614b1a565b9050610f5c6040830183614b1a565b905014610fd15760405162461bcd60e51b815260206004820152602660248201527f574f574d41583a2057726f6e6720616d6f756e744f757445787065637465642060448201527f6c656e6774680000000000000000000000000000000000000000000000000000606482015260840161017e565b610fde6080820182614b1a565b9050610fed6040830183614b1a565b90501461103c5760405162461bcd60e51b815260206004820152601d60248201527f574f574d41583a2057726f6e6720736c697070616765206c656e677468000000604482015260640161017e565b60005b61104c6040830183614b1a565b90508110156108b05760006110646040840184614b1a565b8381811061107457611074614dd8565b905060200201602081019061108991906140ab565b6001600160a01b031614156110eb5760405162461bcd60e51b815260206004820152602260248201527f574f574d41583a2057726f6e67206f757470757420746f6b656e206164647265604482015261737360f01b606482015260840161017e565b60006110fa60a0840184614b1a565b8381811061110a5761110a614dd8565b90506020020135116111845760405162461bcd60e51b815260206004820152602560248201527f574f574d41583a2057726f6e6720616d6f756e744f757445787065637465642060448201527f76616c7565000000000000000000000000000000000000000000000000000000606482015260840161017e565b6005546111946080840184614b1a565b838181106111a4576111a4614dd8565b9050602002013511156111f95760405162461bcd60e51b815260206004820152601c60248201527f574f574d41583a20536c69707061676520697320746f6f206869676800000000604482015260640161017e565b8061120381614d74565b91505061103f565b6000806000341180156112335750600061122860208501856140ab565b6001600160a01b0316145b801561124157506020830135155b156112ad575060025460408051630d0e30db60e41b8152905134926001600160a01b03169163d0e30db091849160048082019260009290919082900301818588803b15801561128f57600080fd5b505af11580156112a3573d6000803e3d6000fd5b50505050506112e4565b6020830135156112e45750602082018035906112e4903390309084906112d390886140ab565b6001600160a01b031692919061182d565b92915050565b6000806112fa60208401846140ab565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a082319060240160206040518083038186803b15801561133b57600080fd5b505afa15801561134f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061137391906145cb565b90506000805b6113866040860186614b1a565b905081101561143d5761141f61139f60208701876140ab565b60208701356113b16040890189614b1a565b858181106113c1576113c1614dd8565b90506020028101906113d39190614b7a565b6113e1906020013587614c71565b6113eb9190614c4f565b6113f86040890189614b1a565b8581811061140857611408614dd8565b905060200281019061141a9190614b7a565b611865565b6114299083614c37565b91508061143581614d74565b915050611379565b509392505050565b60606114546040830183614b1a565b905067ffffffffffffffff81111561146e5761146e614dee565b604051908082528060200260200182016040528015611497578160200160208202803683370190505b50905060008060005b6114ad6040860186614b1a565b905081101561180c576114c36040860186614b1a565b828181106114d3576114d3614dd8565b90506020020160208101906114e891906140ab565b6040516370a0823160e01b81523060048201529092506001600160a01b038316906370a082319060240160206040518083038186803b15801561152a57600080fd5b505afa15801561153e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061156291906145cb565b9250600061157360a0870187614b1a565b8381811061158357611583614dd8565b905060200201358411156116625761159e60a0870187614b1a565b838181106115ae576115ae614dd8565b90506020020135846115c09190614c90565b90506000612710600454866115d59190614c71565b6115df9190614c4f565b905080821115611619579050806115f68186614c90565b86848151811061160857611608614dd8565b60200260200101818152505061165c565b61162660a0880188614b1a565b8481811061163657611636614dd8565b9050602002013586848151811061164f5761164f614dd8565b6020026020010181815250505b50611748565b6127106116726080880188614b1a565b8481811061168257611682614dd8565b905060200201356127106116969190614c90565b6116a360a0890189614b1a565b858181106116b3576116b3614dd8565b905060200201356116c49190614c71565b6116ce9190614c4f565b8410156117285760405162461bcd60e51b815260206004820152602260248201527f574f574d41583a20496e73756666696369656e74206f757470757420616d6f756044820152611b9d60f21b606482015260840161017e565b8385838151811061173b5761173b614dd8565b6020026020010181815250505b6002546001600160a01b03848116911614156117bd57600254604051632e1a7d4d60e01b8152600481018690526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b1580156117a457600080fd5b505af11580156117b8573d6000803e3d6000fd5b505050505b6003546117d59084906001600160a01b031683611e8b565b6117f983338785815181106117ec576117ec614dd8565b6020026020010151611e8b565b508061180481614d74565b9150506114a0565b505050919050565b60606118238484600085611f6e565b90505b9392505050565b6040516001600160a01b03808516602483015283166044820152606481018290526105f39085906323b872dd60e01b9060840161098e565b60007f554e49535741505f563300000000000000000000000000000000000000000000826060013514156118ac576118a5836118a084614ca7565b612062565b9050611826565b7f48415348464c4f57000000000000000000000000000000000000000000000000826060013514156118eb576118a584846118e685614ca7565b61216f565b7f574f4d42415400000000000000000000000000000000000000000000000000008260600135141561192a576118a5848461192585614ca7565b61232a565b7f4c4556454c00000000000000000000000000000000000000000000000000000082606001351415611969576118a5848461196485614ca7565b6123f5565b7f444f444f5f563200000000000000000000000000000000000000000000000000826060013514156119a8576118a584846119a385614ca7565b612599565b7f444f444f5f563300000000000000000000000000000000000000000000000000826060013514156119e7576118a584846119e285614ca7565b6126df565b7f574f4f464900000000000000000000000000000000000000000000000000000082606001351415611a26576118a58484611a2185614ca7565b612790565b7f554e49535741505f56320000000000000000000000000000000000000000000082606001351415611a65576118a58484611a6085614ca7565b612805565b7f435552564500000000000000000000000000000000000000000000000000000082606001351415611aa4576118a58484611a9f85614ca7565b612994565b7f50414e43414b45535741505f535441424c45000000000000000000000000000082606001351415611ae3576118a58484611ade85614ca7565b612b51565b7f444f444f5f56310000000000000000000000000000000000000000000000000082606001351415611b22576118a58484611b1d85614ca7565b612c68565b7f42414c414e4345525f563200000000000000000000000000000000000000000082606001351415611b61576118a58484611b5c85614ca7565b612ccd565b7f4d4156455249434b5f563100000000000000000000000000000000000000000082606001351415611b9f576118a583611b9a84614ca7565b612e34565b7f534144444c45000000000000000000000000000000000000000000000000000082606001351415611bde576118a58484611bd985614ca7565b612ee1565b7f46554c43524f4d0000000000000000000000000000000000000000000000000082606001351415611c1d576118a58484611c1885614ca7565b612ff1565b7f554e49535741505f56325f524f5554455200000000000000000000000000000082606001351415611c5c576118a58484611c5785614ca7565b613051565b7f454c41535449430000000000000000000000000000000000000000000000000082606001351415611c9b576118a58484611c9685614ca7565b61320f565b7f414c47454252415f56310000000000000000000000000000000000000000000082606001351415611cda576118a58484611cd585614ca7565b613382565b7f414c47454252415f56315f39000000000000000000000000000000000000000082606001351415611d14576118a58484611cd585614ca7565b7f53594e435357415000000000000000000000000000000000000000000000000082606001351415611d53576118a58484611d4e85614ca7565b613484565b63564f4f4960e01b82606001351415611d79576118a58484611d7485614ca7565b61366d565b7f56454c4f434f52455f563200000000000000000000000000000000000000000082606001351415611dc5576002546118a5906001600160a01b03168585611dc086614ca7565b61375a565b7f495a49535741500000000000000000000000000000000000000000000000000082606001351415611e04576118a58484611dff85614ca7565b613a84565b7f56454c4f44524f4d45000000000000000000000000000000000000000000000082606001351415611e43576118a58484611e3e85614ca7565b613bb7565b60405162461bcd60e51b815260206004820152601a60248201527f574f574d41583a20556e6b6e6f776e204445582066616d696c79000000000000604482015260640161017e565b80611e9557505050565b6002546001600160a01b0384811691161415611f5a576000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611ef8576040519150601f19603f3d011682016040523d82523d6000602084013e611efd565b606091505b50509050806105f35760405162461bcd60e51b8152602060048201526024808201527f576f776d61783a204661696c656420746f2073656e64206e617469766520746f6044820152636b656e7360e01b606482015260840161017e565b6109da6001600160a01b0384168383610962565b606082471015611fe65760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161017e565b600080866001600160a01b031685876040516120029190614690565b60006040518083038185875af1925050503d806000811461203f576040519150601f19603f3d011682016040523d82523d6000602084013e612044565b606091505b509150915061205587838387613d1a565b925050505b949350505050565b600080826080015180602001905181019061207d91906142b5565b90506000816120a05773fffd8963efd1fc6a506488495d951d5263988d256120a7565b6401000276a45b604085810151815160008082526020820193849052630251596160e31b909352929350909182916001600160a01b03169063128acb08906120f390309088908c908990602481016146e6565b6040805180830381600087803b15801561210c57600080fd5b505af1158015612120573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121449190614358565b915091508361215b5761215682614d8f565b612164565b61216481614d8f565b979650505050505050565b600080826080015180602001905181019061218a91906143f2565b60408401519091506121a7906001600160a01b0387169086613d90565b8060e001518410156121bb5760c081018490525b82516040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b1580156121fe57600080fd5b505afa158015612212573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061223691906145cb565b905083604001516001600160a01b031663c52ac720836040518263ffffffff1660e01b8152600401612268919061483d565b600060405180830381600087803b15801561228257600080fd5b505af1158015612296573d6000803e3d6000fd5b505085516040516370a0823160e01b81523060048201528493506001600160a01b0390911691506370a082319060240160206040518083038186803b1580156122de57600080fd5b505afa1580156122f2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061231691906145cb565b6123209190614c90565b9695505050505050565b6040810151600090612347906001600160a01b0386169085613d90565b60408281015183519151639908fc8b60e01b81526001600160a01b0387811660048301529283166024820152604481018690526000606482015230608482015260001960a4820152911690639908fc8b9060c4016040805180830381600087803b1580156123b457600080fd5b505af11580156123c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123ec9190614358565b50949350505050565b6040810151600090612412906001600160a01b0386169085610962565b81516040516370a0823160e01b81523060048201526000916001600160a01b0316906370a082319060240160206040518083038186803b15801561245557600080fd5b505afa158015612469573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061248d91906145cb565b6040848101518551825160008082526020820194859052631fa196a960e21b9094529394506001600160a01b0390911692637e865aa4926124d8928a929091903090602481016146ac565b600060405180830381600087803b1580156124f257600080fd5b505af1158015612506573d6000803e3d6000fd5b505084516040516370a0823160e01b81523060048201528493506001600160a01b0390911691506370a082319060240160206040518083038186803b15801561254e57600080fd5b505afa158015612562573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061258691906145cb565b6125909190614c90565b95945050505050565b60408101516000906125b6906001600160a01b0386169085610962565b600082608001518060200190518101906125d091906145e4565b905060ff8116612660576040808401519051632f58056d60e21b81523060048201526001600160a01b039091169063bd6015b490602401602060405180830381600087803b15801561262157600080fd5b505af1158015612635573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061265991906145cb565b915061143d565b6040808401519051636ec9facd60e11b81523060048201526001600160a01b039091169063dd93f59a90602401602060405180830381600087803b1580156126a757600080fd5b505af11580156126bb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061259091906145cb565b60408082015182519151637597a8d360e11b81523060048201526001600160a01b03868116602483015292831660448201526064810185905260006084820181905260c060a483015260c48201819052929091169063eb2f51a69060e4015b602060405180830381600087803b15801561275857600080fd5b505af115801561276c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061182391906145cb565b60408101516000906127ad906001600160a01b0386169085610962565b60408281015183519151633ee101c160e11b81526001600160a01b03878116600483015292831660248201526044810186905260006064820181905230608483015260a4820152911690637dc203829060c40161273e565b6040810151600090612822906001600160a01b0386169085610962565b6000826080015180602001905181019061283c91906145cb565b90506000856001600160a01b031684604001516001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561288757600080fd5b505afa15801561289b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128bf91906140c8565b6001600160a01b03161490506000806128dc866040015184613e51565b915091506128ec87838387613eea565b945084156129895785604001516001600160a01b031663022c0d9f846129125786612915565b60005b85612921576000612923565b875b604080516000815260208101918290526001600160e01b031960e086901b16909152612956929190309060248101614aec565b600060405180830381600087803b15801561297057600080fd5b505af1158015612984573d6000803e3d6000fd5b505050505b505050509392505050565b600080600083608001518060200190518101906129b19190614302565b85516040516370a0823160e01b81523060048201529294509092506000916001600160a01b03909116906370a082319060240160206040518083038186803b1580156129fc57600080fd5b505afa158015612a10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a3491906145cb565b6040860151909150612a51906001600160a01b0389169088613d90565b6040808601519051630f7c084960e21b8152600f85810b600483015284900b602482015260448101889052600060648201526001600160a01b0390911690633df02124906084015b600060405180830381600087803b158015612ab357600080fd5b505af1158015612ac7573d6000803e3d6000fd5b505086516040516370a0823160e01b81523060048201528493506001600160a01b0390911691506370a082319060240160206040518083038186803b158015612b0f57600080fd5b505afa158015612b23573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b4791906145cb565b6121649190614c90565b60008060008360800151806020019051810190612b6e9190614302565b85516040516370a0823160e01b81523060048201529294509092506000916001600160a01b03909116906370a082319060240160206040518083038186803b158015612bb957600080fd5b505afa158015612bcd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bf191906145cb565b6040860151909150612c0e906001600160a01b0389169088613d90565b6040808601519051630b68372160e31b81526fffffffffffffffffffffffffffffffff80861660048301528416602482015260448101889052600060648201526001600160a01b0390911690635b41b90890608401612a99565b6040810151600090612c85906001600160a01b0386169085613d90565b6040808301519051638dae733360e01b8152600481018590526000602482018190526060604483015260648201526001600160a01b0390911690638dae73339060840161273e565b60008060008360800151806020019051810190612cea91906142d2565b9150915060006040518060c0016040528084815260200160006001811115612d1457612d14614dc2565b81526001600160a01b03808a16602083015287511660408201526060810188905260800160006040519080825280601f01601f191660200182016040528015612d64576020820181803683370190505b5090526040805160808101825230808252600060208301819052928201526060810191909152909150612da16001600160a01b0389168489613d90565b6040516352bbbe2960e01b81526001600160a01b038416906352bbbe2990612dd690859085906000906000199060040161492f565b602060405180830381600087803b158015612df057600080fd5b505af1158015612e04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e2891906145cb565b98975050505050505050565b6000808260800151806020019051810190612e4f91906142b5565b905082604001516001600160a01b031663c51c902930868460008089608001516040518763ffffffff1660e01b8152600401612e909695949392919061479d565b6040805180830381600087803b158015612ea957600080fd5b505af1158015612ebd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125909190614358565b60008060008360800151806020019051810190612efe91906145ff565b85516040516370a0823160e01b81523060048201529294509092506000916001600160a01b03909116906370a082319060240160206040518083038186803b158015612f4957600080fd5b505afa158015612f5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f8191906145cb565b6040860151909150612f9e906001600160a01b0389169088613d90565b60408086015190516348b4aac360e11b815260ff808616600483015284166024820152604481018890526000606482015260001960848201526001600160a01b039091169063916955869060a401612a99565b604081015160009061300e906001600160a01b0386169085610962565b60408281015183519151634998b10960e11b81526001600160a01b038781166004830152928316602482015230604482015291169063933162129060640161273e565b60008082604001516001600160a01b031663f887ea406040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561309357600080fd5b505af11580156130a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130cb91906140c8565b90506130e16001600160a01b0386168286613d90565b604080516002808252606082018352600092602083019080368337019050509050858160008151811061311657613116614dd8565b60200260200101906001600160a01b031690816001600160a01b03168152505083600001518160018151811061314e5761314e614dd8565b6001600160a01b0392831660209182029290920101526040516338ed173960e01b8152908316906338ed1739906131949088906000908690309060001990600401614a7b565b600060405180830381600087803b1580156131ae57600080fd5b505af11580156131c2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526131ea919081019061420c565b6001815181106131fc576131fc614dd8565b6020026020010151925050509392505050565b60008082604001516001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561324f57600080fd5b505afa158015613263573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061328791906140c8565b6001600160a01b0316856001600160a01b03161490506000816132be5773fffd8963efd1fc6a506488495d951d5263988d256132c5565b6401000276a45b60408581015181516000808252602082019384905263092cc68360e21b909352929350909182916001600160a01b0316906324b31a0c906133119030908b908990899060248101614720565b6040805180830381600087803b15801561332a57600080fd5b505af115801561333e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133629190614358565b91509150836133795761337482614d8f565b612e28565b612e2881614d8f565b60008082604001516001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156133c257600080fd5b505afa1580156133d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133fa91906140c8565b6001600160a01b0316856001600160a01b03161490506000816134315773fffd8963efd1fc6a506488495d951d5263988d25613438565b6401000276a45b604085810151815160008082526020820193849052630251596160e31b909352929350909182916001600160a01b03169063128acb089061331190309088908c908990602481016146e6565b60008082604001516001600160a01b031663fbfa77cf6040518163ffffffff1660e01b815260040160206040518083038186803b1580156134c457600080fd5b505afa1580156134d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134fc91906140c8565b90506135126001600160a01b0386168286610962565b6040838101519051631f2c13e160e31b81526001600160a01b03878116600483015291821660248201529082169063f9609f0890604401602060405180830381600087803b15801561356357600080fd5b505af1158015613577573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061359b91906145cb565b50604080516001600160a01b03878116602083015230828401526002606080840191909152835180840390910181526080830180855287850151600080835260a0860196879052637132bb7f60e01b9096529194939190921691637132bb7f9161360d9186918691829160a4016147ee565b6040805180830381600087803b15801561362657600080fd5b505af115801561363a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061365e919061450a565b60200151979650505050505050565b6000806000836080015180602001905181019061368a91906145ff565b604086015191935091506136a9906001600160a01b0388169087613d90565b60408085015190516347b5ef5560e11b815260ff808516600483015283166024820152604481018790526000606482015230608482015260001960a48201526001600160a01b0390911690638f6bdeaa9060c4015b6040805180830381600087803b15801561371757600080fd5b505af115801561372b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061374f9190614358565b509695505050505050565b600080826080015180602001905181019061377591906140c8565b90508060006001600160a01b03878116908916146137935786613796565b60005b90506000886001600160a01b031686600001516001600160a01b0316146137be5785516137c1565b60005b905060606001600160a01b03831661390357604051632e1a7d4d60e01b8152600481018990526001600160a01b038b1690632e1a7d4d90602401600060405180830381600087803b15801561381557600080fd5b505af1158015613829573d6000803e3d6000fd5b50505060408089015190516342f3185360e11b81526001600160a01b039182166004820152600060248201819052868316604483015260648201819052600f8c900b608483015285831660a4830152600160c483015260e4820181905261012061010483015261012482015290861691506385e630a6908a90610144016000604051808303818588803b1580156138bf57600080fd5b505af11580156138d3573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f191682016040526138fc919081019061416d565b90506139e7565b6139176001600160a01b038416858a613d90565b60408781015190516342f3185360e11b81526001600160a01b039182166004820152600060248201819052858316604483015260648201819052600f8b900b608483015284831660a4830152600160c483015260e48201819052610120610104830152610124820152908516906385e630a69061014401600060405180830381600087803b1580156139a857600080fd5b505af11580156139bc573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526139e4919081019061416d565b90505b806001815181106139fa576139fa614dd8565b6020026020010151600f0b955060006001600160a01b0316826001600160a01b03161415613a7757896001600160a01b031663d0e30db0876040518263ffffffff1660e01b81526004016000604051808303818588803b158015613a5d57600080fd5b505af1158015613a71573d6000803e3d6000fd5b50505050505b5050505050949350505050565b6000808260800151806020019051810190613a9f9190614335565b604080516001600160a01b038816602082015291925060009101604051602081830303815290604052905083600001516001600160a01b0316866001600160a01b03161015613b785783604001516001600160a01b031663857f812f308785856040518563ffffffff1660e01b8152600401613b1e949392919061475a565b6040805180830381600087803b158015613b3757600080fd5b505af1158015613b4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b6f9190614358565b9350613bae9050565b83604001516001600160a01b0316632c481252308785856040518563ffffffff1660e01b81526004016136fe949392919061475a565b50509392505050565b6000808260800151806020019051810190613bd291906145cb565b60408085015190516378a051ad60e11b8152600481018790526001600160a01b03888116602483015292935091169063f140a35a9060440160206040518083038186803b158015613c2257600080fd5b505afa158015613c36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613c5a91906145cb565b9150811561143d576040830151613c7c906001600160a01b0387169086610962565b60408301516001600160a01b031663022c0d9f8215613c9b5783613c9e565b60005b8315613cab576000613cad565b845b604080516000815260208101918290526001600160e01b031960e086901b16909152613ce0929190309060248101614aec565b600060405180830381600087803b158015613cfa57600080fd5b505af1158015613d0e573d6000803e3d6000fd5b50505050509392505050565b60608315613d86578251613d7f576001600160a01b0385163b613d7f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161017e565b508161205a565b61205a8383613f58565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e9060440160206040518083038186803b158015613ddc57600080fd5b505afa158015613df0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e1491906145cb565b613e1e9190614c37565b6040516001600160a01b0385166024820152604481018290529091506105f390859063095ea7b360e01b9060640161098e565b600080600080856001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015613e9057600080fd5b505afa158015613ea4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ec89190614562565b509150915084613ed9578082613edc565b81815b9350935050505b9250929050565b600080613ef983612710614c90565b613f039087614c71565b90506000613f216dffffffffffffffffffffffffffff861683614c71565b9050600082613f426127106dffffffffffffffffffffffffffff8a16614c71565b613f4c9190614c37565b9050612e288183614c4f565b815115613f685781518083602001fd5b8060405162461bcd60e51b815260040161017e919061482a565b805161061881614e04565b60008083601f840112613f9f57600080fd5b50813567ffffffffffffffff811115613fb757600080fd5b602083019150836020828501011115613ee357600080fd5b600082601f830112613fe057600080fd5b8135613ff3613fee82614c0f565b614bba565b81815284602083860101111561400857600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f83011261403657600080fd5b8151614044613fee82614c0f565b81815284602083860101111561405957600080fd5b61205a826020830160208701614d48565b8051600f81900b811461061857600080fd5b80516dffffffffffffffffffffffffffff8116811461061857600080fd5b805160ff8116811461061857600080fd5b6000602082840312156140bd57600080fd5b813561182681614e04565b6000602082840312156140da57600080fd5b815161182681614e04565b600080604083850312156140f857600080fd5b823561410381614e04565b946020939093013593505050565b6000806000806060858703121561412757600080fd5b843561413281614e04565b935060208501359250604085013567ffffffffffffffff81111561415557600080fd5b61416187828801613f8d565b95989497509550505050565b6000602080838503121561418057600080fd5b825167ffffffffffffffff81111561419757600080fd5b8301601f810185136141a857600080fd5b80516141b6613fee82614beb565b80828252848201915084840188868560051b87010111156141d657600080fd5b600094505b83851015614200576141ec8161406a565b8352600194909401939185019185016141db565b50979650505050505050565b6000602080838503121561421f57600080fd5b825167ffffffffffffffff81111561423657600080fd5b8301601f8101851361424757600080fd5b8051614255613fee82614beb565b80828252848201915084840188868560051b870101111561427557600080fd5b600094505b8385101561420057805183526001949094019391850191850161427a565b6000602082840312156142aa57600080fd5b813561182681614e19565b6000602082840312156142c757600080fd5b815161182681614e19565b600080604083850312156142e557600080fd5b8251915060208301516142f781614e04565b809150509250929050565b6000806040838503121561431557600080fd5b61431e8361406a565b915061432c6020840161406a565b90509250929050565b60006020828403121561434757600080fd5b81518060020b811461182657600080fd5b6000806040838503121561436b57600080fd5b505080516020909101519092909150565b6000806000806060858703121561439257600080fd5b8435935060208501359250604085013567ffffffffffffffff81111561415557600080fd5b6000602082840312156143c957600080fd5b813567ffffffffffffffff8111156143e057600080fd5b820160c0818503121561182657600080fd5b60006020828403121561440457600080fd5b815167ffffffffffffffff8082111561441c57600080fd5b908301906101a0828603121561443157600080fd5b614439614b90565b61444283613f82565b815261445060208401613f82565b602082015261446160408401613f82565b604082015261447260608401613f82565b606082015261448360808401613f82565b608082015261449460a08401613f82565b60a082015260c0838101519082015260e08084015190820152610100808401519082015261012080840151908201526101408084015190820152610160808401519082015261018080840151838111156144ed57600080fd5b6144f988828701614025565b918301919091525095945050505050565b60006040828403121561451c57600080fd5b6040516040810181811067ffffffffffffffff8211171561453f5761453f614dee565b604052825161454d81614e04565b81526020928301519281019290925250919050565b60008060006060848603121561457757600080fd5b6145808461407c565b925061458e6020850161407c565b9150604084015163ffffffff811681146145a757600080fd5b809150509250925092565b6000602082840312156145c457600080fd5b5035919050565b6000602082840312156145dd57600080fd5b5051919050565b6000602082840312156145f657600080fd5b6118268261409a565b6000806040838503121561461257600080fd5b61461b8361409a565b915061432c6020840161409a565b600081518084526020808501945080840160005b838110156146595781518752958201959082019060010161463d565b509495945050505050565b6000815180845261467c816020860160208601614d48565b601f01601f19169290920160200192915050565b600082516146a2818460208701614d48565b9190910192915050565b60006001600160a01b038088168352808716602084015285604084015280851660608401525060a0608083015261216460a0830184614664565b60006001600160a01b038088168352861515602084015285604084015280851660608401525060a0608083015261216460a0830184614664565b60006001600160a01b038088168352866020840152851515604084015280851660608401525060a0608083015261216460a0830184614664565b6001600160a01b03851681526fffffffffffffffffffffffffffffffff841660208201528260020b60408201526080606082015260006123206080830184614664565b6001600160a01b03871681528560208201528415156040820152831515606082015282608082015260c060a08201526000612e2860c0830184614664565b6020815260006118266020830184614629565b6080815260006148016080830187614664565b6001600160a01b0386811660208501528516604084015282810360608401526121648185614664565b6020815260006118266020830184614664565b602081526148576020820183516001600160a01b03169052565b6000602083015161487360408401826001600160a01b03169052565b5060408301516001600160a01b03811660608401525060608301516001600160a01b03811660808401525060808301516001600160a01b03811660a08401525060a08301516001600160a01b03811660c08401525060c083015160e08381019190915283015161010080840191909152830151610120808401919091528301516101408084019190915283015161016080840191909152830151610180808401919091528301516101a08084015261205a6101c0840182614664565b60e08152845160e0820152600060208601516002811061495f57634e487b7160e01b600052602160045260246000fd5b61010083015260408601516001600160a01b031661012083015260608601516149946101408401826001600160a01b03169052565b50608086015161016083015260a086015160c06101808401526149bb6101a0840182614664565b9150506149fd60208301866001600160a01b03808251168352602082015115156020840152806040830151166040840152506060810151151560608301525050565b60a082019390935260c0015292915050565b84815260606020808301829052908201849052600090859060808401835b87811015614a5b578335614a4081614e04565b6001600160a01b031682529282019290820190600101614a2d565b508481036040860152614a6e8187614629565b9998505050505050505050565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015614acb5784516001600160a01b031683529383019391830191600101614aa6565b50506001600160a01b03969096166060850152505050608001529392505050565b8481528360208201526001600160a01b03831660408201526080606082015260006123206080830184614664565b6000808335601e19843603018112614b3157600080fd5b83018035915067ffffffffffffffff821115614b4c57600080fd5b6020019150600581901b3603821315613ee357600080fd5b60008235605e198336030181126146a257600080fd5b60008235609e198336030181126146a257600080fd5b6040516101a0810167ffffffffffffffff81118282101715614bb457614bb4614dee565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715614be357614be3614dee565b604052919050565b600067ffffffffffffffff821115614c0557614c05614dee565b5060051b60200190565b600067ffffffffffffffff821115614c2957614c29614dee565b50601f01601f191660200190565b60008219821115614c4a57614c4a614dac565b500190565b600082614c6c57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615614c8b57614c8b614dac565b500290565b600082821015614ca257614ca2614dac565b500390565b600060a08236031215614cb957600080fd5b60405160a0810167ffffffffffffffff8282108183111715614cdd57614cdd614dee565b8160405284359150614cee82614e04565b8183526020850135602084015260408501359150614d0b82614e04565b816040840152606085013560608401526080850135915080821115614d2f57600080fd5b50614d3c36828601613fcf565b60808301525092915050565b60005b83811015614d63578181015183820152602001614d4b565b838111156105f35750506000910152565b6000600019821415614d8857614d88614dac565b5060010190565b6000600160ff1b821415614da557614da5614dac565b5060000390565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461094157600080fd5b801515811461094157600080fdfea164736f6c6343000807000a
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000004300000000000000000000000000000000000004000000000000000000000000bd4a0f12293c54e4e8ad221271cf0d395dd60a71
-----Decoded View---------------
Arg [0] : _weth (address): 0x4300000000000000000000000000000000000004
Arg [1] : _treasury (address): 0xBD4a0F12293C54e4E8ad221271CF0d395dd60a71
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000004300000000000000000000000000000000000004
Arg [1] : 000000000000000000000000bd4a0f12293c54e4e8ad221271cf0d395dd60a71
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
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.