Feature Tip: Add private address tag to any address under My Name Tag !
Source Code
Latest 1 from a total of 1 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Update Proxy Con... | 12881588 | 1708 days ago | IN | 0 ETH | 0.00071625 |
Latest 25 internal transactions (View All)
Advanced mode:
| Parent Transaction Hash | Method | Block |
From
|
|
To
|
||
|---|---|---|---|---|---|---|---|
| Swap Exact ETH F... | 15248648 | 1336 days ago | 0.002498 ETH | ||||
| Transfer | 15248648 | 1336 days ago | 0.002498 ETH | ||||
| - | 13682386 | 1583 days ago | 1.79856 ETH | ||||
| - | 13682386 | 1583 days ago | 1.79856 ETH | ||||
| - | 13678941 | 1584 days ago | 0.739408 ETH | ||||
| - | 13678941 | 1584 days ago | 0.739408 ETH | ||||
| - | 13640717 | 1590 days ago | 0.009992 ETH | ||||
| - | 13640717 | 1590 days ago | 0.009992 ETH | ||||
| - | 13638115 | 1590 days ago | 8.25043908 ETH | ||||
| - | 13638115 | 1590 days ago | 8.25043908 ETH | ||||
| - | 13637788 | 1590 days ago | 2.14921929 ETH | ||||
| - | 13637788 | 1590 days ago | 2.14921929 ETH | ||||
| - | 13635019 | 1591 days ago | 0.63839917 ETH | ||||
| - | 13635019 | 1591 days ago | 0.63839917 ETH | ||||
| - | 13611830 | 1595 days ago | 0.019984 ETH | ||||
| - | 13611830 | 1595 days ago | 0.019984 ETH | ||||
| - | 13611801 | 1595 days ago | 0.009992 ETH | ||||
| - | 13611801 | 1595 days ago | 0.009992 ETH | ||||
| - | 13594344 | 1597 days ago | 0.019984 ETH | ||||
| - | 13594344 | 1597 days ago | 0.019984 ETH | ||||
| - | 13575286 | 1600 days ago | 0.014988 ETH | ||||
| - | 13575286 | 1600 days ago | 0.014988 ETH | ||||
| - | 13570259 | 1601 days ago | 0.159872 ETH | ||||
| - | 13570259 | 1601 days ago | 0.159872 ETH | ||||
| - | 13568181 | 1601 days ago | 0.04996 ETH |
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
UniSwap
Compiler Version
v0.7.6+commit.7338295f
Optimization Enabled:
Yes with 780 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.6;
pragma experimental ABIEncoderV2;
import "./BaseSwap.sol";
import "../libraries/BytesLib.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "@kyber.network/utils-sc/contracts/IERC20Ext.sol";
import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";
/// General swap for uniswap and its clones
contract UniSwap is BaseSwap {
using SafeERC20 for IERC20Ext;
using SafeMath for uint256;
using Address for address;
using EnumerableSet for EnumerableSet.AddressSet;
using BytesLib for bytes;
EnumerableSet.AddressSet private uniRouters;
event UpdatedUniRouters(IUniswapV2Router02[] routers, bool isSupported);
constructor(address _admin, IUniswapV2Router02[] memory routers) BaseSwap(_admin) {
for (uint256 i = 0; i < routers.length; i++) {
uniRouters.add(address(routers[i]));
}
}
function getAllUniRouters() external view returns (address[] memory addresses) {
uint256 length = uniRouters.length();
addresses = new address[](length);
for (uint256 i = 0; i < length; i++) {
addresses[i] = uniRouters.at(i);
}
}
function updateUniRouters(IUniswapV2Router02[] calldata routers, bool isSupported)
external
onlyAdmin
{
for (uint256 i = 0; i < routers.length; i++) {
if (isSupported) {
uniRouters.add(address(routers[i]));
} else {
uniRouters.remove(address(routers[i]));
}
}
emit UpdatedUniRouters(routers, isSupported);
}
/// @dev get expected return and conversion rate if using a Uni router
function getExpectedReturn(GetExpectedReturnParams calldata params)
external
view
override
onlyProxyContract
returns (uint256 destAmount)
{
IUniswapV2Router02 router = parseExtraArgs(params.extraArgs);
uint256[] memory amounts = router.getAmountsOut(params.srcAmount, params.tradePath);
destAmount = amounts[params.tradePath.length - 1];
}
function getExpectedIn(GetExpectedInParams calldata params)
external
view
override
onlyProxyContract
returns (uint256 srcAmount)
{
IUniswapV2Router02 router = parseExtraArgs(params.extraArgs);
uint256[] memory amounts = router.getAmountsIn(params.destAmount, params.tradePath);
srcAmount = amounts[0];
}
/// @dev swap token via a supported UniSwap router
/// @notice for some tokens that are paying fee, for example: DGX
/// contract will trade with received src token amount (after minus fee)
/// for UniSwap, fee will be taken in src token
function swap(SwapParams calldata params)
external
payable
override
onlyProxyContract
returns (uint256 destAmount)
{
require(params.tradePath.length >= 2, "invalid tradePath");
IUniswapV2Router02 router = parseExtraArgs(params.extraArgs);
safeApproveAllowance(address(router), IERC20Ext(params.tradePath[0]));
uint256 tradeLen = params.tradePath.length;
IERC20Ext actualSrc = IERC20Ext(params.tradePath[0]);
IERC20Ext actualDest = IERC20Ext(params.tradePath[tradeLen - 1]);
// convert eth/bnb -> weth/wbnb address to trade on Uni
address[] memory convertedTradePath = params.tradePath;
if (convertedTradePath[0] == address(ETH_TOKEN_ADDRESS)) {
convertedTradePath[0] = router.WETH();
}
if (convertedTradePath[tradeLen - 1] == address(ETH_TOKEN_ADDRESS)) {
convertedTradePath[tradeLen - 1] = router.WETH();
}
uint256 destBalanceBefore = getBalance(actualDest, params.recipient);
if (actualSrc == ETH_TOKEN_ADDRESS) {
// swap eth/bnb -> token
router.swapExactETHForTokensSupportingFeeOnTransferTokens{value: params.srcAmount}(
params.minDestAmount,
convertedTradePath,
params.recipient,
MAX_AMOUNT
);
} else {
if (actualDest == ETH_TOKEN_ADDRESS) {
// swap token -> eth/bnb
router.swapExactTokensForETHSupportingFeeOnTransferTokens(
params.srcAmount,
params.minDestAmount,
convertedTradePath,
params.recipient,
MAX_AMOUNT
);
} else {
// swap token -> token
router.swapExactTokensForTokensSupportingFeeOnTransferTokens(
params.srcAmount,
params.minDestAmount,
convertedTradePath,
params.recipient,
MAX_AMOUNT
);
}
}
destAmount = getBalance(actualDest, params.recipient).sub(destBalanceBefore);
}
/// @param extraArgs expecting <[20B] address router>
function parseExtraArgs(bytes calldata extraArgs)
internal
view
returns (IUniswapV2Router02 router)
{
require(extraArgs.length == 20, "invalid args");
router = IUniswapV2Router02(extraArgs.toAddress(0));
require(router != IUniswapV2Router02(0), "invalid address");
require(uniRouters.contains(address(router)), "unsupported router");
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.6;
pragma abicoder v2;
import "@kyber.network/utils-sc/contracts/Withdrawable.sol";
import "@kyber.network/utils-sc/contracts/Utils.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "./ISwap.sol";
abstract contract BaseSwap is ISwap, Withdrawable, Utils {
using SafeERC20 for IERC20Ext;
using SafeMath for uint256;
uint256 internal constant MAX_AMOUNT = type(uint256).max;
address public proxyContract;
event UpdatedproxyContract(address indexed _oldProxyImpl, address indexed _newProxyImpl);
modifier onlyProxyContract() {
require(msg.sender == proxyContract, "only swap impl");
_;
}
constructor(address _admin) Withdrawable(_admin) {}
receive() external payable {}
function updateProxyContract(address _proxyContract) external onlyAdmin {
require(_proxyContract != address(0), "invalid swap impl");
emit UpdatedproxyContract(proxyContract, _proxyContract);
proxyContract = _proxyContract;
}
// Swap contracts don't keep funds. It's safe to set the max allowance
function safeApproveAllowance(address spender, IERC20Ext token) internal {
if (token != ETH_TOKEN_ADDRESS && token.allowance(address(this), spender) == 0) {
token.safeApprove(spender, MAX_ALLOWANCE);
}
}
}pragma solidity 0.7.6;
library BytesLib {
function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) {
require(_start + 20 >= _start, "toAddress_overflow");
require(_bytes.length >= _start + 20, "toAddress_outOfBounds");
address tempAddress;
assembly {
tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)
}
return tempAddress;
}
function toUint24(bytes memory _bytes, uint256 _start) internal pure returns (uint24) {
require(_start + 3 >= _start, "toUint24_overflow");
require(_bytes.length >= _start + 3, "toUint24_outOfBounds");
uint24 tempUint;
assembly {
tempUint := mload(add(add(_bytes, 0x3), _start))
}
return tempUint;
}
function toUint256(bytes memory _bytes, uint256 _start) internal pure returns (uint256) {
require(_start + 32 >= _start, "toUint256_overflow");
require(_bytes.length >= _start + 32, "toUint256_outOfBounds");
uint256 tempUint;
assembly {
tempUint := mload(add(add(_bytes, 0x20), _start))
}
return tempUint;
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "./IERC20.sol";
import "../../math/SafeMath.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 SafeMath for uint256;
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'
// solhint-disable-next-line max-line-length
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).add(value);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
/**
* @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
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.2 <0.8.0;
/**
* @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
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 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");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(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 functionCall(target, data, "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");
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(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) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(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) {
require(isContract(target), "Address: delegate call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
// 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
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
* and `uint256` (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping (bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
// When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
// so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/**
* @dev Interface extending ERC20 standard to include decimals() as
* it is optional in the OpenZeppelin IERC20 interface.
*/
interface IERC20Ext is IERC20 {
/**
* @dev This function is required as Kyber requires to interact
* with token.decimals() with many of its operations.
*/
function decimals() external view returns (uint8 digits);
}pragma solidity >=0.6.2;
import './IUniswapV2Router01.sol';
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "./IERC20Ext.sol";
import "./PermissionAdmin.sol";
abstract contract Withdrawable is PermissionAdmin {
using SafeERC20 for IERC20Ext;
event TokenWithdraw(IERC20Ext token, uint256 amount, address sendTo);
event EtherWithdraw(uint256 amount, address sendTo);
constructor(address _admin) PermissionAdmin(_admin) {}
/**
* @dev Withdraw all IERC20Ext compatible tokens
* @param token IERC20Ext The address of the token contract
*/
function withdrawToken(
IERC20Ext token,
uint256 amount,
address sendTo
) external onlyAdmin {
token.safeTransfer(sendTo, amount);
emit TokenWithdraw(token, amount, sendTo);
}
/**
* @dev Withdraw Ethers
*/
function withdrawEther(uint256 amount, address payable sendTo) external onlyAdmin {
(bool success, ) = sendTo.call{value: amount}("");
require(success, "withdraw failed");
emit EtherWithdraw(amount, sendTo);
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
import "./IERC20Ext.sol";
/**
* @title Kyber utility file
* mostly shared constants and rate calculation helpers
* inherited by most of kyber contracts.
* previous utils implementations are for previous solidity versions.
*/
abstract contract Utils {
// Declared constants below to be used in tandem with
// getDecimalsConstant(), for gas optimization purposes
// which return decimals from a constant list of popular
// tokens.
IERC20Ext internal constant ETH_TOKEN_ADDRESS = IERC20Ext(
0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
);
IERC20Ext internal constant USDT_TOKEN_ADDRESS = IERC20Ext(
0xdAC17F958D2ee523a2206206994597C13D831ec7
);
IERC20Ext internal constant DAI_TOKEN_ADDRESS = IERC20Ext(
0x6B175474E89094C44Da98b954EedeAC495271d0F
);
IERC20Ext internal constant USDC_TOKEN_ADDRESS = IERC20Ext(
0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
);
IERC20Ext internal constant WBTC_TOKEN_ADDRESS = IERC20Ext(
0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599
);
IERC20Ext internal constant KNC_TOKEN_ADDRESS = IERC20Ext(
0xdd974D5C2e2928deA5F71b9825b8b646686BD200
);
uint256 public constant BPS = 10000; // Basic Price Steps. 1 step = 0.01%
uint256 internal constant PRECISION = (10**18);
uint256 internal constant MAX_QTY = (10**28); // 10B tokens
uint256 internal constant MAX_RATE = (PRECISION * 10**7); // up to 10M tokens per eth
uint256 internal constant MAX_DECIMALS = 18;
uint256 internal constant ETH_DECIMALS = 18;
uint256 internal constant MAX_ALLOWANCE = uint256(-1); // token.approve inifinite
mapping(IERC20Ext => uint256) internal decimals;
/// @dev Sets the decimals of a token to storage if not already set, and returns
/// the decimals value of the token. Prefer using this function over
/// getDecimals(), to avoid forgetting to set decimals in local storage.
/// @param token The token type
/// @return tokenDecimals The decimals of the token
function getSetDecimals(IERC20Ext token) internal returns (uint256 tokenDecimals) {
tokenDecimals = getDecimalsConstant(token);
if (tokenDecimals > 0) return tokenDecimals;
tokenDecimals = decimals[token];
if (tokenDecimals == 0) {
tokenDecimals = token.decimals();
decimals[token] = tokenDecimals;
}
}
/// @dev Get the balance of a user
/// @param token The token type
/// @param user The user's address
/// @return The balance
function getBalance(IERC20Ext token, address user) internal view returns (uint256) {
if (token == ETH_TOKEN_ADDRESS) {
return user.balance;
} else {
return token.balanceOf(user);
}
}
/// @dev Get the decimals of a token, read from the constant list, storage,
/// or from token.decimals(). Prefer using getSetDecimals when possible.
/// @param token The token type
/// @return tokenDecimals The decimals of the token
function getDecimals(IERC20Ext token) internal view returns (uint256 tokenDecimals) {
// return token decimals if has constant value
tokenDecimals = getDecimalsConstant(token);
if (tokenDecimals > 0) return tokenDecimals;
// handle case where token decimals is not a declared decimal constant
tokenDecimals = decimals[token];
// moreover, very possible that old tokens have decimals 0
// these tokens will just have higher gas fees.
return (tokenDecimals > 0) ? tokenDecimals : token.decimals();
}
function calcDestAmount(
IERC20Ext src,
IERC20Ext dest,
uint256 srcAmount,
uint256 rate
) internal view returns (uint256) {
return calcDstQty(srcAmount, getDecimals(src), getDecimals(dest), rate);
}
function calcSrcAmount(
IERC20Ext src,
IERC20Ext dest,
uint256 destAmount,
uint256 rate
) internal view returns (uint256) {
return calcSrcQty(destAmount, getDecimals(src), getDecimals(dest), rate);
}
function calcDstQty(
uint256 srcQty,
uint256 srcDecimals,
uint256 dstDecimals,
uint256 rate
) internal pure returns (uint256) {
require(srcQty <= MAX_QTY, "srcQty > MAX_QTY");
require(rate <= MAX_RATE, "rate > MAX_RATE");
if (dstDecimals >= srcDecimals) {
require((dstDecimals - srcDecimals) <= MAX_DECIMALS, "dst - src > MAX_DECIMALS");
return (srcQty * rate * (10**(dstDecimals - srcDecimals))) / PRECISION;
} else {
require((srcDecimals - dstDecimals) <= MAX_DECIMALS, "src - dst > MAX_DECIMALS");
return (srcQty * rate) / (PRECISION * (10**(srcDecimals - dstDecimals)));
}
}
function calcSrcQty(
uint256 dstQty,
uint256 srcDecimals,
uint256 dstDecimals,
uint256 rate
) internal pure returns (uint256) {
require(dstQty <= MAX_QTY, "dstQty > MAX_QTY");
require(rate <= MAX_RATE, "rate > MAX_RATE");
//source quantity is rounded up. to avoid dest quantity being too low.
uint256 numerator;
uint256 denominator;
if (srcDecimals >= dstDecimals) {
require((srcDecimals - dstDecimals) <= MAX_DECIMALS, "src - dst > MAX_DECIMALS");
numerator = (PRECISION * dstQty * (10**(srcDecimals - dstDecimals)));
denominator = rate;
} else {
require((dstDecimals - srcDecimals) <= MAX_DECIMALS, "dst - src > MAX_DECIMALS");
numerator = (PRECISION * dstQty);
denominator = (rate * (10**(dstDecimals - srcDecimals)));
}
return (numerator + denominator - 1) / denominator; //avoid rounding down errors
}
function calcRateFromQty(
uint256 srcAmount,
uint256 destAmount,
uint256 srcDecimals,
uint256 dstDecimals
) internal pure returns (uint256) {
require(srcAmount <= MAX_QTY, "srcAmount > MAX_QTY");
require(destAmount <= MAX_QTY, "destAmount > MAX_QTY");
if (dstDecimals >= srcDecimals) {
require((dstDecimals - srcDecimals) <= MAX_DECIMALS, "dst - src > MAX_DECIMALS");
return ((destAmount * PRECISION) / ((10**(dstDecimals - srcDecimals)) * srcAmount));
} else {
require((srcDecimals - dstDecimals) <= MAX_DECIMALS, "src - dst > MAX_DECIMALS");
return ((destAmount * PRECISION * (10**(srcDecimals - dstDecimals))) / srcAmount);
}
}
/// @dev save storage access by declaring token decimal constants
/// @param token The token type
/// @return token decimals
function getDecimalsConstant(IERC20Ext token) internal pure returns (uint256) {
if (token == ETH_TOKEN_ADDRESS) {
return ETH_DECIMALS;
} else if (token == USDT_TOKEN_ADDRESS) {
return 6;
} else if (token == DAI_TOKEN_ADDRESS) {
return 18;
} else if (token == USDC_TOKEN_ADDRESS) {
return 6;
} else if (token == WBTC_TOKEN_ADDRESS) {
return 8;
} else if (token == KNC_TOKEN_ADDRESS) {
return 18;
} else {
return 0;
}
}
function minOf(uint256 x, uint256 y) internal pure returns (uint256) {
return x > y ? y : x;
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.7.6;
pragma abicoder v2;
interface ISwap {
struct GetExpectedReturnParams {
uint256 srcAmount;
address[] tradePath;
uint256 feeBps;
bytes extraArgs;
}
function getExpectedReturn(GetExpectedReturnParams calldata params)
external
view
returns (uint256 destAmount);
struct GetExpectedInParams {
uint256 destAmount;
address[] tradePath;
uint256 feeBps;
bytes extraArgs;
}
function getExpectedIn(GetExpectedInParams calldata params)
external
view
returns (uint256 srcAmount);
struct SwapParams {
uint256 srcAmount;
// min return for uni, min conversionrate for kyber, etc.
uint256 minDestAmount;
address[] tradePath;
address recipient;
uint256 feeBps;
address payable feeReceiver;
bytes extraArgs;
}
function swap(SwapParams calldata params) external payable returns (uint256 destAmount);
}// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;
abstract contract PermissionAdmin {
address public admin;
address public pendingAdmin;
event AdminClaimed(address newAdmin, address previousAdmin);
event TransferAdminPending(address pendingAdmin);
constructor(address _admin) {
require(_admin != address(0), "admin 0");
admin = _admin;
}
modifier onlyAdmin() {
require(msg.sender == admin, "only admin");
_;
}
/**
* @dev Allows the current admin to set the pendingAdmin address.
* @param newAdmin The address to transfer ownership to.
*/
function transferAdmin(address newAdmin) public onlyAdmin {
require(newAdmin != address(0), "new admin 0");
emit TransferAdminPending(newAdmin);
pendingAdmin = newAdmin;
}
/**
* @dev Allows the current admin to set the admin in one tx. Useful initial deployment.
* @param newAdmin The address to transfer ownership to.
*/
function transferAdminQuickly(address newAdmin) public onlyAdmin {
require(newAdmin != address(0), "admin 0");
emit TransferAdminPending(newAdmin);
emit AdminClaimed(newAdmin, admin);
admin = newAdmin;
}
/**
* @dev Allows the pendingAdmin address to finalize the change admin process.
*/
function claimAdmin() public {
require(pendingAdmin == msg.sender, "not pending");
emit AdminClaimed(pendingAdmin, admin);
admin = pendingAdmin;
pendingAdmin = address(0);
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @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 `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, 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 `sender` to `recipient` 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 sender, address recipient, uint256 amount) external returns (bool);
/**
* @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);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b > a) return (false, 0);
return (true, a - b);
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a / b);
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a % b);
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) return 0;
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: modulo by zero");
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
return a - b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryDiv}.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a % b;
}
}pragma solidity >=0.6.2;
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}{
"optimizer": {
"enabled": true,
"runs": 780
},
"metadata": {
"bytecodeHash": "none"
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_admin","type":"address"},{"internalType":"contract IUniswapV2Router02[]","name":"routers","type":"address[]"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"}],"name":"AdminClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"sendTo","type":"address"}],"name":"EtherWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IERC20Ext","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"sendTo","type":"address"}],"name":"TokenWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"pendingAdmin","type":"address"}],"name":"TransferAdminPending","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IUniswapV2Router02[]","name":"routers","type":"address[]"},{"indexed":false,"internalType":"bool","name":"isSupported","type":"bool"}],"name":"UpdatedUniRouters","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_oldProxyImpl","type":"address"},{"indexed":true,"internalType":"address","name":"_newProxyImpl","type":"address"}],"name":"UpdatedproxyContract","type":"event"},{"inputs":[],"name":"BPS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getAllUniRouters","outputs":[{"internalType":"address[]","name":"addresses","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"destAmount","type":"uint256"},{"internalType":"address[]","name":"tradePath","type":"address[]"},{"internalType":"uint256","name":"feeBps","type":"uint256"},{"internalType":"bytes","name":"extraArgs","type":"bytes"}],"internalType":"struct ISwap.GetExpectedInParams","name":"params","type":"tuple"}],"name":"getExpectedIn","outputs":[{"internalType":"uint256","name":"srcAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"srcAmount","type":"uint256"},{"internalType":"address[]","name":"tradePath","type":"address[]"},{"internalType":"uint256","name":"feeBps","type":"uint256"},{"internalType":"bytes","name":"extraArgs","type":"bytes"}],"internalType":"struct ISwap.GetExpectedReturnParams","name":"params","type":"tuple"}],"name":"getExpectedReturn","outputs":[{"internalType":"uint256","name":"destAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxyContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"srcAmount","type":"uint256"},{"internalType":"uint256","name":"minDestAmount","type":"uint256"},{"internalType":"address[]","name":"tradePath","type":"address[]"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"feeBps","type":"uint256"},{"internalType":"address payable","name":"feeReceiver","type":"address"},{"internalType":"bytes","name":"extraArgs","type":"bytes"}],"internalType":"struct ISwap.SwapParams","name":"params","type":"tuple"}],"name":"swap","outputs":[{"internalType":"uint256","name":"destAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newAdmin","type":"address"}],"name":"transferAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newAdmin","type":"address"}],"name":"transferAdminQuickly","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_proxyContract","type":"address"}],"name":"updateProxyContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IUniswapV2Router02[]","name":"routers","type":"address[]"},{"internalType":"bool","name":"isSupported","type":"bool"}],"name":"updateUniRouters","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address payable","name":"sendTo","type":"address"}],"name":"withdrawEther","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20Ext","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"sendTo","type":"address"}],"name":"withdrawToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
60806040523480156200001157600080fd5b506040516200248a3803806200248a833981016040819052620000349162000186565b8180806001600160a01b0381166200007d576040805162461bcd60e51b8152602060048201526007602482015266061646d696e20360cc1b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b03929092169190911781559150505b8151811015620000e457620000da828281518110620000bc57fe5b60200260200101516004620000ed60201b6200118b1790919060201c565b50600101620000a1565b50505062000276565b600062000104836001600160a01b0384166200010d565b90505b92915050565b60006200011b83836200015c565b620001535750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000107565b50600062000107565b60009081526001919091016020526040902054151590565b805162000181816200025d565b919050565b6000806040838503121562000199578182fd5b8251620001a6816200025d565b602084810151919350906001600160401b0380821115620001c5578384fd5b818601915086601f830112620001d9578384fd5b815181811115620001e657fe5b838102604051858282010181811085821117156200020057fe5b604052828152858101935084860182860187018b10156200021f578788fd5b8795505b838610156200024c57620002378162000174565b85526001959095019493860193860162000223565b508096505050505050509250929050565b6001600160a01b03811681146200027357600080fd5b50565b61220480620002866000396000f3fe6080604052600436106100ec5760003560e01c806368aa6dd91161008a578063ce56c45411610059578063ce56c45414610251578063d6ba0bfc14610271578063ed55044314610291578063f851a440146102a6576100f3565b806368aa6dd9146101e957806375829def146101fc57806377f50f971461021c5780637acc867814610231576100f3565b80633ccdbb28116100c65780633ccdbb281461016757806343bea4b3146101875780634582d279146101a75780634db1d03d146101c9576100f3565b806313735246146100f8578063249d39e91461011a5780632678224714610145576100f3565b366100f357005b600080fd5b34801561010457600080fd5b50610118610113366004611b51565b6102bb565b005b34801561012657600080fd5b5061012f610392565b60405161013c9190611fd2565b60405180910390f35b34801561015157600080fd5b5061015a610398565b60405161013c9190611dee565b34801561017357600080fd5b50610118610182366004611cbb565b6103a7565b34801561019357600080fd5b5061012f6101a2366004611cf1565b610456565b3480156101b357600080fd5b506101bc61055e565b60405161013c9190611e1c565b3480156101d557600080fd5b5061012f6101e4366004611cf1565b6105f9565b61012f6101f7366004611d2c565b6106db565b34801561020857600080fd5b50610118610217366004611b51565b610c09565b34801561022857600080fd5b50610118610d0e565b34801561023d57600080fd5b5061011861024c366004611b51565b610de0565b34801561025d57600080fd5b5061011861026c366004611d7c565b610f2d565b34801561027d57600080fd5b5061011861028c366004611b89565b611067565b34801561029d57600080fd5b5061015a61116d565b3480156102b257600080fd5b5061015a61117c565b6000546001600160a01b03163314610307576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b6001600160a01b0381166103365760405162461bcd60e51b815260040161032d90611e88565b60405180910390fd5b6003546040516001600160a01b038084169216907f7c5d026310440df4ec67ef47368cd26898f9dbec4b95934dbbc4a3d9d46c49a990600090a3600380546001600160a01b0319166001600160a01b0392909216919091179055565b61271081565b6001546001600160a01b031681565b6000546001600160a01b031633146103f3576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b6104076001600160a01b03841682846111a9565b604080516001600160a01b0380861682526020820185905283168183015290517f72cb8a894ddb372ceec3d2a7648d86f17d5a15caae0e986c53109b8a9a9385e69181900360600190a1505050565b6003546000906001600160a01b031633146104835760405162461bcd60e51b815260040161032d90611f9b565b600061049a61049560608501856120f2565b611215565b905060006001600160a01b03821663d06ca61f85356104bc60208801886120a4565b6040518463ffffffff1660e01b81526004016104da93929190611fdb565b60006040518083038186803b1580156104f257600080fd5b505afa158015610506573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261052e9190810190611c0d565b905080600161054060208701876120a4565b9050038151811061054d57fe5b602002602001015192505050919050565b6060600061056c60046112ca565b90508067ffffffffffffffff8111801561058557600080fd5b506040519080825280602002602001820160405280156105af578160200160208202803683370190505b50915060005b818110156105f4576105c86004826112d5565b8382815181106105d457fe5b6001600160a01b03909216602092830291909101909101526001016105b5565b505090565b6003546000906001600160a01b031633146106265760405162461bcd60e51b815260040161032d90611f9b565b600061063861049560608501856120f2565b905060006001600160a01b038216631f00ca74853561065a60208801886120a4565b6040518463ffffffff1660e01b815260040161067893929190611fdb565b60006040518083038186803b15801561069057600080fd5b505afa1580156106a4573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526106cc9190810190611c0d565b90508060008151811061054d57fe5b6003546000906001600160a01b031633146107085760405162461bcd60e51b815260040161032d90611f9b565b600261071760408401846120a4565b905010156107375760405162461bcd60e51b815260040161032d90611f2d565b600061074961049560c08501856120f2565b90506107818161075c60408601866120a4565b600081811061076757fe5b905060200201602081019061077c9190611b51565b6112e1565b600061079060408501856120a4565b9150600090506107a360408601866120a4565b60008181106107ae57fe5b90506020020160208101906107c39190611b51565b905060006107d460408701876120a4565b600185038181106107e157fe5b90506020020160208101906107f69190611b51565b9050600061080760408801886120a4565b808060200260200160405190810160405280939291908181526020018383602002808284376000920182905250845194955073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee948694509092501515905061085f57fe5b60200260200101516001600160a01b0316141561091557846001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156108af57600080fd5b505afa1580156108c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108e79190611b6d565b816000815181106108f457fe5b60200260200101906001600160a01b031690816001600160a01b0316815250505b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b031681600186038151811061094257fe5b60200260200101516001600160a01b031614156109fa57846001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561099257600080fd5b505afa1580156109a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ca9190611b6d565b8160018603815181106109d957fe5b60200260200101906001600160a01b031690816001600160a01b0316815250505b6000610a1583610a1060808b0160608c01611b51565b6113a8565b90506001600160a01b03841673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415610abc576001600160a01b03861663b6f9de95893560208b013585610a6360808e0160608f01611b51565b6000196040518663ffffffff1660e01b8152600401610a859493929190612033565b6000604051808303818588803b158015610a9e57600080fd5b505af1158015610ab2573d6000803e3d6000fd5b5050505050610bdf565b6001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415610b62576001600160a01b03861663791ac947893560208b013585610b0860808e0160608f01611b51565b6000196040518663ffffffff1660e01b8152600401610b2b959493929190612068565b600060405180830381600087803b158015610b4557600080fd5b505af1158015610b59573d6000803e3d6000fd5b50505050610bdf565b6001600160a01b038616635c11d795893560208b013585610b8960808e0160608f01611b51565b6000196040518663ffffffff1660e01b8152600401610bac959493929190612068565b600060405180830381600087803b158015610bc657600080fd5b505af1158015610bda573d6000803e3d6000fd5b505050505b610bfd81610bf785610a1060808d0160608e01611b51565b90611460565b98975050505050505050565b6000546001600160a01b03163314610c55576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b6001600160a01b038116610cb0576040805162461bcd60e51b815260206004820152600b60248201527f6e65772061646d696e2030000000000000000000000000000000000000000000604482015290519081900360640190fd5b604080516001600160a01b038316815290517f3b81caf78fa51ecbc8acb482fd7012a277b428d9b80f9d156e8a54107496cc409181900360200190a1600180546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b03163314610d6d576040805162461bcd60e51b815260206004820152600b60248201527f6e6f742070656e64696e67000000000000000000000000000000000000000000604482015290519081900360640190fd5b600154600054604080516001600160a01b03938416815292909116602083015280517f65da1cfc2c2e81576ad96afb24a581f8e109b7a403b35cbd3243a1c99efdb9ed9281900390910190a160018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b6000546001600160a01b03163314610e2c576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b6001600160a01b038116610e87576040805162461bcd60e51b815260206004820152600760248201527f61646d696e203000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b604080516001600160a01b038316815290517f3b81caf78fa51ecbc8acb482fd7012a277b428d9b80f9d156e8a54107496cc409181900360200190a1600054604080516001600160a01b038085168252909216602083015280517f65da1cfc2c2e81576ad96afb24a581f8e109b7a403b35cbd3243a1c99efdb9ed9281900390910190a1600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314610f79576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b6040516000906001600160a01b0383169084908381818185875af1925050503d8060008114610fc4576040519150601f19603f3d011682016040523d82523d6000602084013e610fc9565b606091505b505090508061101f576040805162461bcd60e51b815260206004820152600f60248201527f7769746864726177206661696c65640000000000000000000000000000000000604482015290519081900360640190fd5b604080518481526001600160a01b038416602082015281517fec47e7ed86c86774d1a72c19f35c639911393fe7c1a34031fdbd260890da90de929181900390910190a1505050565b6000546001600160a01b031633146110b3576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b60005b8281101561112c5781156110f6576110f08484838181106110d357fe5b90506020020160208101906110e89190611b51565b60049061118b565b50611124565b61112284848381811061110557fe5b905060200201602081019061111a9190611b51565b6004906114bd565b505b6001016110b6565b507f56f34eb6bd4451b93fcc586e59d7ca42dba8fdb9fc157152eb3b4d0cf190b2c283838360405161116093929190611e2f565b60405180910390a1505050565b6003546001600160a01b031681565b6000546001600160a01b031681565b60006111a0836001600160a01b0384166114d2565b90505b92915050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1663a9059cbb60e01b17905261121090849061151c565b505050565b6000601482146112375760405162461bcd60e51b815260040161032d90611f64565b61127b600084848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506115cd9050565b90506001600160a01b0381166112a35760405162461bcd60e51b815260040161032d90611ebf565b6112ae600482611699565b6111a35760405162461bcd60e51b815260040161032d90611ef6565b60006111a3826116ae565b60006111a083836116b2565b6001600160a01b03811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee148015906113895750604051636eb1769f60e11b81526001600160a01b0382169063dd62ed3e906113379030908690600401611e02565b60206040518083038186803b15801561134f57600080fd5b505afa158015611363573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113879190611d64565b155b156113a4576113a46001600160a01b03821683600019611716565b5050565b60006001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156113e057506001600160a01b038116316111a3565b826001600160a01b03166370a08231836040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561142d57600080fd5b505afa158015611441573d6000803e3d6000fd5b505050506040513d602081101561145757600080fd5b505190506111a3565b6000828211156114b7576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60006111a0836001600160a01b03841661183e565b60006114de8383611904565b611514575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556111a3565b5060006111a3565b6000611571826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661191c9092919063ffffffff16565b8051909150156112105780806020019051602081101561159057600080fd5b50516112105760405162461bcd60e51b815260040180806020018281038252602a815260200180612198602a913960400191505060405180910390fd5b600081826014011015611627576040805162461bcd60e51b815260206004820152601260248201527f746f416464726573735f6f766572666c6f770000000000000000000000000000604482015290519081900360640190fd5b8160140183511015611680576040805162461bcd60e51b815260206004820152601560248201527f746f416464726573735f6f75744f66426f756e64730000000000000000000000604482015290519081900360640190fd5b5001602001516c01000000000000000000000000900490565b60006111a0836001600160a01b038416611904565b5490565b815460009082106116f45760405162461bcd60e51b81526004018080602001828103825260228152602001806121506022913960400191505060405180910390fd5b82600001828154811061170357fe5b9060005260206000200154905092915050565b80158061179c575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b15801561176e57600080fd5b505afa158015611782573d6000803e3d6000fd5b505050506040513d602081101561179857600080fd5b5051155b6117d75760405162461bcd60e51b81526004018080602001828103825260368152602001806121c26036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1663095ea7b360e01b17905261121090849061151c565b600081815260018301602052604081205480156118fa578354600019808301919081019060009087908390811061187157fe5b906000526020600020015490508087600001848154811061188e57fe5b6000918252602080832090910192909255828152600189810190925260409020908401905586548790806118be57fe5b600190038181906000526020600020016000905590558660010160008781526020019081526020016000206000905560019450505050506111a3565b60009150506111a3565b60009081526001919091016020526040902054151590565b606061192b8484600085611935565b90505b9392505050565b6060824710156119765760405162461bcd60e51b81526004018080602001828103825260268152602001806121726026913960400191505060405180910390fd5b61197f85611a90565b6119d0576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b60208310611a0e5780518252601f1990920191602091820191016119ef565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114611a70576040519150601f19603f3d011682016040523d82523d6000602084013e611a75565b606091505b5091509150611a85828286611a96565b979650505050505050565b3b151590565b60608315611aa557508161192e565b825115611ab55782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611aff578181015183820152602001611ae7565b50505050905090810190601f168015611b2c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b600060808284031215611b4b578081fd5b50919050565b600060208284031215611b62578081fd5b813561192e81612137565b600060208284031215611b7e578081fd5b815161192e81612137565b600080600060408486031215611b9d578182fd5b833567ffffffffffffffff80821115611bb4578384fd5b818601915086601f830112611bc7578384fd5b813581811115611bd5578485fd5b8760208083028501011115611be8578485fd5b602092830195509350508401358015158114611c02578182fd5b809150509250925092565b60006020808385031215611c1f578182fd5b825167ffffffffffffffff80821115611c36578384fd5b818501915085601f830112611c49578384fd5b815181811115611c5557fe5b83810260405185828201018181108582111715611c6e57fe5b604052828152858101935084860182860187018a1015611c8c578788fd5b8795505b83861015611cae578051855260019590950194938601938601611c90565b5098975050505050505050565b600080600060608486031215611ccf578283fd5b8335611cda81612137565b9250602084013591506040840135611c0281612137565b600060208284031215611d02578081fd5b813567ffffffffffffffff811115611d18578182fd5b611d2484828501611b3a565b949350505050565b600060208284031215611d3d578081fd5b813567ffffffffffffffff811115611d53578182fd5b820160e0818503121561192e578182fd5b600060208284031215611d75578081fd5b5051919050565b60008060408385031215611d8e578182fd5b823591506020830135611da081612137565b809150509250929050565b6000815180845260208085019450808401835b83811015611de35781516001600160a01b031687529582019590820190600101611dbe565b509495945050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6000602082526111a06020830184611dab565b6040808252810183905260008460608301825b86811015611e72578235611e5581612137565b6001600160a01b0316825260209283019290910190600101611e42565b5080925050508215156020830152949350505050565b60208082526011908201527f696e76616c6964207377617020696d706c000000000000000000000000000000604082015260600190565b6020808252600f908201527f696e76616c696420616464726573730000000000000000000000000000000000604082015260600190565b60208082526012908201527f756e737570706f7274656420726f757465720000000000000000000000000000604082015260600190565b60208082526011908201527f696e76616c696420747261646550617468000000000000000000000000000000604082015260600190565b6020808252600c908201527f696e76616c696420617267730000000000000000000000000000000000000000604082015260600190565b6020808252600e908201527f6f6e6c79207377617020696d706c000000000000000000000000000000000000604082015260600190565b90815260200190565b83815260406020808301829052908201839052600090849060608401835b8681101561202757833561200c81612137565b6001600160a01b031682529282019290820190600101611ff9565b50979650505050505050565b60008582526080602083015261204c6080830186611dab565b6001600160a01b03949094166040830152506060015292915050565b600086825285602083015260a0604083015261208760a0830186611dab565b6001600160a01b0394909416606083015250608001529392505050565b6000808335601e198436030181126120ba578283fd5b83018035915067ffffffffffffffff8211156120d4578283fd5b60209081019250810236038213156120eb57600080fd5b9250929050565b6000808335601e19843603018112612108578283fd5b83018035915067ffffffffffffffff821115612122578283fd5b6020019150368190038213156120eb57600080fd5b6001600160a01b038116811461214c57600080fd5b5056fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c5361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a164736f6c6343000706000a000000000000000000000000a3e78ab6f120c730d6f3939c0dc6dcd0e3da7278000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d000000000000000000000000d9e1ce17f2641f24ae83637ab66a2cca9c378b9f
Deployed Bytecode
0x6080604052600436106100ec5760003560e01c806368aa6dd91161008a578063ce56c45411610059578063ce56c45414610251578063d6ba0bfc14610271578063ed55044314610291578063f851a440146102a6576100f3565b806368aa6dd9146101e957806375829def146101fc57806377f50f971461021c5780637acc867814610231576100f3565b80633ccdbb28116100c65780633ccdbb281461016757806343bea4b3146101875780634582d279146101a75780634db1d03d146101c9576100f3565b806313735246146100f8578063249d39e91461011a5780632678224714610145576100f3565b366100f357005b600080fd5b34801561010457600080fd5b50610118610113366004611b51565b6102bb565b005b34801561012657600080fd5b5061012f610392565b60405161013c9190611fd2565b60405180910390f35b34801561015157600080fd5b5061015a610398565b60405161013c9190611dee565b34801561017357600080fd5b50610118610182366004611cbb565b6103a7565b34801561019357600080fd5b5061012f6101a2366004611cf1565b610456565b3480156101b357600080fd5b506101bc61055e565b60405161013c9190611e1c565b3480156101d557600080fd5b5061012f6101e4366004611cf1565b6105f9565b61012f6101f7366004611d2c565b6106db565b34801561020857600080fd5b50610118610217366004611b51565b610c09565b34801561022857600080fd5b50610118610d0e565b34801561023d57600080fd5b5061011861024c366004611b51565b610de0565b34801561025d57600080fd5b5061011861026c366004611d7c565b610f2d565b34801561027d57600080fd5b5061011861028c366004611b89565b611067565b34801561029d57600080fd5b5061015a61116d565b3480156102b257600080fd5b5061015a61117c565b6000546001600160a01b03163314610307576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b6001600160a01b0381166103365760405162461bcd60e51b815260040161032d90611e88565b60405180910390fd5b6003546040516001600160a01b038084169216907f7c5d026310440df4ec67ef47368cd26898f9dbec4b95934dbbc4a3d9d46c49a990600090a3600380546001600160a01b0319166001600160a01b0392909216919091179055565b61271081565b6001546001600160a01b031681565b6000546001600160a01b031633146103f3576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b6104076001600160a01b03841682846111a9565b604080516001600160a01b0380861682526020820185905283168183015290517f72cb8a894ddb372ceec3d2a7648d86f17d5a15caae0e986c53109b8a9a9385e69181900360600190a1505050565b6003546000906001600160a01b031633146104835760405162461bcd60e51b815260040161032d90611f9b565b600061049a61049560608501856120f2565b611215565b905060006001600160a01b03821663d06ca61f85356104bc60208801886120a4565b6040518463ffffffff1660e01b81526004016104da93929190611fdb565b60006040518083038186803b1580156104f257600080fd5b505afa158015610506573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261052e9190810190611c0d565b905080600161054060208701876120a4565b9050038151811061054d57fe5b602002602001015192505050919050565b6060600061056c60046112ca565b90508067ffffffffffffffff8111801561058557600080fd5b506040519080825280602002602001820160405280156105af578160200160208202803683370190505b50915060005b818110156105f4576105c86004826112d5565b8382815181106105d457fe5b6001600160a01b03909216602092830291909101909101526001016105b5565b505090565b6003546000906001600160a01b031633146106265760405162461bcd60e51b815260040161032d90611f9b565b600061063861049560608501856120f2565b905060006001600160a01b038216631f00ca74853561065a60208801886120a4565b6040518463ffffffff1660e01b815260040161067893929190611fdb565b60006040518083038186803b15801561069057600080fd5b505afa1580156106a4573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526106cc9190810190611c0d565b90508060008151811061054d57fe5b6003546000906001600160a01b031633146107085760405162461bcd60e51b815260040161032d90611f9b565b600261071760408401846120a4565b905010156107375760405162461bcd60e51b815260040161032d90611f2d565b600061074961049560c08501856120f2565b90506107818161075c60408601866120a4565b600081811061076757fe5b905060200201602081019061077c9190611b51565b6112e1565b600061079060408501856120a4565b9150600090506107a360408601866120a4565b60008181106107ae57fe5b90506020020160208101906107c39190611b51565b905060006107d460408701876120a4565b600185038181106107e157fe5b90506020020160208101906107f69190611b51565b9050600061080760408801886120a4565b808060200260200160405190810160405280939291908181526020018383602002808284376000920182905250845194955073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee948694509092501515905061085f57fe5b60200260200101516001600160a01b0316141561091557846001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156108af57600080fd5b505afa1580156108c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108e79190611b6d565b816000815181106108f457fe5b60200260200101906001600160a01b031690816001600160a01b0316815250505b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b031681600186038151811061094257fe5b60200260200101516001600160a01b031614156109fa57846001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561099257600080fd5b505afa1580156109a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ca9190611b6d565b8160018603815181106109d957fe5b60200260200101906001600160a01b031690816001600160a01b0316815250505b6000610a1583610a1060808b0160608c01611b51565b6113a8565b90506001600160a01b03841673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415610abc576001600160a01b03861663b6f9de95893560208b013585610a6360808e0160608f01611b51565b6000196040518663ffffffff1660e01b8152600401610a859493929190612033565b6000604051808303818588803b158015610a9e57600080fd5b505af1158015610ab2573d6000803e3d6000fd5b5050505050610bdf565b6001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415610b62576001600160a01b03861663791ac947893560208b013585610b0860808e0160608f01611b51565b6000196040518663ffffffff1660e01b8152600401610b2b959493929190612068565b600060405180830381600087803b158015610b4557600080fd5b505af1158015610b59573d6000803e3d6000fd5b50505050610bdf565b6001600160a01b038616635c11d795893560208b013585610b8960808e0160608f01611b51565b6000196040518663ffffffff1660e01b8152600401610bac959493929190612068565b600060405180830381600087803b158015610bc657600080fd5b505af1158015610bda573d6000803e3d6000fd5b505050505b610bfd81610bf785610a1060808d0160608e01611b51565b90611460565b98975050505050505050565b6000546001600160a01b03163314610c55576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b6001600160a01b038116610cb0576040805162461bcd60e51b815260206004820152600b60248201527f6e65772061646d696e2030000000000000000000000000000000000000000000604482015290519081900360640190fd5b604080516001600160a01b038316815290517f3b81caf78fa51ecbc8acb482fd7012a277b428d9b80f9d156e8a54107496cc409181900360200190a1600180546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b03163314610d6d576040805162461bcd60e51b815260206004820152600b60248201527f6e6f742070656e64696e67000000000000000000000000000000000000000000604482015290519081900360640190fd5b600154600054604080516001600160a01b03938416815292909116602083015280517f65da1cfc2c2e81576ad96afb24a581f8e109b7a403b35cbd3243a1c99efdb9ed9281900390910190a160018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b6000546001600160a01b03163314610e2c576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b6001600160a01b038116610e87576040805162461bcd60e51b815260206004820152600760248201527f61646d696e203000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b604080516001600160a01b038316815290517f3b81caf78fa51ecbc8acb482fd7012a277b428d9b80f9d156e8a54107496cc409181900360200190a1600054604080516001600160a01b038085168252909216602083015280517f65da1cfc2c2e81576ad96afb24a581f8e109b7a403b35cbd3243a1c99efdb9ed9281900390910190a1600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314610f79576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b6040516000906001600160a01b0383169084908381818185875af1925050503d8060008114610fc4576040519150601f19603f3d011682016040523d82523d6000602084013e610fc9565b606091505b505090508061101f576040805162461bcd60e51b815260206004820152600f60248201527f7769746864726177206661696c65640000000000000000000000000000000000604482015290519081900360640190fd5b604080518481526001600160a01b038416602082015281517fec47e7ed86c86774d1a72c19f35c639911393fe7c1a34031fdbd260890da90de929181900390910190a1505050565b6000546001600160a01b031633146110b3576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b60005b8281101561112c5781156110f6576110f08484838181106110d357fe5b90506020020160208101906110e89190611b51565b60049061118b565b50611124565b61112284848381811061110557fe5b905060200201602081019061111a9190611b51565b6004906114bd565b505b6001016110b6565b507f56f34eb6bd4451b93fcc586e59d7ca42dba8fdb9fc157152eb3b4d0cf190b2c283838360405161116093929190611e2f565b60405180910390a1505050565b6003546001600160a01b031681565b6000546001600160a01b031681565b60006111a0836001600160a01b0384166114d2565b90505b92915050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1663a9059cbb60e01b17905261121090849061151c565b505050565b6000601482146112375760405162461bcd60e51b815260040161032d90611f64565b61127b600084848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092939250506115cd9050565b90506001600160a01b0381166112a35760405162461bcd60e51b815260040161032d90611ebf565b6112ae600482611699565b6111a35760405162461bcd60e51b815260040161032d90611ef6565b60006111a3826116ae565b60006111a083836116b2565b6001600160a01b03811673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee148015906113895750604051636eb1769f60e11b81526001600160a01b0382169063dd62ed3e906113379030908690600401611e02565b60206040518083038186803b15801561134f57600080fd5b505afa158015611363573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113879190611d64565b155b156113a4576113a46001600160a01b03821683600019611716565b5050565b60006001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156113e057506001600160a01b038116316111a3565b826001600160a01b03166370a08231836040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561142d57600080fd5b505afa158015611441573d6000803e3d6000fd5b505050506040513d602081101561145757600080fd5b505190506111a3565b6000828211156114b7576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60006111a0836001600160a01b03841661183e565b60006114de8383611904565b611514575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556111a3565b5060006111a3565b6000611571826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661191c9092919063ffffffff16565b8051909150156112105780806020019051602081101561159057600080fd5b50516112105760405162461bcd60e51b815260040180806020018281038252602a815260200180612198602a913960400191505060405180910390fd5b600081826014011015611627576040805162461bcd60e51b815260206004820152601260248201527f746f416464726573735f6f766572666c6f770000000000000000000000000000604482015290519081900360640190fd5b8160140183511015611680576040805162461bcd60e51b815260206004820152601560248201527f746f416464726573735f6f75744f66426f756e64730000000000000000000000604482015290519081900360640190fd5b5001602001516c01000000000000000000000000900490565b60006111a0836001600160a01b038416611904565b5490565b815460009082106116f45760405162461bcd60e51b81526004018080602001828103825260228152602001806121506022913960400191505060405180910390fd5b82600001828154811061170357fe5b9060005260206000200154905092915050565b80158061179c575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b15801561176e57600080fd5b505afa158015611782573d6000803e3d6000fd5b505050506040513d602081101561179857600080fd5b5051155b6117d75760405162461bcd60e51b81526004018080602001828103825260368152602001806121c26036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1663095ea7b360e01b17905261121090849061151c565b600081815260018301602052604081205480156118fa578354600019808301919081019060009087908390811061187157fe5b906000526020600020015490508087600001848154811061188e57fe5b6000918252602080832090910192909255828152600189810190925260409020908401905586548790806118be57fe5b600190038181906000526020600020016000905590558660010160008781526020019081526020016000206000905560019450505050506111a3565b60009150506111a3565b60009081526001919091016020526040902054151590565b606061192b8484600085611935565b90505b9392505050565b6060824710156119765760405162461bcd60e51b81526004018080602001828103825260268152602001806121726026913960400191505060405180910390fd5b61197f85611a90565b6119d0576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b60208310611a0e5780518252601f1990920191602091820191016119ef565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114611a70576040519150601f19603f3d011682016040523d82523d6000602084013e611a75565b606091505b5091509150611a85828286611a96565b979650505050505050565b3b151590565b60608315611aa557508161192e565b825115611ab55782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611aff578181015183820152602001611ae7565b50505050905090810190601f168015611b2c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b600060808284031215611b4b578081fd5b50919050565b600060208284031215611b62578081fd5b813561192e81612137565b600060208284031215611b7e578081fd5b815161192e81612137565b600080600060408486031215611b9d578182fd5b833567ffffffffffffffff80821115611bb4578384fd5b818601915086601f830112611bc7578384fd5b813581811115611bd5578485fd5b8760208083028501011115611be8578485fd5b602092830195509350508401358015158114611c02578182fd5b809150509250925092565b60006020808385031215611c1f578182fd5b825167ffffffffffffffff80821115611c36578384fd5b818501915085601f830112611c49578384fd5b815181811115611c5557fe5b83810260405185828201018181108582111715611c6e57fe5b604052828152858101935084860182860187018a1015611c8c578788fd5b8795505b83861015611cae578051855260019590950194938601938601611c90565b5098975050505050505050565b600080600060608486031215611ccf578283fd5b8335611cda81612137565b9250602084013591506040840135611c0281612137565b600060208284031215611d02578081fd5b813567ffffffffffffffff811115611d18578182fd5b611d2484828501611b3a565b949350505050565b600060208284031215611d3d578081fd5b813567ffffffffffffffff811115611d53578182fd5b820160e0818503121561192e578182fd5b600060208284031215611d75578081fd5b5051919050565b60008060408385031215611d8e578182fd5b823591506020830135611da081612137565b809150509250929050565b6000815180845260208085019450808401835b83811015611de35781516001600160a01b031687529582019590820190600101611dbe565b509495945050505050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6000602082526111a06020830184611dab565b6040808252810183905260008460608301825b86811015611e72578235611e5581612137565b6001600160a01b0316825260209283019290910190600101611e42565b5080925050508215156020830152949350505050565b60208082526011908201527f696e76616c6964207377617020696d706c000000000000000000000000000000604082015260600190565b6020808252600f908201527f696e76616c696420616464726573730000000000000000000000000000000000604082015260600190565b60208082526012908201527f756e737570706f7274656420726f757465720000000000000000000000000000604082015260600190565b60208082526011908201527f696e76616c696420747261646550617468000000000000000000000000000000604082015260600190565b6020808252600c908201527f696e76616c696420617267730000000000000000000000000000000000000000604082015260600190565b6020808252600e908201527f6f6e6c79207377617020696d706c000000000000000000000000000000000000604082015260600190565b90815260200190565b83815260406020808301829052908201839052600090849060608401835b8681101561202757833561200c81612137565b6001600160a01b031682529282019290820190600101611ff9565b50979650505050505050565b60008582526080602083015261204c6080830186611dab565b6001600160a01b03949094166040830152506060015292915050565b600086825285602083015260a0604083015261208760a0830186611dab565b6001600160a01b0394909416606083015250608001529392505050565b6000808335601e198436030181126120ba578283fd5b83018035915067ffffffffffffffff8211156120d4578283fd5b60209081019250810236038213156120eb57600080fd5b9250929050565b6000808335601e19843603018112612108578283fd5b83018035915067ffffffffffffffff821115612122578283fd5b6020019150368190038213156120eb57600080fd5b6001600160a01b038116811461214c57600080fd5b5056fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c5361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a164736f6c6343000706000a
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000a3e78ab6f120c730d6f3939c0dc6dcd0e3da7278000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d000000000000000000000000d9e1ce17f2641f24ae83637ab66a2cca9c378b9f
-----Decoded View---------------
Arg [0] : _admin (address): 0xa3e78aB6f120C730D6F3939c0Dc6dcD0E3da7278
Arg [1] : routers (address[]): 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D,0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F
-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 000000000000000000000000a3e78ab6f120c730d6f3939c0dc6dcd0e3da7278
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000040
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [3] : 0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d
Arg [4] : 000000000000000000000000d9e1ce17f2641f24ae83637ab66a2cca9c378b9f
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 32 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.