Feature Tip: Add private address tag to any address under My Name Tag !
Overview
ETH Balance
0 ETH
Eth Value
$0.00| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
Swapper
Compiler Version
v0.8.12+commit.f00d7308
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0
/*
* █
***** ▓▓▓
* ▓▓▓▓▓▓▓
* ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓
***** //////// ▓▓▓▓▓▓▓
* ///////////// ▓▓▓
▓▓ ////////////////// █ ▓▓
▓▓ ▓▓ /////////////////////// ▓▓ ▓▓
▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓
▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓
▓▓ ,////////////////////////////////////// ▓▓ ▓▓
▓▓ ////////////////////////////////////////// ▓▓
▓▓ //////////////////////▓▓▓▓/////////////////////
,////////////////////////////////////////////////////
.//////////////////////////////////////////////////////////
.//////////////////////////██.,//////////////////////////█
.//////////////////////████..,./////////////////////██
...////////////////███████.....,.////////////////███
,.,////////////████████ ........,///////////████
.,.,//////█████████ ,.......///////████
,..//████████ ........./████
..,██████ .....,███
.██ ,.,█
▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓
▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓
▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓
▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓
*/
pragma solidity ^0.8.12;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../interfaces/IAngleRouterSidechain.sol";
import "../interfaces/ICoreBorrow.sol";
import "../interfaces/ISwapper.sol";
import "../interfaces/external/lido/IWStETH.sol";
import "../interfaces/external/uniswap/IUniswapRouter.sol";
// ==================================== ENUM ===================================
/// @notice All possible swaps
enum SwapType {
UniswapV3,
oneInch,
AngleRouter,
Leverage,
None
}
/// @title Swapper
/// @author Angle Labs, Inc.
/// @notice Swapper contract facilitating interactions with Angle VaultManager contracts, notably
/// liquidation and leverage transactions
contract Swapper is ISwapper {
using SafeERC20 for IERC20;
// ===================== CONSTANTS AND IMMUTABLE VARIABLES =====================
/// @notice Reference to the `CoreBorrow` contract of the module which handles all AccessControl logic
ICoreBorrow public immutable core;
/// @notice Uniswap Router contract
IUniswapV3Router public immutable uniV3Router;
/// @notice 1inch Router
address public immutable oneInch;
/// @notice AngleRouter
IAngleRouterSidechain public immutable angleRouter;
// =================================== ERRORS ==================================
error EmptyReturnMessage();
error IncompatibleLengths();
error NotGovernorOrGuardian();
error TooSmallAmountOut();
error ZeroAddress();
/// @notice Constructor of the contract
/// @param _core Core address
/// @param _uniV3Router UniswapV3 Router address
/// @param _oneInch 1inch Router address
/// @param _angleRouter AngleRouter contract address
constructor(
ICoreBorrow _core,
IUniswapV3Router _uniV3Router,
address _oneInch,
IAngleRouterSidechain _angleRouter
) {
if (address(_core) == address(0) || _oneInch == address(0) || address(_angleRouter) == address(0))
revert ZeroAddress();
core = _core;
uniV3Router = _uniV3Router;
oneInch = _oneInch;
angleRouter = _angleRouter;
}
// ========================= EXTERNAL ACCESS FUNCTIONS =========================
/// @inheritdoc ISwapper
/// @dev This function swaps the `inToken` to the `outToken` by doing a UniV3 swap, a 1inch swap or by interacting
/// with the `AngleRouter` contract
/// @dev One slippage check is performed at the end of the call
/// @dev In this implementation, the function tries to make sure that the `outTokenRecipient` address has at the end
/// of the call `outTokenOwed`, leftover tokens are sent to a `to` address which by default is the `outTokenRecipient`
function swap(
IERC20 inToken,
IERC20 outToken,
address outTokenRecipient,
uint256 outTokenOwed,
uint256 inTokenObtained,
bytes memory data
) external {
// Address to receive the surplus amount of token at the end of the call
address to;
// For slippage protection, it is checked at the end of the call
uint256 minAmountOut;
// Type of the swap to execute: if `swapType == 4`, then it is optional to swap
uint256 swapType;
// We're reusing the `data` variable (it can be `path` on UniswapV3, a payload for 1inch or like encoded actions
// for a router call)
(to, minAmountOut, swapType, data) = abi.decode(data, (address, uint256, uint256, bytes));
to = (to == address(0)) ? outTokenRecipient : to;
_swap(inToken, inTokenObtained, SwapType(swapType), data);
// A final slippage check is performed after the swaps
uint256 outTokenBalance = outToken.balanceOf(address(this));
if (outTokenBalance < minAmountOut) revert TooSmallAmountOut();
// The `outTokenRecipient` may already have enough in balance, in which case there's no need to transfer
// to this address the token and everything can be given to the `to` address
uint256 outTokenBalanceRecipient = outToken.balanceOf(outTokenRecipient);
if (outTokenBalanceRecipient >= outTokenOwed || to == outTokenRecipient)
outToken.safeTransfer(to, outTokenBalance);
else {
// The `outTokenRecipient` should receive the delta to make sure its end balance is equal to `outTokenOwed`
// Any leftover in this case is sent to the `to` address
// The function reverts if it did not obtain more than `outTokenOwed - outTokenBalanceRecipient` from the swap
outToken.safeTransfer(outTokenRecipient, outTokenOwed - outTokenBalanceRecipient);
outToken.safeTransfer(to, outTokenBalanceRecipient + outTokenBalance - outTokenOwed);
}
// Reusing the `inTokenObtained` variable for the `inToken` balance
// Sending back the remaining amount of inTokens to the `to` address: it is possible that not the full `inTokenObtained`
// is swapped to `outToken` if we're using the `1inch` payload
inTokenObtained = inToken.balanceOf(address(this));
if (inTokenObtained != 0) inToken.safeTransfer(to, inTokenObtained);
}
// ============================ GOVERNANCE FUNCTION ============================
/// @notice Changes allowances of this contract for different tokens
/// @param tokens Addresses of the tokens to allow
/// @param spenders Addresses to allow transfer
/// @param amounts Amounts to allow
function changeAllowance(
IERC20[] calldata tokens,
address[] calldata spenders,
uint256[] calldata amounts
) external {
if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();
uint256 tokensLength = tokens.length;
if (tokensLength != spenders.length || tokensLength != amounts.length) revert IncompatibleLengths();
for (uint256 i; i < tokensLength; ++i) {
_changeAllowance(tokens[i], spenders[i], amounts[i]);
}
}
// ========================= INTERNAL UTILITY FUNCTIONS ========================
/// @notice Internal version of the `_changeAllowance` function
function _changeAllowance(
IERC20 token,
address spender,
uint256 amount
) internal {
uint256 currentAllowance = token.allowance(address(this), spender);
if (currentAllowance < amount) {
token.safeIncreaseAllowance(spender, amount - currentAllowance);
} else if (currentAllowance > amount) {
token.safeDecreaseAllowance(spender, currentAllowance - amount);
}
}
/// @notice Checks the allowance for a contract and updates it to the max if it is not big enough
/// @param token Token for which allowance should be checked
/// @param spender Address to grant allowance to
/// @param amount Minimum amount of tokens needed for the allowance
function _checkAllowance(
IERC20 token,
address spender,
uint256 amount
) internal {
uint256 currentAllowance = token.allowance(address(this), spender);
if (currentAllowance < amount) token.safeIncreaseAllowance(spender, type(uint256).max - currentAllowance);
}
/// @notice Performs a swap using either Uniswap, 1inch. This function can also stake stETH to wstETH
/// @param inToken Token to swap
/// @param amount Amount of tokens to swap
/// @param swapType Type of the swap to perform
/// @param args Extra args for the swap: in the case of Uniswap it should be a path, for 1inch it should be
/// a payload
/// @dev This function does nothing if `swapType` is None and it simply passes on the `amount` it received
/// @dev No slippage is specified in the actions given here as a final slippage check is performed
/// after the call to this function
function _swap(
IERC20 inToken,
uint256 amount,
SwapType swapType,
bytes memory args
) internal {
if (swapType == SwapType.UniswapV3) _swapOnUniswapV3(inToken, amount, args);
else if (swapType == SwapType.oneInch) _swapOn1inch(inToken, args);
else if (swapType == SwapType.AngleRouter) _angleRouterActions(inToken, args);
else if (swapType == SwapType.Leverage) _swapLeverage(args);
}
/// @notice Performs a UniswapV3 swap
/// @param inToken Token to swap
/// @param amount Amount of tokens to swap
/// @param path Path for the UniswapV3 swap: this encodes the out token that is going to be obtained
/// @dev This function does not check the out token obtained here: if it is wrongly specified, either
/// the `swap` function could fail or these tokens could stay on the contract
function _swapOnUniswapV3(
IERC20 inToken,
uint256 amount,
bytes memory path
) internal returns (uint256 amountOut) {
// We need more than `amount` of allowance to the contract
_checkAllowance(inToken, address(uniV3Router), amount);
amountOut = uniV3Router.exactInput(ExactInputParams(path, address(this), block.timestamp, amount, 0));
}
/// @notice Allows to swap any token to an accepted collateral via 1inch API
/// @param inToken Token received for the 1inch swap
/// @param payload Bytes needed for 1inch API
function _swapOn1inch(IERC20 inToken, bytes memory payload) internal returns (uint256 amountOut) {
_changeAllowance(inToken, oneInch, type(uint256).max);
//solhint-disable-next-line
(bool success, bytes memory result) = oneInch.call(payload);
if (!success) _revertBytes(result);
amountOut = abi.decode(result, (uint256));
}
/// @notice Performs actions with the router contract of the protocol on the corresponding chain
/// @param inToken Token concerned by the action and for which
function _angleRouterActions(IERC20 inToken, bytes memory args) internal {
(ActionType[] memory actions, bytes[] memory actionData) = abi.decode(args, (ActionType[], bytes[]));
_changeAllowance(inToken, address(angleRouter), type(uint256).max);
PermitType[] memory permits;
angleRouter.mixer(permits, actions, actionData);
}
/// @notice Allows to take leverage or deleverage via a specific contract
/// @param payload Bytes needed for 1inch API
/// @dev This function is to be implemented if the swapper concerns a token that requires some actions
/// not supported by 1inch or UniV3
function _swapLeverage(bytes memory payload) internal virtual returns (uint256 amountOut) {}
/// @notice Internal function used for error handling
/// @param errMsg Error message received
function _revertBytes(bytes memory errMsg) internal pure {
if (errMsg.length != 0) {
//solhint-disable-next-line
assembly {
revert(add(32, errMsg), mload(errMsg))
}
}
revert EmptyReturnMessage();
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return 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");
(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");
(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");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.12;
/// @notice Action types
enum ActionType {
transfer,
wrap,
wrapNative,
sweep,
sweepNative,
unwrap,
unwrapNative,
swapIn,
swapOut,
uniswapV3,
oneInch,
claimRewards,
gaugeDeposit,
borrower
}
/// @notice Data needed to get permits
struct PermitType {
address token;
address owner;
uint256 value;
uint256 deadline;
uint8 v;
bytes32 r;
bytes32 s;
}
/// @title IAngleRouterSidechain
/// @author Angle Labs, Inc.
/// @notice Interface for the `AngleRouter` contract on other chains
interface IAngleRouterSidechain {
function mixer(
PermitType[] memory paramsPermit,
ActionType[] memory actions,
bytes[] calldata data
) external;
}// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.12;
/// @title ICoreBorrow
/// @author Angle Labs, Inc.
/// @notice Interface for the `CoreBorrow` contract
/// @dev This interface only contains functions of the `CoreBorrow` contract which are called by other contracts
/// of this module
interface ICoreBorrow {
/// @notice Checks if an address corresponds to a treasury of a stablecoin with a flash loan
/// module initialized on it
/// @param treasury Address to check
/// @return Whether the address has the `FLASHLOANER_TREASURY_ROLE` or not
function isFlashLoanerTreasury(address treasury) external view returns (bool);
/// @notice Checks whether an address is governor of the Angle Protocol or not
/// @param admin Address to check
/// @return Whether the address has the `GOVERNOR_ROLE` or not
function isGovernor(address admin) external view returns (bool);
/// @notice Checks whether an address is governor or a guardian of the Angle Protocol or not
/// @param admin Address to check
/// @return Whether the address has the `GUARDIAN_ROLE` or not
/// @dev Governance should make sure when adding a governor to also give this governor the guardian
/// role by calling the `addGovernor` function
function isGovernorOrGuardian(address admin) external view returns (bool);
}// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.12;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/// @title ISwapper
/// @author Angle Labs, Inc.
/// @notice Interface for Swapper contracts
/// @dev This interface defines the key functions `Swapper` contracts should have when interacting with
/// Angle
interface ISwapper {
/// @notice Notifies a contract that an address should be given `outToken` from `inToken`
/// @param inToken Address of the token received
/// @param outToken Address of the token to obtain
/// @param outTokenRecipient Address to which the outToken should be sent
/// @param outTokenOwed Minimum amount of outToken the `outTokenRecipient` address should have at the end of the call
/// @param inTokenObtained Amount of collateral obtained by a related address prior
/// to the call to this function
/// @param data Extra data needed (to encode Uniswap swaps for instance)
function swap(
IERC20 inToken,
IERC20 outToken,
address outTokenRecipient,
uint256 outTokenOwed,
uint256 inTokenObtained,
bytes calldata data
) external;
}// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.12;
/// @title IWStETH
/// @author Angle Labs, Inc.
/// @notice Interface for the `WStETH` contract
/// @dev This interface only contains functions of the `WStETH` which are called by other contracts
/// of this module
interface IWStETH {
function wrap(uint256 _stETHAmount) external returns (uint256);
function stETH() external view returns (address);
}// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.12;
struct ExactInputParams {
bytes path;
address recipient;
uint256 deadline;
uint256 amountIn;
uint256 amountOutMinimum;
}
/// @title Router token swapping functionality
/// @notice Functions for swapping tokens via Uniswap V3
interface IUniswapV3Router {
/// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path
/// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata
/// @return amountOut The amount of the received token
function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);
}
/// @title Router for price estimation functionality
/// @notice Functions for getting the price of one token with respect to another using Uniswap V2
/// @dev This interface is only used for non critical elements of the protocol
interface IUniswapV2Router {
/// @notice Given an input asset amount, returns the maximum output amount of the
/// other asset (accounting for fees) given reserves.
/// @param path Addresses of the pools used to get prices
function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts);
function swapExactTokensForTokens(
uint256 swapAmount,
uint256 minExpected,
address[] calldata path,
address receiver,
uint256 swapDeadline
) external;
}{
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs",
"useLiteralContent": true
},
"optimizer": {
"enabled": true,
"runs": 1000000
},
"remappings": [],
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"contract ICoreBorrow","name":"_core","type":"address"},{"internalType":"contract IUniswapV3Router","name":"_uniV3Router","type":"address"},{"internalType":"address","name":"_oneInch","type":"address"},{"internalType":"contract IAngleRouterSidechain","name":"_angleRouter","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"EmptyReturnMessage","type":"error"},{"inputs":[],"name":"IncompatibleLengths","type":"error"},{"inputs":[],"name":"NotGovernorOrGuardian","type":"error"},{"inputs":[],"name":"TooSmallAmountOut","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"inputs":[],"name":"angleRouter","outputs":[{"internalType":"contract IAngleRouterSidechain","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20[]","name":"tokens","type":"address[]"},{"internalType":"address[]","name":"spenders","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"changeAllowance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"core","outputs":[{"internalType":"contract ICoreBorrow","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oneInch","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"inToken","type":"address"},{"internalType":"contract IERC20","name":"outToken","type":"address"},{"internalType":"address","name":"outTokenRecipient","type":"address"},{"internalType":"uint256","name":"outTokenOwed","type":"uint256"},{"internalType":"uint256","name":"inTokenObtained","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"swap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"uniV3Router","outputs":[{"internalType":"contract IUniswapV3Router","name":"","type":"address"}],"stateMutability":"view","type":"function"}]Contract Creation Code
6101006040523480156200001257600080fd5b5060405162001d2f38038062001d2f8339810160408190526200003591620000c1565b6001600160a01b03841615806200005357506001600160a01b038216155b806200006657506001600160a01b038116155b15620000855760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b0393841660805291831660a052821660c0521660e05262000129565b6001600160a01b0381168114620000be57600080fd5b50565b60008060008060808587031215620000d857600080fd5b8451620000e581620000a8565b6020860151909450620000f881620000a8565b60408601519093506200010b81620000a8565b60608601519092506200011e81620000a8565b939692955090935050565b60805160a05160c05160e051611b9e620001916000396000818160cc01528181610b090152610b8e015260008181607c015281816109e90152610a3301526000818160f3015281816108db015261096201526000818161014201526104c80152611b9e6000f3fe608060405234801561001057600080fd5b50600436106100725760003560e01c8063a5d4096b11610050578063a5d4096b14610115578063b82c4dc11461012a578063f2f4eb261461013d57600080fd5b8063045c08d5146100775780630b6942c2146100c75780635fafa589146100ee575b600080fd5b61009e7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b61009e7f000000000000000000000000000000000000000000000000000000000000000081565b61009e7f000000000000000000000000000000000000000000000000000000000000000081565b610128610123366004611390565b610164565b005b6101286101383660046114a6565b61049a565b61009e7f000000000000000000000000000000000000000000000000000000000000000081565b60008060008380602001905181019061017d91906115b1565b96509194509250905073ffffffffffffffffffffffffffffffffffffffff8316156101a857826101aa565b865b92506101c989868360048111156101c3576101c3611616565b87610659565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8a16906370a0823190602401602060405180830381865afa158015610236573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061025a9190611645565b905082811015610296576040517fa1aabbe100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8981166004830152600091908b16906370a0823190602401602060405180830381865afa158015610306573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061032a9190611645565b9050878110158061036657508873ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16145b156103915761038c73ffffffffffffffffffffffffffffffffffffffff8b1686846106f6565b6103d6565b6103bd8961039f838b61168d565b73ffffffffffffffffffffffffffffffffffffffff8d1691906106f6565b6103d685896103cc85856116a4565b61039f919061168d565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8c16906370a0823190602401602060405180830381865afa158015610440573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104649190611645565b9650861561048d5761048d73ffffffffffffffffffffffffffffffffffffffff8c1686896106f6565b5050505050505050505050565b6040517f521d4de90000000000000000000000000000000000000000000000000000000081523360048201527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff169063521d4de990602401602060405180830381865afa158015610524573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054891906116bc565b61057e576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b84838114158061058e5750808214155b156105c5576040517f46282e8d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b8181101561064f5761063f8888838181106105e5576105e56116de565b90506020020160208101906105fa919061170d565b87878481811061060c5761060c6116de565b9050602002016020810190610621919061170d565b868685818110610633576106336116de565b905060200201356107cf565b6106488161172a565b90506105c8565b5050505050505050565b600082600481111561066d5761066d611616565b14156106845761067e8484836108d3565b506106f0565b600182600481111561069857610698611616565b14156106a85761067e84826109e1565b60028260048111156106bc576106bc611616565b14156106d1576106cc8482610ae8565b6106f0565b60038260048111156106e5576106e5611616565b14156106f05760005b505b50505050565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526107ca9084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152610c00565b505050565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015610845573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108699190611645565b90508181101561089f576106cc83610881838561168d565b73ffffffffffffffffffffffffffffffffffffffff87169190610d11565b818111156106f0576106f0836108b5848461168d565b73ffffffffffffffffffffffffffffffffffffffff87169190610e0f565b6000610900847f000000000000000000000000000000000000000000000000000000000000000085610f95565b6040805160a0810182528381523060208201524281830152606081018590526000608082015290517fc04b8d5900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169163c04b8d599161099691906004016117ad565b6020604051808303816000875af11580156109b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109d99190611645565b949350505050565b6000610a2e837f00000000000000000000000000000000000000000000000000000000000000007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6107cf565b6000807f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1684604051610a769190611813565b6000604051808303816000865af19150503d8060008114610ab3576040519150601f19603f3d011682016040523d82523d6000602084013e610ab8565b606091505b509150915081610acb57610acb81611067565b80806020019051810190610adf9190611645565b95945050505050565b60008082806020019051810190610aff91906118de565b91509150610b4e847f00000000000000000000000000000000000000000000000000000000000000007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6107cf565b6040517f848c48da00000000000000000000000000000000000000000000000000000000815260609073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063848c48da90610bc790849087908790600401611a90565b600060405180830381600087803b158015610be157600080fd5b505af1158015610bf5573d6000803e3d6000fd5b505050505050505050565b6000610c62826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166110a89092919063ffffffff16565b8051909150156107ca5780806020019051810190610c8091906116bc565b6107ca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610d88573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dac9190611645565b610db691906116a4565b60405173ffffffffffffffffffffffffffffffffffffffff85166024820152604481018290529091506106f09085907f095ea7b30000000000000000000000000000000000000000000000000000000090606401610748565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015610e85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea99190611645565b905081811015610f3b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f5361666545524332303a2064656372656173656420616c6c6f77616e6365206260448201527f656c6f77207a65726f00000000000000000000000000000000000000000000006064820152608401610d08565b60405173ffffffffffffffffffffffffffffffffffffffff8416602482015282820360448201819052906106ee9086907f095ea7b30000000000000000000000000000000000000000000000000000000090606401610748565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa15801561100b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102f9190611645565b9050818110156106f0576106f083610881837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61168d565b80511561107657805181602001fd5b6040517f6a8df6a800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60606109d984846000856110be565b9392505050565b606082471015611150576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610d08565b73ffffffffffffffffffffffffffffffffffffffff85163b6111ce576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610d08565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516111f79190611813565b60006040518083038185875af1925050503d8060008114611234576040519150601f19603f3d011682016040523d82523d6000602084013e611239565b606091505b5091509150611249828286611254565b979650505050505050565b606083156112635750816110b7565b8251156112735782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d089190611b55565b73ffffffffffffffffffffffffffffffffffffffff811681146112c957600080fd5b50565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715611342576113426112cc565b604052919050565b600067ffffffffffffffff821115611364576113646112cc565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b60008060008060008060c087890312156113a957600080fd5b86356113b4816112a7565b955060208701356113c4816112a7565b945060408701356113d4816112a7565b9350606087013592506080870135915060a087013567ffffffffffffffff8111156113fe57600080fd5b8701601f8101891361140f57600080fd5b803561142261141d8261134a565b6112fb565b8181528a602083850101111561143757600080fd5b816020840160208301376000602083830101528093505050509295509295509295565b60008083601f84011261146c57600080fd5b50813567ffffffffffffffff81111561148457600080fd5b6020830191508360208260051b850101111561149f57600080fd5b9250929050565b600080600080600080606087890312156114bf57600080fd5b863567ffffffffffffffff808211156114d757600080fd5b6114e38a838b0161145a565b909850965060208901359150808211156114fc57600080fd5b6115088a838b0161145a565b9096509450604089013591508082111561152157600080fd5b5061152e89828a0161145a565b979a9699509497509295939492505050565b60005b8381101561155b578181015183820152602001611543565b838111156106f05750506000910152565b600082601f83011261157d57600080fd5b815161158b61141d8261134a565b8181528460208386010111156115a057600080fd5b6109d9826020830160208701611540565b600080600080608085870312156115c757600080fd5b84516115d2816112a7565b809450506020850151925060408501519150606085015167ffffffffffffffff8111156115fe57600080fd5b61160a8782880161156c565b91505092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60006020828403121561165757600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008282101561169f5761169f61165e565b500390565b600082198211156116b7576116b761165e565b500190565b6000602082840312156116ce57600080fd5b815180151581146110b757600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561171f57600080fd5b81356110b7816112a7565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561175c5761175c61165e565b5060010190565b6000815180845261177b816020860160208601611540565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b602081526000825160a060208401526117c960c0840182611763565b905073ffffffffffffffffffffffffffffffffffffffff60208501511660408401526040840151606084015260608401516080840152608084015160a08401528091505092915050565b60008251611825818460208701611540565b9190910192915050565b600067ffffffffffffffff821115611849576118496112cc565b5060051b60200190565b600082601f83011261186457600080fd5b8151602061187461141d8361182f565b82815260059290921b8401810191818101908684111561189357600080fd5b8286015b848110156118d357805167ffffffffffffffff8111156118b75760008081fd5b6118c58986838b010161156c565b845250918301918301611897565b509695505050505050565b600080604083850312156118f157600080fd5b825167ffffffffffffffff8082111561190957600080fd5b818501915085601f83011261191d57600080fd5b8151602061192d61141d8361182f565b82815260059290921b8401810191818101908984111561194c57600080fd5b948201945b83861015611978578551600e81106119695760008081fd5b82529482019490820190611951565b9188015191965090935050508082111561199157600080fd5b5061199e85828601611853565b9150509250929050565b60008151808452602080850194508084016000805b84811015611a0e578251600e81106119fc577f4e487b710000000000000000000000000000000000000000000000000000000083526021600452602483fd5b885296830196918301916001016119bd565b50959695505050505050565b600082825180855260208086019550808260051b84010181860160005b84811015611a83577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0868403018952611a71838351611763565b98840198925090830190600101611a37565b5090979650505050505050565b6060808252845182820181905260009190608090818501906020808a01865b83811015611b21578151805173ffffffffffffffffffffffffffffffffffffffff90811687528482015116848701526040808201519087015287810151888701528681015160ff168787015260a0808201519087015260c0908101519086015260e09094019390820190600101611aaf565b50508683039087015250611b3581886119a8565b925050508281036040840152611b4b8185611a1a565b9695505050505050565b6020815260006110b7602083018461176356fea26469706673582212204a55b8e73ee0e70258dd3a66c7ad89c1cd4595c2de64e8ee28c59340b77ffcc864736f6c634300080c00330000000000000000000000005bc6bef80da563ebf6df6d6913513fa9a7ec89be000000000000000000000000e592427a0aece92de3edee1f18e0157c058615640000000000000000000000001111111254eeb25477b68fb85ed929f73a9605820000000000000000000000004579709627ca36bce92f51ac975746f431890930
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100725760003560e01c8063a5d4096b11610050578063a5d4096b14610115578063b82c4dc11461012a578063f2f4eb261461013d57600080fd5b8063045c08d5146100775780630b6942c2146100c75780635fafa589146100ee575b600080fd5b61009e7f0000000000000000000000001111111254eeb25477b68fb85ed929f73a96058281565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b61009e7f0000000000000000000000004579709627ca36bce92f51ac975746f43189093081565b61009e7f000000000000000000000000e592427a0aece92de3edee1f18e0157c0586156481565b610128610123366004611390565b610164565b005b6101286101383660046114a6565b61049a565b61009e7f0000000000000000000000005bc6bef80da563ebf6df6d6913513fa9a7ec89be81565b60008060008380602001905181019061017d91906115b1565b96509194509250905073ffffffffffffffffffffffffffffffffffffffff8316156101a857826101aa565b865b92506101c989868360048111156101c3576101c3611616565b87610659565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8a16906370a0823190602401602060405180830381865afa158015610236573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061025a9190611645565b905082811015610296576040517fa1aabbe100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8981166004830152600091908b16906370a0823190602401602060405180830381865afa158015610306573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061032a9190611645565b9050878110158061036657508873ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16145b156103915761038c73ffffffffffffffffffffffffffffffffffffffff8b1686846106f6565b6103d6565b6103bd8961039f838b61168d565b73ffffffffffffffffffffffffffffffffffffffff8d1691906106f6565b6103d685896103cc85856116a4565b61039f919061168d565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8c16906370a0823190602401602060405180830381865afa158015610440573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104649190611645565b9650861561048d5761048d73ffffffffffffffffffffffffffffffffffffffff8c1686896106f6565b5050505050505050505050565b6040517f521d4de90000000000000000000000000000000000000000000000000000000081523360048201527f0000000000000000000000005bc6bef80da563ebf6df6d6913513fa9a7ec89be73ffffffffffffffffffffffffffffffffffffffff169063521d4de990602401602060405180830381865afa158015610524573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054891906116bc565b61057e576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b84838114158061058e5750808214155b156105c5576040517f46282e8d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b8181101561064f5761063f8888838181106105e5576105e56116de565b90506020020160208101906105fa919061170d565b87878481811061060c5761060c6116de565b9050602002016020810190610621919061170d565b868685818110610633576106336116de565b905060200201356107cf565b6106488161172a565b90506105c8565b5050505050505050565b600082600481111561066d5761066d611616565b14156106845761067e8484836108d3565b506106f0565b600182600481111561069857610698611616565b14156106a85761067e84826109e1565b60028260048111156106bc576106bc611616565b14156106d1576106cc8482610ae8565b6106f0565b60038260048111156106e5576106e5611616565b14156106f05760005b505b50505050565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526107ca9084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152610c00565b505050565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015610845573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108699190611645565b90508181101561089f576106cc83610881838561168d565b73ffffffffffffffffffffffffffffffffffffffff87169190610d11565b818111156106f0576106f0836108b5848461168d565b73ffffffffffffffffffffffffffffffffffffffff87169190610e0f565b6000610900847f000000000000000000000000e592427a0aece92de3edee1f18e0157c0586156485610f95565b6040805160a0810182528381523060208201524281830152606081018590526000608082015290517fc04b8d5900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564169163c04b8d599161099691906004016117ad565b6020604051808303816000875af11580156109b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109d99190611645565b949350505050565b6000610a2e837f0000000000000000000000001111111254eeb25477b68fb85ed929f73a9605827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6107cf565b6000807f0000000000000000000000001111111254eeb25477b68fb85ed929f73a96058273ffffffffffffffffffffffffffffffffffffffff1684604051610a769190611813565b6000604051808303816000865af19150503d8060008114610ab3576040519150601f19603f3d011682016040523d82523d6000602084013e610ab8565b606091505b509150915081610acb57610acb81611067565b80806020019051810190610adf9190611645565b95945050505050565b60008082806020019051810190610aff91906118de565b91509150610b4e847f0000000000000000000000004579709627ca36bce92f51ac975746f4318909307fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6107cf565b6040517f848c48da00000000000000000000000000000000000000000000000000000000815260609073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000004579709627ca36bce92f51ac975746f431890930169063848c48da90610bc790849087908790600401611a90565b600060405180830381600087803b158015610be157600080fd5b505af1158015610bf5573d6000803e3d6000fd5b505050505050505050565b6000610c62826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166110a89092919063ffffffff16565b8051909150156107ca5780806020019051810190610c8091906116bc565b6107ca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015610d88573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dac9190611645565b610db691906116a4565b60405173ffffffffffffffffffffffffffffffffffffffff85166024820152604481018290529091506106f09085907f095ea7b30000000000000000000000000000000000000000000000000000000090606401610748565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015610e85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea99190611645565b905081811015610f3b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f5361666545524332303a2064656372656173656420616c6c6f77616e6365206260448201527f656c6f77207a65726f00000000000000000000000000000000000000000000006064820152608401610d08565b60405173ffffffffffffffffffffffffffffffffffffffff8416602482015282820360448201819052906106ee9086907f095ea7b30000000000000000000000000000000000000000000000000000000090606401610748565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa15801561100b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102f9190611645565b9050818110156106f0576106f083610881837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61168d565b80511561107657805181602001fd5b6040517f6a8df6a800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60606109d984846000856110be565b9392505050565b606082471015611150576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610d08565b73ffffffffffffffffffffffffffffffffffffffff85163b6111ce576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610d08565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516111f79190611813565b60006040518083038185875af1925050503d8060008114611234576040519150601f19603f3d011682016040523d82523d6000602084013e611239565b606091505b5091509150611249828286611254565b979650505050505050565b606083156112635750816110b7565b8251156112735782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d089190611b55565b73ffffffffffffffffffffffffffffffffffffffff811681146112c957600080fd5b50565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715611342576113426112cc565b604052919050565b600067ffffffffffffffff821115611364576113646112cc565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b60008060008060008060c087890312156113a957600080fd5b86356113b4816112a7565b955060208701356113c4816112a7565b945060408701356113d4816112a7565b9350606087013592506080870135915060a087013567ffffffffffffffff8111156113fe57600080fd5b8701601f8101891361140f57600080fd5b803561142261141d8261134a565b6112fb565b8181528a602083850101111561143757600080fd5b816020840160208301376000602083830101528093505050509295509295509295565b60008083601f84011261146c57600080fd5b50813567ffffffffffffffff81111561148457600080fd5b6020830191508360208260051b850101111561149f57600080fd5b9250929050565b600080600080600080606087890312156114bf57600080fd5b863567ffffffffffffffff808211156114d757600080fd5b6114e38a838b0161145a565b909850965060208901359150808211156114fc57600080fd5b6115088a838b0161145a565b9096509450604089013591508082111561152157600080fd5b5061152e89828a0161145a565b979a9699509497509295939492505050565b60005b8381101561155b578181015183820152602001611543565b838111156106f05750506000910152565b600082601f83011261157d57600080fd5b815161158b61141d8261134a565b8181528460208386010111156115a057600080fd5b6109d9826020830160208701611540565b600080600080608085870312156115c757600080fd5b84516115d2816112a7565b809450506020850151925060408501519150606085015167ffffffffffffffff8111156115fe57600080fd5b61160a8782880161156c565b91505092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60006020828403121561165757600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008282101561169f5761169f61165e565b500390565b600082198211156116b7576116b761165e565b500190565b6000602082840312156116ce57600080fd5b815180151581146110b757600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561171f57600080fd5b81356110b7816112a7565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561175c5761175c61165e565b5060010190565b6000815180845261177b816020860160208601611540565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b602081526000825160a060208401526117c960c0840182611763565b905073ffffffffffffffffffffffffffffffffffffffff60208501511660408401526040840151606084015260608401516080840152608084015160a08401528091505092915050565b60008251611825818460208701611540565b9190910192915050565b600067ffffffffffffffff821115611849576118496112cc565b5060051b60200190565b600082601f83011261186457600080fd5b8151602061187461141d8361182f565b82815260059290921b8401810191818101908684111561189357600080fd5b8286015b848110156118d357805167ffffffffffffffff8111156118b75760008081fd5b6118c58986838b010161156c565b845250918301918301611897565b509695505050505050565b600080604083850312156118f157600080fd5b825167ffffffffffffffff8082111561190957600080fd5b818501915085601f83011261191d57600080fd5b8151602061192d61141d8361182f565b82815260059290921b8401810191818101908984111561194c57600080fd5b948201945b83861015611978578551600e81106119695760008081fd5b82529482019490820190611951565b9188015191965090935050508082111561199157600080fd5b5061199e85828601611853565b9150509250929050565b60008151808452602080850194508084016000805b84811015611a0e578251600e81106119fc577f4e487b710000000000000000000000000000000000000000000000000000000083526021600452602483fd5b885296830196918301916001016119bd565b50959695505050505050565b600082825180855260208086019550808260051b84010181860160005b84811015611a83577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0868403018952611a71838351611763565b98840198925090830190600101611a37565b5090979650505050505050565b6060808252845182820181905260009190608090818501906020808a01865b83811015611b21578151805173ffffffffffffffffffffffffffffffffffffffff90811687528482015116848701526040808201519087015287810151888701528681015160ff168787015260a0808201519087015260c0908101519086015260e09094019390820190600101611aaf565b50508683039087015250611b3581886119a8565b925050508281036040840152611b4b8185611a1a565b9695505050505050565b6020815260006110b7602083018461176356fea26469706673582212204a55b8e73ee0e70258dd3a66c7ad89c1cd4595c2de64e8ee28c59340b77ffcc864736f6c634300080c0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000005bc6bef80da563ebf6df6d6913513fa9a7ec89be000000000000000000000000e592427a0aece92de3edee1f18e0157c058615640000000000000000000000001111111254eeb25477b68fb85ed929f73a9605820000000000000000000000004579709627ca36bce92f51ac975746f431890930
-----Decoded View---------------
Arg [0] : _core (address): 0x5bc6BEf80DA563EBf6Df6D6913513fa9A7ec89BE
Arg [1] : _uniV3Router (address): 0xE592427A0AEce92De3Edee1F18E0157C05861564
Arg [2] : _oneInch (address): 0x1111111254EEB25477B68fb85Ed929f73A960582
Arg [3] : _angleRouter (address): 0x4579709627CA36BCe92f51ac975746f431890930
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 0000000000000000000000005bc6bef80da563ebf6df6d6913513fa9a7ec89be
Arg [1] : 000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564
Arg [2] : 0000000000000000000000001111111254eeb25477b68fb85ed929f73a960582
Arg [3] : 0000000000000000000000004579709627ca36bce92f51ac975746f431890930
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
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.