More Info
Private Name Tags
ContractCreator
Multichain Info
No addresses found
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Transfer Ownersh... | 21450329 | 89 days ago | IN | 0 ETH | 0.00021454 |
Latest 6 internal transactions
Advanced mode:
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
StEthAdapter
Compiler Version
v0.8.28+commit.7893614a
Optimization Enabled:
Yes with 200 runs
Other Settings:
cancun EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/math/Math.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../interfaces/IAdapter.sol"; import "../interfaces/IChainlinkEthAdapter.sol"; import "../interfaces/IPriceFeedAggregator.sol"; import "../interfaces/ICurvePool.sol"; import "../interfaces/IWETH.sol"; import "../interfaces/ISTETH.sol"; import "./Adapter.sol"; contract StEthAdapter is Adapter { using SafeERC20 for IERC20; ICurvePool public constant curvePool = ICurvePool(ExternalContractAddresses.CURVE_ETH_STETH_POOL); IWETH public constant WETH = IWETH(ExternalContractAddresses.WETH); constructor(address _reserveHolder, address _priceFeedAggregator, address _asset) Adapter(_reserveHolder, _priceFeedAggregator, _asset) {} /// @inheritdoc IAdapter function getReserveValue() external view override returns (uint256) { uint256 assetPrice = priceFeedAggregator.peek(asset); return Math.mulDiv(totalDeposited, assetPrice, 10 ** IERC20Metadata(asset).decimals()); } /// @inheritdoc IAdapter function deposit(uint256 amount) external { uint256 balanceBefore = IERC20(asset).balanceOf(address(this)); IERC20(asset).safeTransferFrom(msg.sender, address(this), amount); uint256 balanceAfter = IERC20(asset).balanceOf(address(this)); amount = balanceAfter - balanceBefore; totalDeposited += amount; emit Deposit(amount); } /// @inheritdoc IAdapter function withdraw(uint256 amount, address recipient) external onlyReserveHolder { IERC20(asset).safeTransfer(recipient, amount); totalDeposited -= amount; emit Withdraw(amount, recipient); } /// @inheritdoc IAdapter function claimRewards(address receiver) external onlyReserveHolder returns (uint256) { uint256 balance = IERC20(asset).balanceOf(address(this)); uint256 reward = balance - totalDeposited; IERC20(asset).safeTransfer(receiver, reward); emit ClaimRewards(receiver, reward); return reward; } /// @inheritdoc IAdapter function swapAmountToEth(uint256 amountIn, uint256 minAmountOut, address receiver) external override onlyReserveHolder returns (uint256) { IERC20(asset).approve(address(curvePool), amountIn); uint256 ethReceived = curvePool.exchange(1, 0, amountIn, minAmountOut); totalDeposited -= amountIn; WETH.deposit{value: ethReceived}(); IERC20(WETH).safeTransfer(receiver, ethReceived); return ethReceived; } /// @inheritdoc IAdapter function swapAmountFromEth(uint256 amountIn) external onlyReserveHolder returns (uint256) { IERC20(WETH).safeTransferFrom(msg.sender, address(this), amountIn); IWETH(WETH).withdraw(amountIn); uint256 balanceBefore = IERC20(asset).balanceOf(address(this)); ISTETH(asset).submit{value: amountIn}(address(this)); uint256 stEthReceived = IERC20(asset).balanceOf(address(this)) - balanceBefore; totalDeposited += stEthReceived; return stEthReceived; } receive() external payable {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (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 pragma solidity ^0.8.0; interface IAdapter { enum Pool { UNISWAP_V2, UNISWAP_V3, CURVE, LIDO, ETHER_FI } event RescueReserves(); event SetPoolType(Pool indexed poolType); event Deposit(uint256 amount); event ClaimRewards(address receiver, uint256 amount); event Withdraw(uint256 amount, address recipient); error NotReserveHolder(); /// @notice Gets reserve value in USD /// @return reserveValue Reserve value in USD function getReserveValue() external view returns (uint256 reserveValue); /// @notice Gets total deposited amount /// @return totalDeposited Total deposited amount function totalDeposited() external view returns (uint256 totalDeposited); /// @notice Rescue reserves from contract /// @dev Only owner can call this function function rescueReserves() external; /// @notice Sets pool type /// @param _poolType Pool type /// @dev Only owner can call this function function setPoolType(Pool _poolType) external; /// @notice Deposit asset to reserve /// @param amount Amount of asset to deposit function deposit(uint256 amount) external; /// @notice Withdraw asset from reserve /// @param amount Amount of asset to withdraw /// @param recipient Receiver of asset function withdraw(uint256 amount, address recipient) external; /// @notice Claim rewards from reserve /// @param receiver Receiver of rewards /// @return amount Amount of rewards claimed function claimRewards(address receiver) external returns (uint256 amount); /// @notice Sells LST for ETH when needed for arbitrage or rebalance /// @param amountIn Amount of LST to sell /// @param minAmountOut Minimum amount of ETH to receive /// @param receiver Receiver of ETH function swapAmountToEth(uint256 amountIn, uint256 minAmountOut, address receiver) external returns (uint256); /// @notice Sells ETH for LST /// @param amountIn Amount of ETH to sell function swapAmountFromEth(uint256 amountIn) external returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IOracle.sol"; interface IChainlinkEthAdapter is IOracle { /// @notice Gets exchange rate for ETH from Chainlink price feed /// @return rate Exchange rate between underlying asset and ETH function exchangeRate() external view returns (uint256 rate); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "src/interfaces/IOracle.sol"; interface IPriceFeedAggregator { event SetPriceFeed(address indexed base, address indexed feed); error ZeroAddress(); /// @notice Sets price feed adapter for given token /// @param base Token address /// @param feed Price feed adapter address function setPriceFeed(address base, address feed) external; /// @notice Gets price feed adapter for given token /// @param base Token address /// @return feed Price feed adapter address function priceFeeds(address base) external view returns (IOracle feed); /// @notice Gets price for given token /// @param base Token address /// @return price Price for given token function peek(address base) external view returns (uint256 price); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface ICurvePool { /// @notice Swaps tokens /// @param i Index of token to swap from /// @param j Index of token to swap to /// @param dx Amount of tokens to swap /// @param min_dy Minimum amount of tokens to receive /// @return dy Amount of tokens received function exchange(int128 i, int128 j, uint256 dx, uint256 min_dy) external payable returns (uint256 dy); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IWETH is IERC20 { function deposit() external payable; function withdraw(uint256 amount) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface ISTETH is IERC20 { function submit(address referral) external payable returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/math/Math.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "../interfaces/IAdapter.sol"; import "../interfaces/IChainlinkEthAdapter.sol"; import "../interfaces/IPriceFeedAggregator.sol"; import "../library/ExternalContractAddresses.sol"; import "../library/UniswapV2SwapLibrary.sol"; import "../library/UniswapV3SwapLibrary.sol"; abstract contract Adapter is IAdapter, Ownable { using SafeERC20 for IERC20; IPriceFeedAggregator public immutable priceFeedAggregator; address public immutable reserveHolder; address public immutable asset; Pool public poolType; uint256 public totalDeposited; modifier onlyReserveHolder() { if (msg.sender != reserveHolder) { revert NotReserveHolder(); } _; } constructor(address _reserveHolder, address _priceFeedAggregator, address _asset) Ownable() { reserveHolder = _reserveHolder; priceFeedAggregator = IPriceFeedAggregator(_priceFeedAggregator); asset = _asset; } /// @inheritdoc IAdapter function setPoolType(Pool _poolType) external onlyOwner { poolType = _poolType; emit SetPoolType(_poolType); } /// @inheritdoc IAdapter function rescueReserves() external onlyOwner { IERC20(asset).safeTransfer(msg.sender, IERC20(asset).balanceOf(address(this))); totalDeposited = 0; emit RescueReserves(); } function rescueToken(address token) external onlyOwner { IERC20(token).safeTransfer(msg.sender, IERC20(token).balanceOf(address(this))); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. * * CAUTION: See Security Considerations above. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IOracle { /// @notice Gets name of price adapter /// @return name Name of price adapter function name() external view returns (string memory name); /// @notice Gets decimals of price adapter /// @return decimals Decimals of price adapter function decimals() external view returns (uint8 decimals); /// @notice Gets price base token from Chainlink price feed /// @return price price in USD for the 1 baseToken function peek() external view returns (uint256 price); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @notice external contract addresses on Ethereum Mainnet library ExternalContractAddresses { address public constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; address public constant stETH = 0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84; address public constant eETH = 0x35fA164735182de50811E8e2E824cFb9B6118ac2; address public constant weETH = 0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee; address public constant eETH_POOL = 0x308861A430be4cce5502d0A12724771Fc6DaF216; address public constant UNI_V2_SWAP_ROUTER = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; address public constant UNI_V3_SWAP_ROUTER = 0xE592427A0AEce92De3Edee1F18E0157C05861564; address public constant UNI_V2_POOL_FACTORY = 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f; address public constant ETH_USD_CHAINLINK_FEED = 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419; address public constant STETH_USD_CHAINLINK_FEED = 0xCfE54B5cD566aB89272946F602D76Ea879CAb4a8; address public constant WEETH_ETH_CHAINLINK_FEED = 0x5c9C449BbC9a6075A2c061dF312a35fd1E05fF22; address public constant CURVE_ETH_STETH_POOL = 0xDC24316b9AE028F1497c275EB9192a3Ea0f67022; address public constant ONE_INCH_ROUTER = 0x111111125421cA6dc452d289314280a0f8842A65; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol"; import "src/library/ExternalContractAddresses.sol"; library UniswapV2SwapLibrary { IUniswapV2Router02 public constant swapRouter = IUniswapV2Router02(ExternalContractAddresses.UNI_V2_SWAP_ROUTER); function swapExactAmountIn( address assetIn, address assetOut, uint256 amount, uint256 minAmountOut, address receiver ) external returns (uint256) { address[] memory path = new address[](2); path[0] = assetIn; path[1] = assetOut; IERC20(assetIn).approve(address(swapRouter), amount); uint256[] memory amounts = swapRouter.swapExactTokensForTokens(amount, minAmountOut, path, receiver, block.timestamp); return amounts[1]; } function swapExactAmountOut( address assetIn, address assetOut, uint256 amountOut, uint256 maxAmountIn, address receiver ) external returns (uint256) { address[] memory path = new address[](2); path[0] = assetIn; path[1] = assetOut; IERC20(assetIn).approve(address(swapRouter), maxAmountIn); uint256[] memory amounts = swapRouter.swapTokensForExactTokens(amountOut, maxAmountIn, path, receiver, block.timestamp); return amounts[0]; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@uniswap/v3-periphery/contracts/interfaces/ISwapRouter.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; library UniswapV3SwapLibrary { using SafeERC20 for IERC20; ISwapRouter public constant swapRouter = ISwapRouter(0xE592427A0AEce92De3Edee1F18E0157C05861564); function swapExactAmountIn( address assetIn, address assetOut, uint256 amount, uint256 minAmountOut, address receiver ) internal returns (uint256) { IERC20(assetIn).approve(address(swapRouter), amount); return swapRouter.exactInputSingle( ISwapRouter.ExactInputSingleParams({ tokenIn: assetIn, tokenOut: assetOut, fee: 500, recipient: receiver, deadline: block.timestamp, amountIn: amount, amountOutMinimum: minAmountOut, sqrtPriceLimitX96: 0 }) ); } function swapExactAmountOut( address assetIn, address assetOut, uint256 amountOut, uint256 maxAmountIn, address receiver ) internal returns (uint256) { IERC20(assetIn).approve(address(swapRouter), maxAmountIn); return swapRouter.exactOutputSingle( ISwapRouter.ExactOutputSingleParams({ tokenIn: assetIn, tokenOut: assetOut, fee: 3000, recipient: receiver, deadline: block.timestamp, amountOut: amountOut, amountInMaximum: maxAmountIn, sqrtPriceLimitX96: 0 }) ); } }
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: GPL-2.0-or-later pragma solidity >=0.7.5; pragma abicoder v2; import '@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol'; /// @title Router token swapping functionality /// @notice Functions for swapping tokens via Uniswap V3 interface ISwapRouter is IUniswapV3SwapCallback { struct ExactInputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; uint256 deadline; uint256 amountIn; uint256 amountOutMinimum; uint160 sqrtPriceLimitX96; } /// @notice Swaps `amountIn` of one token for as much as possible of another token /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata /// @return amountOut The amount of the received token function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut); struct ExactInputParams { bytes path; address recipient; uint256 deadline; uint256 amountIn; uint256 amountOutMinimum; } /// @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); struct ExactOutputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; uint256 deadline; uint256 amountOut; uint256 amountInMaximum; uint160 sqrtPriceLimitX96; } /// @notice Swaps as little as possible of one token for `amountOut` of another token /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata /// @return amountIn The amount of the input token function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn); struct ExactOutputParams { bytes path; address recipient; uint256 deadline; uint256 amountOut; uint256 amountInMaximum; } /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed) /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata /// @return amountIn The amount of the input token function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn); }
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); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Callback for IUniswapV3PoolActions#swap /// @notice Any contract that calls IUniswapV3PoolActions#swap must implement this interface interface IUniswapV3SwapCallback { /// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap. /// @dev In the implementation you must pay the pool tokens owed for the swap. /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory. /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped. /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token0 to the pool. /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token1 to the pool. /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call function uniswapV3SwapCallback( int256 amount0Delta, int256 amount1Delta, bytes calldata data ) external; }
{ "remappings": [ "@chainlink/=lib/chainlink/", "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/", "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "@uniswap/v2-core/=lib/v2-core/", "@uniswap/v2-periphery/=lib/v2-periphery/", "@uniswap/v3-core/=lib/v3-core/", "@uniswap/v3-periphery/=lib/v3-periphery/", "ds-test/=lib/openzeppelin-contracts-upgradeable/lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/", "forge-std/=lib/forge-std/src/", "openzeppelin-foundry-upgrades-0.3.6/=dependencies/openzeppelin-foundry-upgrades-0.3.6/", "openzeppelin/=lib/openzeppelin-contracts-upgradeable/contracts/", "openzeppelin-foundry-upgrades/=dependencies/openzeppelin-foundry-upgrades-0.3.6/src/", "solidity-stringutils/=dependencies/openzeppelin-foundry-upgrades-0.3.6/lib/solidity-stringutils/", "chainlink/=lib/chainlink/", "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "v2-core/=lib/v2-core/contracts/", "v2-periphery/=lib/v2-periphery/contracts/", "v3-core/=lib/v3-core/", "v3-periphery/=lib/v3-periphery/contracts/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "cancun", "viaIR": false, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_reserveHolder","type":"address"},{"internalType":"address","name":"_priceFeedAggregator","type":"address"},{"internalType":"address","name":"_asset","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"NotReserveHolder","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ClaimRewards","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[],"name":"RescueReserves","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"enum IAdapter.Pool","name":"poolType","type":"uint8"}],"name":"SetPoolType","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"contract IWETH","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"asset","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"claimRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"curvePool","outputs":[{"internalType":"contract ICurvePool","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getReserveValue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolType","outputs":[{"internalType":"enum IAdapter.Pool","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceFeedAggregator","outputs":[{"internalType":"contract IPriceFeedAggregator","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rescueReserves","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"rescueToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reserveHolder","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum IAdapter.Pool","name":"_poolType","type":"uint8"}],"name":"setPoolType","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"name":"swapAmountFromEth","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"swapAmountToEth","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalDeposited","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60e060405234801561000f575f5ffd5b5060405161190938038061190983398101604081905261002e916100c5565b82828261003a3361005b565b6001600160a01b0392831660a0529082166080521660c05250610105915050565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146100c0575f5ffd5b919050565b5f5f5f606084860312156100d7575f5ffd5b6100e0846100aa565b92506100ee602085016100aa565b91506100fc604085016100aa565b90509250925092565b60805160a05160c0516117556101b45f395f81816101c001528181610418015281816105140152818161076f015281816107e2015281816108d0015281816109500152818161098f01528181610a7301528181610b1301528181610c8701528181610d1901528181610da801528181610e9e0152610f2f01525f818161038b015281816103cd015281816104a601528181610bb30152610e4901525f81816102750152610a9f01526117555ff3fe608060405260043610610112575f3560e01c8063a20b8b4e1161009d578063de6858d611610062578063de6858d61461031d578063ef5cfb8c1461033c578063f2fde38b1461035b578063f7bbb2c41461037a578063ff50abdc146103ad575f5ffd5b8063a20b8b4e14610264578063ad5c464814610297578063b1dd61b6146102be578063b6b55f25146102ea578063cfe1f82014610309575f5ffd5b80634460d3cf116100e35780634460d3cf146101e25780636908dc1114610201578063715018a6146102155780637c6d27c5146102295780638da5cb5b14610248575f5ffd5b8062f714ce1461011d5780631855c4e01461013e578063218751b21461017057806338d52e0f146101af575f5ffd5b3661011957005b5f5ffd5b348015610128575f5ffd5b5061013c610137366004611455565b6103c2565b005b348015610149575f5ffd5b5061015d61015836600461147f565b61049a565b6040519081526020015b60405180910390f35b34801561017b575f5ffd5b5061019773dc24316b9ae028f1497c275eb9192a3ea0f6702281565b6040516001600160a01b039091168152602001610167565b3480156101ba575f5ffd5b506101977f000000000000000000000000000000000000000000000000000000000000000081565b3480156101ed575f5ffd5b5061013c6101fc3660046114b1565b6106bc565b34801561020c575f5ffd5b5061013c610744565b348015610220575f5ffd5b5061013c610838565b348015610234575f5ffd5b5061013c6102433660046114ca565b61084b565b348015610253575f5ffd5b505f546001600160a01b0316610197565b34801561026f575f5ffd5b506101977f000000000000000000000000000000000000000000000000000000000000000081565b3480156102a2575f5ffd5b5061019773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b3480156102c9575f5ffd5b505f546102dd90600160a01b900460ff1681565b60405161016791906114fc565b3480156102f5575f5ffd5b5061013c610304366004611522565b6108b9565b348015610314575f5ffd5b5061015d610a5c565b348015610328575f5ffd5b5061015d610337366004611522565b610ba7565b348015610347575f5ffd5b5061015d6103563660046114b1565b610e3d565b348015610366575f5ffd5b5061013c6103753660046114b1565b610f9f565b348015610385575f5ffd5b506101977f000000000000000000000000000000000000000000000000000000000000000081565b3480156103b8575f5ffd5b5061015d60015481565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461040b576040516302f5b4d560e31b815260040160405180910390fd5b61043f6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016828461101a565b8160015f828254610450919061154d565b9091555050604080518381526001600160a01b03831660208201527f8353ffcac0876ad14e226d9783c04540bfebf13871e868157d2a391cad98e918910160405180910390a15050565b5f336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146104e4576040516302f5b4d560e31b815260040160405180910390fd5b60405163095ea7b360e01b815273dc24316b9ae028f1497c275eb9192a3ea0f670226004820152602481018590527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063095ea7b3906044016020604051808303815f875af1158015610562573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105869190611566565b50604051630f7c084960e21b8152600160048201525f6024820181905260448201869052606482018590529073dc24316b9ae028f1497c275eb9192a3ea0f6702290633df02124906084016020604051808303815f875af11580156105ed573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106119190611585565b90508460015f828254610624919061154d565b9250508190555073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004015f604051808303818588803b158015610678575f5ffd5b505af115801561068a573d5f5f3e3d5ffd5b506106b2935073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2925086915084905061101a565b90505b9392505050565b6106c4611082565b6040516370a0823160e01b81523060048201526107419033906001600160a01b038416906370a0823190602401602060405180830381865afa15801561070c573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107309190611585565b6001600160a01b038416919061101a565b50565b61074c611082565b6040516370a0823160e01b81523060048201526108099033906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa1580156107b4573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107d89190611585565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016919061101a565b5f60018190556040517f76490f4f871d435e8f2abce67b5e3918ced44679294af1d4103d13475794b3bf9190a1565b610840611082565b6108495f6110db565b565b610853611082565b5f805482919060ff60a01b1916600160a01b836004811115610877576108776114e8565b021790555080600481111561088e5761088e6114e8565b6040517fb28197b537edee8b023b03fff7aa2805da8bfb8eedeb6a0a08bb7f6b8a81ccd6905f90a250565b6040516370a0823160e01b81523060048201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa15801561091d573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109419190611585565b90506109786001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633308561112a565b6040516370a0823160e01b81523060048201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa1580156109dc573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a009190611585565b9050610a0c828261154d565b92508260015f828254610a1f919061159c565b90915550506040518381527f4d6ce1e535dbade1c23defba91e23b8f791ce5edc0cc320257a2b364e4e384269060200160405180910390a1505050565b604051635677d7d760e11b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811660048301525f9182917f0000000000000000000000000000000000000000000000000000000000000000169063acefafae90602401602060405180830381865afa158015610ae4573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b089190611585565b9050610ba1600154827f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b6d573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b9191906115af565b610b9c90600a6116b2565b611168565b91505090565b5f336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610bf1576040516302f5b4d560e31b815260040160405180910390fd5b610c1173c02aaa39b223fe8d0a0e5c4f27ead9083c756cc233308561112a565b604051632e1a7d4d60e01b81526004810183905273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc290632e1a7d4d906024015f604051808303815f87803b158015610c5b575f5ffd5b505af1158015610c6d573d5f5f3e3d5ffd5b50506040516370a0823160e01b81523060048201525f92507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031691506370a0823190602401602060405180830381865afa158015610cd5573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610cf99190611585565b60405163a1903eab60e01b81523060048201529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a1903eab90859060240160206040518083038185885af1158015610d61573d5f5f3e3d5ffd5b50505050506040513d601f19601f82011682018060405250810190610d869190611585565b506040516370a0823160e01b81523060048201525f9082906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015610ded573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e119190611585565b610e1b919061154d565b90508060015f828254610e2e919061159c565b9091555090925050505b919050565b5f336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610e87576040516302f5b4d560e31b815260040160405180910390fd5b6040516370a0823160e01b81523060048201525f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015610eeb573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f0f9190611585565b90505f60015482610f20919061154d565b9050610f566001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016858361101a565b604080516001600160a01b0386168152602081018390527f1f89f96333d3133000ee447473151fa9606543368f02271c9d95ae14f13bcc67910160405180910390a19392505050565b610fa7611082565b6001600160a01b0381166110115760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b610741816110db565b6040516001600160a01b03831660248201526044810182905261107d90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261124d565b505050565b5f546001600160a01b031633146108495760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611008565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040516001600160a01b03808516602483015283166044820152606481018290526111629085906323b872dd60e01b90608401611046565b50505050565b5f80805f19858709858702925082811083820303915050805f0361119f57838281611195576111956116c0565b04925050506106b5565b8084116111e65760405162461bcd60e51b81526020600482015260156024820152744d6174683a206d756c446976206f766572666c6f7760581b6044820152606401611008565b5f8486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091025f889003889004909101858311909403939093029303949094049190911702949350505050565b5f6112a1826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166113209092919063ffffffff16565b905080515f14806112c15750808060200190518101906112c19190611566565b61107d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401611008565b60606106b284845f85855f5f866001600160a01b0316858760405161134591906116d4565b5f6040518083038185875af1925050503d805f811461137f576040519150601f19603f3d011682016040523d82523d5f602084013e611384565b606091505b5091509150611395878383876113a2565b925050505b949350505050565b606083156114105782515f03611409576001600160a01b0385163b6114095760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401611008565b508161139a565b61139a83838151156114255781518083602001fd5b8060405162461bcd60e51b815260040161100891906116ea565b80356001600160a01b0381168114610e38575f5ffd5b5f5f60408385031215611466575f5ffd5b823591506114766020840161143f565b90509250929050565b5f5f5f60608486031215611491575f5ffd5b83359250602084013591506114a86040850161143f565b90509250925092565b5f602082840312156114c1575f5ffd5b6106b58261143f565b5f602082840312156114da575f5ffd5b8135600581106106b5575f5ffd5b634e487b7160e01b5f52602160045260245ffd5b602081016005831061151c57634e487b7160e01b5f52602160045260245ffd5b91905290565b5f60208284031215611532575f5ffd5b5035919050565b634e487b7160e01b5f52601160045260245ffd5b8181038181111561156057611560611539565b92915050565b5f60208284031215611576575f5ffd5b815180151581146106b5575f5ffd5b5f60208284031215611595575f5ffd5b5051919050565b8082018082111561156057611560611539565b5f602082840312156115bf575f5ffd5b815160ff811681146106b5575f5ffd5b6001815b600184111561160a578085048111156115ee576115ee611539565b60018416156115fc57908102905b60019390931c9280026115d3565b935093915050565b5f8261162057506001611560565b8161162c57505f611560565b8160018114611642576002811461164c57611668565b6001915050611560565b60ff84111561165d5761165d611539565b50506001821b611560565b5060208310610133831016604e8410600b841016171561168b575081810a611560565b6116975f1984846115cf565b805f19048211156116aa576116aa611539565b029392505050565b5f6106b560ff841683611612565b634e487b7160e01b5f52601260045260245ffd5b5f82518060208501845e5f920191825250919050565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f8301168401019150509291505056fea2646970667358221220b2cf1ea74c46a222d52893acdcbf908893a3b3bd5ad14673793222230cc23abe64736f6c634300081c0033000000000000000000000000c36303ef9c780292755b5a9593bfa8c1a7817e2a000000000000000000000000b3a36232ecc1da6c8d0d3f417e00406566933bd0000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe84
Deployed Bytecode
0x608060405260043610610112575f3560e01c8063a20b8b4e1161009d578063de6858d611610062578063de6858d61461031d578063ef5cfb8c1461033c578063f2fde38b1461035b578063f7bbb2c41461037a578063ff50abdc146103ad575f5ffd5b8063a20b8b4e14610264578063ad5c464814610297578063b1dd61b6146102be578063b6b55f25146102ea578063cfe1f82014610309575f5ffd5b80634460d3cf116100e35780634460d3cf146101e25780636908dc1114610201578063715018a6146102155780637c6d27c5146102295780638da5cb5b14610248575f5ffd5b8062f714ce1461011d5780631855c4e01461013e578063218751b21461017057806338d52e0f146101af575f5ffd5b3661011957005b5f5ffd5b348015610128575f5ffd5b5061013c610137366004611455565b6103c2565b005b348015610149575f5ffd5b5061015d61015836600461147f565b61049a565b6040519081526020015b60405180910390f35b34801561017b575f5ffd5b5061019773dc24316b9ae028f1497c275eb9192a3ea0f6702281565b6040516001600160a01b039091168152602001610167565b3480156101ba575f5ffd5b506101977f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe8481565b3480156101ed575f5ffd5b5061013c6101fc3660046114b1565b6106bc565b34801561020c575f5ffd5b5061013c610744565b348015610220575f5ffd5b5061013c610838565b348015610234575f5ffd5b5061013c6102433660046114ca565b61084b565b348015610253575f5ffd5b505f546001600160a01b0316610197565b34801561026f575f5ffd5b506101977f000000000000000000000000b3a36232ecc1da6c8d0d3f417e00406566933bd081565b3480156102a2575f5ffd5b5061019773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b3480156102c9575f5ffd5b505f546102dd90600160a01b900460ff1681565b60405161016791906114fc565b3480156102f5575f5ffd5b5061013c610304366004611522565b6108b9565b348015610314575f5ffd5b5061015d610a5c565b348015610328575f5ffd5b5061015d610337366004611522565b610ba7565b348015610347575f5ffd5b5061015d6103563660046114b1565b610e3d565b348015610366575f5ffd5b5061013c6103753660046114b1565b610f9f565b348015610385575f5ffd5b506101977f000000000000000000000000c36303ef9c780292755b5a9593bfa8c1a7817e2a81565b3480156103b8575f5ffd5b5061015d60015481565b336001600160a01b037f000000000000000000000000c36303ef9c780292755b5a9593bfa8c1a7817e2a161461040b576040516302f5b4d560e31b815260040160405180910390fd5b61043f6001600160a01b037f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe8416828461101a565b8160015f828254610450919061154d565b9091555050604080518381526001600160a01b03831660208201527f8353ffcac0876ad14e226d9783c04540bfebf13871e868157d2a391cad98e918910160405180910390a15050565b5f336001600160a01b037f000000000000000000000000c36303ef9c780292755b5a9593bfa8c1a7817e2a16146104e4576040516302f5b4d560e31b815260040160405180910390fd5b60405163095ea7b360e01b815273dc24316b9ae028f1497c275eb9192a3ea0f670226004820152602481018590527f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe846001600160a01b03169063095ea7b3906044016020604051808303815f875af1158015610562573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105869190611566565b50604051630f7c084960e21b8152600160048201525f6024820181905260448201869052606482018590529073dc24316b9ae028f1497c275eb9192a3ea0f6702290633df02124906084016020604051808303815f875af11580156105ed573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106119190611585565b90508460015f828254610624919061154d565b9250508190555073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004015f604051808303818588803b158015610678575f5ffd5b505af115801561068a573d5f5f3e3d5ffd5b506106b2935073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2925086915084905061101a565b90505b9392505050565b6106c4611082565b6040516370a0823160e01b81523060048201526107419033906001600160a01b038416906370a0823190602401602060405180830381865afa15801561070c573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107309190611585565b6001600160a01b038416919061101a565b50565b61074c611082565b6040516370a0823160e01b81523060048201526108099033906001600160a01b037f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe8416906370a0823190602401602060405180830381865afa1580156107b4573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107d89190611585565b6001600160a01b037f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe8416919061101a565b5f60018190556040517f76490f4f871d435e8f2abce67b5e3918ced44679294af1d4103d13475794b3bf9190a1565b610840611082565b6108495f6110db565b565b610853611082565b5f805482919060ff60a01b1916600160a01b836004811115610877576108776114e8565b021790555080600481111561088e5761088e6114e8565b6040517fb28197b537edee8b023b03fff7aa2805da8bfb8eedeb6a0a08bb7f6b8a81ccd6905f90a250565b6040516370a0823160e01b81523060048201525f907f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe846001600160a01b0316906370a0823190602401602060405180830381865afa15801561091d573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109419190611585565b90506109786001600160a01b037f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe841633308561112a565b6040516370a0823160e01b81523060048201525f907f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe846001600160a01b0316906370a0823190602401602060405180830381865afa1580156109dc573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a009190611585565b9050610a0c828261154d565b92508260015f828254610a1f919061159c565b90915550506040518381527f4d6ce1e535dbade1c23defba91e23b8f791ce5edc0cc320257a2b364e4e384269060200160405180910390a1505050565b604051635677d7d760e11b81526001600160a01b037f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe84811660048301525f9182917f000000000000000000000000b3a36232ecc1da6c8d0d3f417e00406566933bd0169063acefafae90602401602060405180830381865afa158015610ae4573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b089190611585565b9050610ba1600154827f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe846001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b6d573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b9191906115af565b610b9c90600a6116b2565b611168565b91505090565b5f336001600160a01b037f000000000000000000000000c36303ef9c780292755b5a9593bfa8c1a7817e2a1614610bf1576040516302f5b4d560e31b815260040160405180910390fd5b610c1173c02aaa39b223fe8d0a0e5c4f27ead9083c756cc233308561112a565b604051632e1a7d4d60e01b81526004810183905273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc290632e1a7d4d906024015f604051808303815f87803b158015610c5b575f5ffd5b505af1158015610c6d573d5f5f3e3d5ffd5b50506040516370a0823160e01b81523060048201525f92507f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe846001600160a01b031691506370a0823190602401602060405180830381865afa158015610cd5573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610cf99190611585565b60405163a1903eab60e01b81523060048201529091506001600160a01b037f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe84169063a1903eab90859060240160206040518083038185885af1158015610d61573d5f5f3e3d5ffd5b50505050506040513d601f19601f82011682018060405250810190610d869190611585565b506040516370a0823160e01b81523060048201525f9082906001600160a01b037f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe8416906370a0823190602401602060405180830381865afa158015610ded573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e119190611585565b610e1b919061154d565b90508060015f828254610e2e919061159c565b9091555090925050505b919050565b5f336001600160a01b037f000000000000000000000000c36303ef9c780292755b5a9593bfa8c1a7817e2a1614610e87576040516302f5b4d560e31b815260040160405180910390fd5b6040516370a0823160e01b81523060048201525f907f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe846001600160a01b0316906370a0823190602401602060405180830381865afa158015610eeb573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610f0f9190611585565b90505f60015482610f20919061154d565b9050610f566001600160a01b037f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe8416858361101a565b604080516001600160a01b0386168152602081018390527f1f89f96333d3133000ee447473151fa9606543368f02271c9d95ae14f13bcc67910160405180910390a19392505050565b610fa7611082565b6001600160a01b0381166110115760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b610741816110db565b6040516001600160a01b03831660248201526044810182905261107d90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261124d565b505050565b5f546001600160a01b031633146108495760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611008565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040516001600160a01b03808516602483015283166044820152606481018290526111629085906323b872dd60e01b90608401611046565b50505050565b5f80805f19858709858702925082811083820303915050805f0361119f57838281611195576111956116c0565b04925050506106b5565b8084116111e65760405162461bcd60e51b81526020600482015260156024820152744d6174683a206d756c446976206f766572666c6f7760581b6044820152606401611008565b5f8486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091025f889003889004909101858311909403939093029303949094049190911702949350505050565b5f6112a1826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166113209092919063ffffffff16565b905080515f14806112c15750808060200190518101906112c19190611566565b61107d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401611008565b60606106b284845f85855f5f866001600160a01b0316858760405161134591906116d4565b5f6040518083038185875af1925050503d805f811461137f576040519150601f19603f3d011682016040523d82523d5f602084013e611384565b606091505b5091509150611395878383876113a2565b925050505b949350505050565b606083156114105782515f03611409576001600160a01b0385163b6114095760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401611008565b508161139a565b61139a83838151156114255781518083602001fd5b8060405162461bcd60e51b815260040161100891906116ea565b80356001600160a01b0381168114610e38575f5ffd5b5f5f60408385031215611466575f5ffd5b823591506114766020840161143f565b90509250929050565b5f5f5f60608486031215611491575f5ffd5b83359250602084013591506114a86040850161143f565b90509250925092565b5f602082840312156114c1575f5ffd5b6106b58261143f565b5f602082840312156114da575f5ffd5b8135600581106106b5575f5ffd5b634e487b7160e01b5f52602160045260245ffd5b602081016005831061151c57634e487b7160e01b5f52602160045260245ffd5b91905290565b5f60208284031215611532575f5ffd5b5035919050565b634e487b7160e01b5f52601160045260245ffd5b8181038181111561156057611560611539565b92915050565b5f60208284031215611576575f5ffd5b815180151581146106b5575f5ffd5b5f60208284031215611595575f5ffd5b5051919050565b8082018082111561156057611560611539565b5f602082840312156115bf575f5ffd5b815160ff811681146106b5575f5ffd5b6001815b600184111561160a578085048111156115ee576115ee611539565b60018416156115fc57908102905b60019390931c9280026115d3565b935093915050565b5f8261162057506001611560565b8161162c57505f611560565b8160018114611642576002811461164c57611668565b6001915050611560565b60ff84111561165d5761165d611539565b50506001821b611560565b5060208310610133831016604e8410600b841016171561168b575081810a611560565b6116975f1984846115cf565b805f19048211156116aa576116aa611539565b029392505050565b5f6106b560ff841683611612565b634e487b7160e01b5f52601260045260245ffd5b5f82518060208501845e5f920191825250919050565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f8301168401019150509291505056fea2646970667358221220b2cf1ea74c46a222d52893acdcbf908893a3b3bd5ad14673793222230cc23abe64736f6c634300081c0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000c36303ef9c780292755b5a9593bfa8c1a7817e2a000000000000000000000000b3a36232ecc1da6c8d0d3f417e00406566933bd0000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe84
-----Decoded View---------------
Arg [0] : _reserveHolder (address): 0xc36303ef9c780292755B5a9593Bfa8c1a7817E2a
Arg [1] : _priceFeedAggregator (address): 0xb3a36232ECc1da6C8D0d3f417E00406566933bD0
Arg [2] : _asset (address): 0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000c36303ef9c780292755b5a9593bfa8c1a7817e2a
Arg [1] : 000000000000000000000000b3a36232ecc1da6c8d0d3f417e00406566933bd0
Arg [2] : 000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe84
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.