Feature Tip: Add private address tag to any address under My Name Tag !
Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
Latest 1 internal transaction
Advanced mode:
| Parent Transaction Hash | Method | Block |
From
|
|
To
|
||
|---|---|---|---|---|---|---|---|
| 0x61016060 | 19510630 | 712 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
ERC4626Adapter
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 1000 runs
Other Settings:
london EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-2.0-or-later
// Gearbox Protocol. Generalized leverage for DeFi protocols
// (c) Gearbox Foundation, 2023.
pragma solidity ^0.8.17;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IERC4626} from "@openzeppelin/contracts/interfaces/IERC4626.sol";
import {AbstractAdapter} from "../AbstractAdapter.sol";
import {AdapterType} from "@gearbox-protocol/sdk-gov/contracts/AdapterType.sol";
import {IERC4626Adapter} from "../../interfaces/erc4626/IERC4626Adapter.sol";
/// @title ERC4626 Vault adapter
/// @notice Implements logic allowing CAs to interact with any standard-compliant ERC4626 vault
contract ERC4626Adapter is AbstractAdapter, IERC4626Adapter {
AdapterType public constant override _gearboxAdapterType = AdapterType.ERC4626_VAULT;
uint16 public constant override _gearboxAdapterVersion = 3_00;
/// @notice Address of the underlying asset of the vault
address public immutable override asset;
/// @notice Mask of the underlying asset of the vault
uint256 public immutable override assetMask;
/// @notice Mask of the ERC4626 vault shares
uint256 public immutable override sharesMask;
/// @notice Constructor
/// @param _creditManager Credit manager address
/// @param _vault ERC4626 vault address
constructor(address _creditManager, address _vault)
AbstractAdapter(_creditManager, _vault) // U:[TV-1]
{
asset = IERC4626(_vault).asset(); // U:[TV-1]
assetMask = _getMaskOrRevert(asset); // U:[TV-1]
sharesMask = _getMaskOrRevert(_vault); // U:[TV-1]
}
/// @notice Deposits a specified amount of underlying asset from the credit account
/// @param assets Amount of asset to deposit
/// @dev `receiver` is ignored as it is always the credit account
function deposit(uint256 assets, address)
external
override
creditFacadeOnly // U:[TV-2]
returns (uint256 tokensToEnable, uint256 tokensToDisable)
{
address creditAccount = _creditAccount(); // U:[TV-3]
(tokensToEnable, tokensToDisable) = _deposit(creditAccount, assets, false); // U:[TV-3]
}
/// @notice Deposits the entire balance of underlying asset from the credit account, except the specified amount
/// @param leftoverAmount Amount of underlying to keep on the account
function depositDiff(uint256 leftoverAmount)
external
override
creditFacadeOnly // U:[TV-2]
returns (uint256 tokensToEnable, uint256 tokensToDisable)
{
address creditAccount = _creditAccount(); // U:[TV-4]
uint256 balance = IERC20(asset).balanceOf(creditAccount); // U:[TV-4]
if (balance <= leftoverAmount) return (0, 0);
unchecked {
balance -= leftoverAmount; // U:[TV-4]
}
(tokensToEnable, tokensToDisable) = _deposit(creditAccount, balance, leftoverAmount <= 1); // U:[TV-4]
}
/// @dev Implementation for the deposit function
function _deposit(address creditAccount, uint256 assets, bool disableTokenIn)
internal
returns (uint256 tokensToEnable, uint256 tokensToDisable)
{
(tokensToEnable, tokensToDisable) =
_executeDeposit(disableTokenIn, abi.encodeCall(IERC4626.deposit, (assets, creditAccount))); // U:[TV-3,4]
}
/// @notice Deposits an amount of asset required to mint exactly 'shares' of vault shares
/// @param shares Amount of shares to mint
/// @dev `receiver` is ignored as it is always the credit account
function mint(uint256 shares, address)
external
override
creditFacadeOnly // U:[TV-2]
returns (uint256 tokensToEnable, uint256 tokensToDisable)
{
address creditAccount = _creditAccount(); // U:[TV-5]
(tokensToEnable, tokensToDisable) =
_executeDeposit(false, abi.encodeCall(IERC4626.mint, (shares, creditAccount))); // U:[TV-5]
}
/// @notice Burns an amount of shares required to get exactly `assets` of asset
/// @param assets Amount of asset to withdraw
/// @dev `receiver` and `owner` are ignored, since they are always set to the credit account address
function withdraw(uint256 assets, address, address)
external
override
creditFacadeOnly // U:[TV-2]
returns (uint256 tokensToEnable, uint256 tokensToDisable)
{
address creditAccount = _creditAccount(); // U:[TV-6]
(tokensToEnable, tokensToDisable) =
_executeWithdrawal(false, abi.encodeCall(IERC4626.withdraw, (assets, creditAccount, creditAccount))); // U:[TV-6]
}
/// @notice Burns a specified amount of shares from the credit account
/// @param shares Amount of shares to burn
/// @dev `receiver` and `owner` are ignored, since they are always set to the credit account address
function redeem(uint256 shares, address, address)
external
override
creditFacadeOnly // U:[TV-2]
returns (uint256 tokensToEnable, uint256 tokensToDisable)
{
address creditAccount = _creditAccount(); // U:[TV-7]
(tokensToEnable, tokensToDisable) = _redeem(creditAccount, shares, false); // U:[TV-7]
}
/// @notice Burns the entire balance of shares from the credit account, except the specified amount
/// @param leftoverAmount Amount of vault token to keep on the account
function redeemDiff(uint256 leftoverAmount)
external
override
creditFacadeOnly // U:[TV-2]
returns (uint256 tokensToEnable, uint256 tokensToDisable)
{
address creditAccount = _creditAccount(); // U:[TV-8]
uint256 balance = IERC20(targetContract).balanceOf(creditAccount); // U:[TV-8]
if (balance <= leftoverAmount) return (0, 0);
unchecked {
balance -= leftoverAmount; // U:[TV-8]
}
(tokensToEnable, tokensToDisable) = _redeem(creditAccount, balance, leftoverAmount <= 1); // U:[TV-8]
}
/// @dev Implementation for the redeem function
function _redeem(address creditAccount, uint256 shares, bool disableTokenIn)
internal
returns (uint256 tokensToEnable, uint256 tokensToDisable)
{
(tokensToEnable, tokensToDisable) =
_executeWithdrawal(disableTokenIn, abi.encodeCall(IERC4626.redeem, (shares, creditAccount, creditAccount))); // U:[TV-7,8]
}
/// @dev Implementation for deposit (asset => shares) actions execution
/// @dev All deposit-type actions follow the same structure, with only
/// calldata and disabling the input token being different
function _executeDeposit(bool disableAsset, bytes memory callData)
internal
returns (uint256 tokensToEnable, uint256 tokensToDisable)
{
_approveToken(asset, type(uint256).max); // U:[TV-3,4,5]
_execute(callData); // U:[TV-3,4,5]
_approveToken(asset, 1); // U:[TV-3,4,5]
tokensToEnable = sharesMask;
tokensToDisable = disableAsset ? assetMask : 0;
}
/// @dev Implementation for withdrawal (shares => asset) actions execution
/// @dev All withdrawal-type actions follow the same structure, with only
/// calldata and disabling the input token being different
function _executeWithdrawal(bool disableShares, bytes memory callData)
internal
returns (uint256 tokensToEnable, uint256 tokensToDisable)
{
_execute(callData); // U:[TV-6,7,8]
tokensToEnable = assetMask;
tokensToDisable = disableShares ? sharesMask : 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC4626.sol)
pragma solidity ^0.8.0;
import "../token/ERC20/IERC20.sol";
import "../token/ERC20/extensions/IERC20Metadata.sol";
/**
* @dev Interface of the ERC4626 "Tokenized Vault Standard", as defined in
* https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].
*
* _Available since v4.7._
*/
interface IERC4626 is IERC20, IERC20Metadata {
event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);
event Withdraw(
address indexed sender,
address indexed receiver,
address indexed owner,
uint256 assets,
uint256 shares
);
/**
* @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.
*
* - MUST be an ERC-20 token contract.
* - MUST NOT revert.
*/
function asset() external view returns (address assetTokenAddress);
/**
* @dev Returns the total amount of the underlying asset that is “managed” by Vault.
*
* - SHOULD include any compounding that occurs from yield.
* - MUST be inclusive of any fees that are charged against assets in the Vault.
* - MUST NOT revert.
*/
function totalAssets() external view returns (uint256 totalManagedAssets);
/**
* @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal
* scenario where all the conditions are met.
*
* - MUST NOT be inclusive of any fees that are charged against assets in the Vault.
* - MUST NOT show any variations depending on the caller.
* - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.
* - MUST NOT revert.
*
* NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the
* “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and
* from.
*/
function convertToShares(uint256 assets) external view returns (uint256 shares);
/**
* @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal
* scenario where all the conditions are met.
*
* - MUST NOT be inclusive of any fees that are charged against assets in the Vault.
* - MUST NOT show any variations depending on the caller.
* - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.
* - MUST NOT revert.
*
* NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the
* “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and
* from.
*/
function convertToAssets(uint256 shares) external view returns (uint256 assets);
/**
* @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,
* through a deposit call.
*
* - MUST return a limited value if receiver is subject to some deposit limit.
* - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.
* - MUST NOT revert.
*/
function maxDeposit(address receiver) external view returns (uint256 maxAssets);
/**
* @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given
* current on-chain conditions.
*
* - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit
* call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called
* in the same transaction.
* - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the
* deposit would be accepted, regardless if the user has enough tokens approved, etc.
* - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.
* - MUST NOT revert.
*
* NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in
* share price or some other type of condition, meaning the depositor will lose assets by depositing.
*/
function previewDeposit(uint256 assets) external view returns (uint256 shares);
/**
* @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.
*
* - MUST emit the Deposit event.
* - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
* deposit execution, and are accounted for during deposit.
* - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not
* approving enough underlying tokens to the Vault contract, etc).
*
* NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.
*/
function deposit(uint256 assets, address receiver) external returns (uint256 shares);
/**
* @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.
* - MUST return a limited value if receiver is subject to some mint limit.
* - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.
* - MUST NOT revert.
*/
function maxMint(address receiver) external view returns (uint256 maxShares);
/**
* @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given
* current on-chain conditions.
*
* - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call
* in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the
* same transaction.
* - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint
* would be accepted, regardless if the user has enough tokens approved, etc.
* - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.
* - MUST NOT revert.
*
* NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in
* share price or some other type of condition, meaning the depositor will lose assets by minting.
*/
function previewMint(uint256 shares) external view returns (uint256 assets);
/**
* @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.
*
* - MUST emit the Deposit event.
* - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint
* execution, and are accounted for during mint.
* - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not
* approving enough underlying tokens to the Vault contract, etc).
*
* NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.
*/
function mint(uint256 shares, address receiver) external returns (uint256 assets);
/**
* @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the
* Vault, through a withdraw call.
*
* - MUST return a limited value if owner is subject to some withdrawal limit or timelock.
* - MUST NOT revert.
*/
function maxWithdraw(address owner) external view returns (uint256 maxAssets);
/**
* @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,
* given current on-chain conditions.
*
* - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw
* call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if
* called
* in the same transaction.
* - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though
* the withdrawal would be accepted, regardless if the user has enough shares, etc.
* - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.
* - MUST NOT revert.
*
* NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in
* share price or some other type of condition, meaning the depositor will lose assets by depositing.
*/
function previewWithdraw(uint256 assets) external view returns (uint256 shares);
/**
* @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.
*
* - MUST emit the Withdraw event.
* - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
* withdraw execution, and are accounted for during withdraw.
* - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner
* not having enough shares, etc).
*
* Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.
* Those methods should be performed separately.
*/
function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares);
/**
* @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,
* through a redeem call.
*
* - MUST return a limited value if owner is subject to some withdrawal limit or timelock.
* - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.
* - MUST NOT revert.
*/
function maxRedeem(address owner) external view returns (uint256 maxShares);
/**
* @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,
* given current on-chain conditions.
*
* - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call
* in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the
* same transaction.
* - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the
* redemption would be accepted, regardless if the user has enough shares, etc.
* - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.
* - MUST NOT revert.
*
* NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in
* share price or some other type of condition, meaning the depositor will lose assets by redeeming.
*/
function previewRedeem(uint256 shares) external view returns (uint256 assets);
/**
* @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.
*
* - MUST emit the Withdraw event.
* - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
* redeem execution, and are accounted for during redeem.
* - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner
* not having enough shares, etc).
*
* NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.
* Those methods should be performed separately.
*/
function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets);
}// SPDX-License-Identifier: GPL-2.0-or-later
// Gearbox Protocol. Generalized leverage for DeFi protocols
// (c) Gearbox Foundation, 2023.
pragma solidity ^0.8.17;
import {IAdapter} from "@gearbox-protocol/core-v2/contracts/interfaces/IAdapter.sol";
import {ICreditManagerV3} from "@gearbox-protocol/core-v3/contracts/interfaces/ICreditManagerV3.sol";
import {CallerNotCreditFacadeException} from "@gearbox-protocol/core-v3/contracts/interfaces/IExceptions.sol";
import {ACLTrait} from "@gearbox-protocol/core-v3/contracts/traits/ACLTrait.sol";
/// @title Abstract adapter
/// @dev Inheriting adapters MUST use provided internal functions to perform all operations with credit accounts
abstract contract AbstractAdapter is IAdapter, ACLTrait {
/// @notice Credit manager the adapter is connected to
address public immutable override creditManager;
/// @notice Address provider contract
address public immutable override addressProvider;
/// @notice Address of the contract the adapter is interacting with
address public immutable override targetContract;
/// @notice Constructor
/// @param _creditManager Credit manager to connect the adapter to
/// @param _targetContract Address of the adapted contract
constructor(address _creditManager, address _targetContract)
ACLTrait(ICreditManagerV3(_creditManager).addressProvider())
nonZeroAddress(_targetContract)
{
creditManager = _creditManager;
addressProvider = ICreditManagerV3(_creditManager).addressProvider();
targetContract = _targetContract;
}
/// @dev Ensures that caller of the function is credit facade connected to the credit manager
/// @dev Inheriting adapters MUST use this modifier in all external functions that operate on credit accounts
modifier creditFacadeOnly() {
_revertIfCallerNotCreditFacade();
_;
}
/// @dev Ensures that caller is credit facade connected to the credit manager
function _revertIfCallerNotCreditFacade() internal view {
if (msg.sender != ICreditManagerV3(creditManager).creditFacade()) {
revert CallerNotCreditFacadeException();
}
}
/// @dev Ensures that active credit account is set and returns its address
function _creditAccount() internal view returns (address) {
return ICreditManagerV3(creditManager).getActiveCreditAccountOrRevert();
}
/// @dev Ensures that token is registered as collateral in the credit manager and returns its mask
function _getMaskOrRevert(address token) internal view returns (uint256 tokenMask) {
tokenMask = ICreditManagerV3(creditManager).getTokenMaskOrRevert(token);
}
/// @dev Approves target contract to spend given token from the active credit account
/// Reverts if active credit account is not set or token is not registered as collateral
/// @param token Token to approve
/// @param amount Amount to approve
function _approveToken(address token, uint256 amount) internal {
ICreditManagerV3(creditManager).approveCreditAccount(token, amount);
}
/// @dev Executes an external call from the active credit account to the target contract
/// Reverts if active credit account is not set
/// @param callData Data to call the target contract with
/// @return result Call result
function _execute(bytes memory callData) internal returns (bytes memory result) {
return ICreditManagerV3(creditManager).execute(callData);
}
/// @dev Executes a swap operation without input token approval
/// Reverts if active credit account is not set or any of passed tokens is not registered as collateral
/// @param tokenIn Input token that credit account spends in the call
/// @param tokenOut Output token that credit account receives after the call
/// @param callData Data to call the target contract with
/// @param disableTokenIn Whether `tokenIn` should be disabled after the call
/// (for operations that spend the entire account's balance of the input token)
/// @return tokensToEnable Bit mask of tokens that should be enabled after the call
/// @return tokensToDisable Bit mask of tokens that should be disabled after the call
/// @return result Call result
function _executeSwapNoApprove(address tokenIn, address tokenOut, bytes memory callData, bool disableTokenIn)
internal
returns (uint256 tokensToEnable, uint256 tokensToDisable, bytes memory result)
{
tokensToEnable = _getMaskOrRevert(tokenOut);
uint256 tokenInMask = _getMaskOrRevert(tokenIn);
if (disableTokenIn) tokensToDisable = tokenInMask;
result = _execute(callData);
}
/// @dev Executes a swap operation with maximum input token approval, and revokes approval after the call
/// Reverts if active credit account is not set or any of passed tokens is not registered as collateral
/// @param tokenIn Input token that credit account spends in the call
/// @param tokenOut Output token that credit account receives after the call
/// @param callData Data to call the target contract with
/// @param disableTokenIn Whether `tokenIn` should be disabled after the call
/// (for operations that spend the entire account's balance of the input token)
/// @return tokensToEnable Bit mask of tokens that should be enabled after the call
/// @return tokensToDisable Bit mask of tokens that should be disabled after the call
/// @return result Call result
/// @custom:expects Credit manager reverts when trying to approve non-collateral token
function _executeSwapSafeApprove(address tokenIn, address tokenOut, bytes memory callData, bool disableTokenIn)
internal
returns (uint256 tokensToEnable, uint256 tokensToDisable, bytes memory result)
{
tokensToEnable = _getMaskOrRevert(tokenOut);
if (disableTokenIn) tokensToDisable = _getMaskOrRevert(tokenIn);
_approveToken(tokenIn, type(uint256).max);
result = _execute(callData);
_approveToken(tokenIn, 1);
}
}// SPDX-License-Identifier: UNLICENSED
// Gearbox. Generalized leverage protocol that allows to take leverage and then use it across other DeFi protocols and platforms in a composable way.
// (c) Gearbox Foundation, 2023
pragma solidity ^0.8.17;
enum AdapterType {
ABSTRACT,
UNISWAP_V2_ROUTER,
UNISWAP_V3_ROUTER,
CURVE_V1_EXCHANGE_ONLY,
YEARN_V2,
CURVE_V1_2ASSETS,
CURVE_V1_3ASSETS,
CURVE_V1_4ASSETS,
CURVE_V1_STECRV_POOL,
CURVE_V1_WRAPPER,
CONVEX_V1_BASE_REWARD_POOL,
CONVEX_V1_BOOSTER,
CONVEX_V1_CLAIM_ZAP,
LIDO_V1,
UNIVERSAL,
LIDO_WSTETH_V1,
BALANCER_VAULT,
AAVE_V2_LENDING_POOL,
AAVE_V2_WRAPPED_ATOKEN,
COMPOUND_V2_CERC20,
COMPOUND_V2_CETHER,
ERC4626_VAULT,
VELODROME_V2_ROUTER,
CURVE_STABLE_NG,
CAMELOT_V3_ROUTER
}// SPDX-License-Identifier: MIT
// Gearbox Protocol. Generalized leverage for DeFi protocols
// (c) Gearbox Foundation, 2023.
pragma solidity ^0.8.17;
import {IAdapter} from "@gearbox-protocol/core-v2/contracts/interfaces/IAdapter.sol";
interface IERC4626Adapter is IAdapter {
function asset() external view returns (address);
function assetMask() external view returns (uint256);
function sharesMask() external view returns (uint256);
function deposit(uint256 assets, address) external returns (uint256 tokensToEnable, uint256 tokensToDisable);
function depositDiff(uint256 leftoverAmount) external returns (uint256 tokensToEnable, uint256 tokensToDisable);
function mint(uint256 shares, address) external returns (uint256 tokensToEnable, uint256 tokensToDisable);
function withdraw(uint256 assets, address, address)
external
returns (uint256 tokensToEnable, uint256 tokensToDisable);
function redeem(uint256 shares, address, address)
external
returns (uint256 tokensToEnable, uint256 tokensToDisable);
function redeemDiff(uint256 leftoverAmount) external returns (uint256 tokensToEnable, uint256 tokensToDisable);
}// 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
// Gearbox Protocol. Generalized leverage for DeFi protocols
// (c) Gearbox Foundation, 2023.
pragma solidity ^0.8.0;
import { AdapterType } from "@gearbox-protocol/sdk-gov/contracts/AdapterType.sol";
/// @title Adapter interface
interface IAdapter {
function _gearboxAdapterType() external view returns (AdapterType);
function _gearboxAdapterVersion() external view returns (uint16);
function creditManager() external view returns (address);
function addressProvider() external view returns (address);
function targetContract() external view returns (address);
}// SPDX-License-Identifier: MIT
// Gearbox Protocol. Generalized leverage for DeFi protocols
// (c) Gearbox Foundation, 2023.
pragma solidity ^0.8.17;
import {IVersion} from "@gearbox-protocol/core-v2/contracts/interfaces/IVersion.sol";
uint8 constant BOT_PERMISSIONS_SET_FLAG = 1;
uint8 constant DEFAULT_MAX_ENABLED_TOKENS = 4;
address constant INACTIVE_CREDIT_ACCOUNT_ADDRESS = address(1);
/// @notice Debt management type
/// - `INCREASE_DEBT` borrows additional funds from the pool, updates account's debt and cumulative interest index
/// - `DECREASE_DEBT` repays debt components (quota interest and fees -> base interest and fees -> debt principal)
/// and updates all corresponding state varibles (base interest index, quota interest and fees, debt).
/// When repaying all the debt, ensures that account has no enabled quotas.
enum ManageDebtAction {
INCREASE_DEBT,
DECREASE_DEBT
}
/// @notice Collateral/debt calculation mode
/// - `GENERIC_PARAMS` returns generic data like account debt and cumulative indexes
/// - `DEBT_ONLY` is same as `GENERIC_PARAMS` but includes more detailed debt info, like accrued base/quota
/// interest and fees
/// - `FULL_COLLATERAL_CHECK_LAZY` checks whether account is sufficiently collateralized in a lazy fashion,
/// i.e. it stops iterating over collateral tokens once TWV reaches the desired target.
/// Since it may return underestimated TWV, it's only available for internal use.
/// - `DEBT_COLLATERAL` is same as `DEBT_ONLY` but also returns total value and total LT-weighted value of
/// account's tokens, this mode is used during account liquidation
/// - `DEBT_COLLATERAL_SAFE_PRICES` is same as `DEBT_COLLATERAL` but uses safe prices from price oracle
enum CollateralCalcTask {
GENERIC_PARAMS,
DEBT_ONLY,
FULL_COLLATERAL_CHECK_LAZY,
DEBT_COLLATERAL,
DEBT_COLLATERAL_SAFE_PRICES
}
struct CreditAccountInfo {
uint256 debt;
uint256 cumulativeIndexLastUpdate;
uint128 cumulativeQuotaInterest;
uint128 quotaFees;
uint256 enabledTokensMask;
uint16 flags;
uint64 lastDebtUpdate;
address borrower;
}
struct CollateralDebtData {
uint256 debt;
uint256 cumulativeIndexNow;
uint256 cumulativeIndexLastUpdate;
uint128 cumulativeQuotaInterest;
uint256 accruedInterest;
uint256 accruedFees;
uint256 totalDebtUSD;
uint256 totalValue;
uint256 totalValueUSD;
uint256 twvUSD;
uint256 enabledTokensMask;
uint256 quotedTokensMask;
address[] quotedTokens;
address _poolQuotaKeeper;
}
struct CollateralTokenData {
address token;
uint16 ltInitial;
uint16 ltFinal;
uint40 timestampRampStart;
uint24 rampDuration;
}
struct RevocationPair {
address spender;
address token;
}
interface ICreditManagerV3Events {
/// @notice Emitted when new credit configurator is set
event SetCreditConfigurator(address indexed newConfigurator);
}
/// @title Credit manager V3 interface
interface ICreditManagerV3 is IVersion, ICreditManagerV3Events {
function pool() external view returns (address);
function underlying() external view returns (address);
function creditFacade() external view returns (address);
function creditConfigurator() external view returns (address);
function addressProvider() external view returns (address);
function accountFactory() external view returns (address);
function name() external view returns (string memory);
// ------------------ //
// ACCOUNT MANAGEMENT //
// ------------------ //
function openCreditAccount(address onBehalfOf) external returns (address);
function closeCreditAccount(address creditAccount) external;
function liquidateCreditAccount(
address creditAccount,
CollateralDebtData calldata collateralDebtData,
address to,
bool isExpired
) external returns (uint256 remainingFunds, uint256 loss);
function manageDebt(address creditAccount, uint256 amount, uint256 enabledTokensMask, ManageDebtAction action)
external
returns (uint256 newDebt, uint256 tokensToEnable, uint256 tokensToDisable);
function addCollateral(address payer, address creditAccount, address token, uint256 amount)
external
returns (uint256 tokensToEnable);
function withdrawCollateral(address creditAccount, address token, uint256 amount, address to)
external
returns (uint256 tokensToDisable);
function externalCall(address creditAccount, address target, bytes calldata callData)
external
returns (bytes memory result);
function approveToken(address creditAccount, address token, address spender, uint256 amount) external;
function revokeAdapterAllowances(address creditAccount, RevocationPair[] calldata revocations) external;
// -------- //
// ADAPTERS //
// -------- //
function adapterToContract(address adapter) external view returns (address targetContract);
function contractToAdapter(address targetContract) external view returns (address adapter);
function execute(bytes calldata data) external returns (bytes memory result);
function approveCreditAccount(address token, uint256 amount) external;
function setActiveCreditAccount(address creditAccount) external;
function getActiveCreditAccountOrRevert() external view returns (address creditAccount);
// ----------------- //
// COLLATERAL CHECKS //
// ----------------- //
function priceOracle() external view returns (address);
function fullCollateralCheck(
address creditAccount,
uint256 enabledTokensMask,
uint256[] calldata collateralHints,
uint16 minHealthFactor,
bool useSafePrices
) external returns (uint256 enabledTokensMaskAfter);
function isLiquidatable(address creditAccount, uint16 minHealthFactor) external view returns (bool);
function calcDebtAndCollateral(address creditAccount, CollateralCalcTask task)
external
view
returns (CollateralDebtData memory cdd);
// ------ //
// QUOTAS //
// ------ //
function poolQuotaKeeper() external view returns (address);
function quotedTokensMask() external view returns (uint256);
function updateQuota(address creditAccount, address token, int96 quotaChange, uint96 minQuota, uint96 maxQuota)
external
returns (uint256 tokensToEnable, uint256 tokensToDisable);
// --------------------- //
// CREDIT MANAGER PARAMS //
// --------------------- //
function maxEnabledTokens() external view returns (uint8);
function fees()
external
view
returns (
uint16 feeInterest,
uint16 feeLiquidation,
uint16 liquidationDiscount,
uint16 feeLiquidationExpired,
uint16 liquidationDiscountExpired
);
function collateralTokensCount() external view returns (uint8);
function getTokenMaskOrRevert(address token) external view returns (uint256 tokenMask);
function getTokenByMask(uint256 tokenMask) external view returns (address token);
function liquidationThresholds(address token) external view returns (uint16 lt);
function ltParams(address token)
external
view
returns (uint16 ltInitial, uint16 ltFinal, uint40 timestampRampStart, uint24 rampDuration);
function collateralTokenByMask(uint256 tokenMask)
external
view
returns (address token, uint16 liquidationThreshold);
// ------------ //
// ACCOUNT INFO //
// ------------ //
function creditAccountInfo(address creditAccount)
external
view
returns (
uint256 debt,
uint256 cumulativeIndexLastUpdate,
uint128 cumulativeQuotaInterest,
uint128 quotaFees,
uint256 enabledTokensMask,
uint16 flags,
uint64 lastDebtUpdate,
address borrower
);
function getBorrowerOrRevert(address creditAccount) external view returns (address borrower);
function flagsOf(address creditAccount) external view returns (uint16);
function setFlagFor(address creditAccount, uint16 flag, bool value) external;
function enabledTokensMaskOf(address creditAccount) external view returns (uint256);
function creditAccounts() external view returns (address[] memory);
function creditAccounts(uint256 offset, uint256 limit) external view returns (address[] memory);
function creditAccountsLen() external view returns (uint256);
// ------------- //
// CONFIGURATION //
// ------------- //
function addToken(address token) external;
function setCollateralTokenData(
address token,
uint16 ltInitial,
uint16 ltFinal,
uint40 timestampRampStart,
uint24 rampDuration
) external;
function setFees(
uint16 feeInterest,
uint16 feeLiquidation,
uint16 liquidationDiscount,
uint16 feeLiquidationExpired,
uint16 liquidationDiscountExpired
) external;
function setQuotedMask(uint256 quotedTokensMask) external;
function setMaxEnabledTokens(uint8 maxEnabledTokens) external;
function setContractAllowance(address adapter, address targetContract) external;
function setCreditFacade(address creditFacade) external;
function setPriceOracle(address priceOracle) external;
function setCreditConfigurator(address creditConfigurator) external;
}// SPDX-License-Identifier: MIT // Gearbox Protocol. Generalized leverage for DeFi protocols // (c) Gearbox Foundation, 2023. pragma solidity ^0.8.17; // ------- // // GENERAL // // ------- // /// @notice Thrown on attempting to set an important address to zero address error ZeroAddressException(); /// @notice Thrown when attempting to pass a zero amount to a funding-related operation error AmountCantBeZeroException(); /// @notice Thrown on incorrect input parameter error IncorrectParameterException(); /// @notice Thrown when balance is insufficient to perform an operation error InsufficientBalanceException(); /// @notice Thrown if parameter is out of range error ValueOutOfRangeException(); /// @notice Thrown when trying to send ETH to a contract that is not allowed to receive ETH directly error ReceiveIsNotAllowedException(); /// @notice Thrown on attempting to set an EOA as an important contract in the system error AddressIsNotContractException(address); /// @notice Thrown on attempting to receive a token that is not a collateral token or was forbidden error TokenNotAllowedException(); /// @notice Thrown on attempting to add a token that is already in a collateral list error TokenAlreadyAddedException(); /// @notice Thrown when attempting to use quota-related logic for a token that is not quoted in quota keeper error TokenIsNotQuotedException(); /// @notice Thrown on attempting to interact with an address that is not a valid target contract error TargetContractNotAllowedException(); /// @notice Thrown if function is not implemented error NotImplementedException(); // ------------------ // // CONTRACTS REGISTER // // ------------------ // /// @notice Thrown when an address is expected to be a registered credit manager, but is not error RegisteredCreditManagerOnlyException(); /// @notice Thrown when an address is expected to be a registered pool, but is not error RegisteredPoolOnlyException(); // ---------------- // // ADDRESS PROVIDER // // ---------------- // /// @notice Reverts if address key isn't found in address provider error AddressNotFoundException(); // ----------------- // // POOL, PQK, GAUGES // // ----------------- // /// @notice Thrown by pool-adjacent contracts when a credit manager being connected has a wrong pool address error IncompatibleCreditManagerException(); /// @notice Thrown when attempting to set an incompatible successor staking contract error IncompatibleSuccessorException(); /// @notice Thrown when attempting to vote in a non-approved contract error VotingContractNotAllowedException(); /// @notice Thrown when attempting to unvote more votes than there are error InsufficientVotesException(); /// @notice Thrown when attempting to borrow more than the second point on a two-point curve error BorrowingMoreThanU2ForbiddenException(); /// @notice Thrown when a credit manager attempts to borrow more than its limit in the current block, or in general error CreditManagerCantBorrowException(); /// @notice Thrown when attempting to connect a quota keeper to an incompatible pool error IncompatiblePoolQuotaKeeperException(); /// @notice Thrown when the quota is outside of min/max bounds error QuotaIsOutOfBoundsException(); // -------------- // // CREDIT MANAGER // // -------------- // /// @notice Thrown on failing a full collateral check after multicall error NotEnoughCollateralException(); /// @notice Thrown if an attempt to approve a collateral token to adapter's target contract fails error AllowanceFailedException(); /// @notice Thrown on attempting to perform an action for a credit account that does not exist error CreditAccountDoesNotExistException(); /// @notice Thrown on configurator attempting to add more than 255 collateral tokens error TooManyTokensException(); /// @notice Thrown if more than the maximum number of tokens were enabled on a credit account error TooManyEnabledTokensException(); /// @notice Thrown when attempting to execute a protocol interaction without active credit account set error ActiveCreditAccountNotSetException(); /// @notice Thrown when trying to update credit account's debt more than once in the same block error DebtUpdatedTwiceInOneBlockException(); /// @notice Thrown when trying to repay all debt while having active quotas error DebtToZeroWithActiveQuotasException(); /// @notice Thrown when a zero-debt account attempts to update quota error UpdateQuotaOnZeroDebtAccountException(); /// @notice Thrown when attempting to close an account with non-zero debt error CloseAccountWithNonZeroDebtException(); /// @notice Thrown when value of funds remaining on the account after liquidation is insufficient error InsufficientRemainingFundsException(); /// @notice Thrown when Credit Facade tries to write over a non-zero active Credit Account error ActiveCreditAccountOverridenException(); // ------------------- // // CREDIT CONFIGURATOR // // ------------------- // /// @notice Thrown on attempting to use a non-ERC20 contract or an EOA as a token error IncorrectTokenContractException(); /// @notice Thrown if the newly set LT if zero or greater than the underlying's LT error IncorrectLiquidationThresholdException(); /// @notice Thrown if borrowing limits are incorrect: minLimit > maxLimit or maxLimit > blockLimit error IncorrectLimitsException(); /// @notice Thrown if the new expiration date is less than the current expiration date or current timestamp error IncorrectExpirationDateException(); /// @notice Thrown if a contract returns a wrong credit manager or reverts when trying to retrieve it error IncompatibleContractException(); /// @notice Thrown if attempting to forbid an adapter that is not registered in the credit manager error AdapterIsNotRegisteredException(); // ------------- // // CREDIT FACADE // // ------------- // /// @notice Thrown when attempting to perform an action that is forbidden in whitelisted mode error ForbiddenInWhitelistedModeException(); /// @notice Thrown if credit facade is not expirable, and attempted aciton requires expirability error NotAllowedWhenNotExpirableException(); /// @notice Thrown if a selector that doesn't match any allowed function is passed to the credit facade in a multicall error UnknownMethodException(); /// @notice Thrown when trying to close an account with enabled tokens error CloseAccountWithEnabledTokensException(); /// @notice Thrown if a liquidator tries to liquidate an account with a health factor above 1 error CreditAccountNotLiquidatableException(); /// @notice Thrown if too much new debt was taken within a single block error BorrowedBlockLimitException(); /// @notice Thrown if the new debt principal for a credit account falls outside of borrowing limits error BorrowAmountOutOfLimitsException(); /// @notice Thrown if a user attempts to open an account via an expired credit facade error NotAllowedAfterExpirationException(); /// @notice Thrown if expected balances are attempted to be set twice without performing a slippage check error ExpectedBalancesAlreadySetException(); /// @notice Thrown if attempting to perform a slippage check when excepted balances are not set error ExpectedBalancesNotSetException(); /// @notice Thrown if balance of at least one token is less than expected during a slippage check error BalanceLessThanExpectedException(); /// @notice Thrown when trying to perform an action that is forbidden when credit account has enabled forbidden tokens error ForbiddenTokensException(); /// @notice Thrown when new forbidden tokens are enabled during the multicall error ForbiddenTokenEnabledException(); /// @notice Thrown when enabled forbidden token balance is increased during the multicall error ForbiddenTokenBalanceIncreasedException(); /// @notice Thrown when the remaining token balance is increased during the liquidation error RemainingTokenBalanceIncreasedException(); /// @notice Thrown if `botMulticall` is called by an address that is not approved by account owner or is forbidden error NotApprovedBotException(); /// @notice Thrown when attempting to perform a multicall action with no permission for it error NoPermissionException(uint256 permission); /// @notice Thrown when attempting to give a bot unexpected permissions error UnexpectedPermissionsException(); /// @notice Thrown when a custom HF parameter lower than 10000 is passed into the full collateral check error CustomHealthFactorTooLowException(); /// @notice Thrown when submitted collateral hint is not a valid token mask error InvalidCollateralHintException(); // ------ // // ACCESS // // ------ // /// @notice Thrown on attempting to call an access restricted function not as credit account owner error CallerNotCreditAccountOwnerException(); /// @notice Thrown on attempting to call an access restricted function not as configurator error CallerNotConfiguratorException(); /// @notice Thrown on attempting to call an access-restructed function not as account factory error CallerNotAccountFactoryException(); /// @notice Thrown on attempting to call an access restricted function not as credit manager error CallerNotCreditManagerException(); /// @notice Thrown on attempting to call an access restricted function not as credit facade error CallerNotCreditFacadeException(); /// @notice Thrown on attempting to call an access restricted function not as controller or configurator error CallerNotControllerException(); /// @notice Thrown on attempting to pause a contract without pausable admin rights error CallerNotPausableAdminException(); /// @notice Thrown on attempting to unpause a contract without unpausable admin rights error CallerNotUnpausableAdminException(); /// @notice Thrown on attempting to call an access restricted function not as gauge error CallerNotGaugeException(); /// @notice Thrown on attempting to call an access restricted function not as quota keeper error CallerNotPoolQuotaKeeperException(); /// @notice Thrown on attempting to call an access restricted function not as voter error CallerNotVoterException(); /// @notice Thrown on attempting to call an access restricted function not as allowed adapter error CallerNotAdapterException(); /// @notice Thrown on attempting to call an access restricted function not as migrator error CallerNotMigratorException(); /// @notice Thrown when an address that is not the designated executor attempts to execute a transaction error CallerNotExecutorException(); /// @notice Thrown on attempting to call an access restricted function not as veto admin error CallerNotVetoAdminException(); // ------------------- // // CONTROLLER TIMELOCK // // ------------------- // /// @notice Thrown when the new parameter values do not satisfy required conditions error ParameterChecksFailedException(); /// @notice Thrown when attempting to execute a non-queued transaction error TxNotQueuedException(); /// @notice Thrown when attempting to execute a transaction that is either immature or stale error TxExecutedOutsideTimeWindowException(); /// @notice Thrown when execution of a transaction fails error TxExecutionRevertedException(); /// @notice Thrown when the value of a parameter on execution is different from the value on queue error ParameterChangedAfterQueuedTxException(); // -------- // // BOT LIST // // -------- // /// @notice Thrown when attempting to set non-zero permissions for a forbidden or special bot error InvalidBotException(); // --------------- // // ACCOUNT FACTORY // // --------------- // /// @notice Thrown when trying to deploy second master credit account for a credit manager error MasterCreditAccountAlreadyDeployedException(); /// @notice Thrown when trying to rescue funds from a credit account that is currently in use error CreditAccountIsInUseException(); // ------------ // // PRICE ORACLE // // ------------ // /// @notice Thrown on attempting to set a token price feed to an address that is not a correct price feed error IncorrectPriceFeedException(); /// @notice Thrown on attempting to interact with a price feed for a token not added to the price oracle error PriceFeedDoesNotExistException(); /// @notice Thrown when price feed returns incorrect price for a token error IncorrectPriceException(); /// @notice Thrown when token's price feed becomes stale error StalePriceException();
// SPDX-License-Identifier: BUSL-1.1
// Gearbox Protocol. Generalized leverage for DeFi protocols
// (c) Gearbox Foundation, 2023.
pragma solidity ^0.8.17;
import {IACL} from "@gearbox-protocol/core-v2/contracts/interfaces/IACL.sol";
import {AP_ACL, IAddressProviderV3, NO_VERSION_CONTROL} from "../interfaces/IAddressProviderV3.sol";
import {CallerNotConfiguratorException} from "../interfaces/IExceptions.sol";
import {SanityCheckTrait} from "./SanityCheckTrait.sol";
/// @title ACL trait
/// @notice Utility class for ACL (access-control list) consumers
abstract contract ACLTrait is SanityCheckTrait {
/// @notice ACL contract address
address public immutable acl;
/// @notice Constructor
/// @param addressProvider Address provider contract address
constructor(address addressProvider) nonZeroAddress(addressProvider) {
acl = IAddressProviderV3(addressProvider).getAddressOrRevert(AP_ACL, NO_VERSION_CONTROL);
}
/// @dev Ensures that function caller has configurator role
modifier configuratorOnly() {
_ensureCallerIsConfigurator();
_;
}
/// @dev Reverts if the caller is not the configurator
/// @dev Used to cut contract size on modifiers
function _ensureCallerIsConfigurator() internal view {
if (!_isConfigurator({account: msg.sender})) {
revert CallerNotConfiguratorException();
}
}
/// @dev Checks whether given account has configurator role
function _isConfigurator(address account) internal view returns (bool) {
return IACL(acl).isConfigurator(account);
}
}// SPDX-License-Identifier: MIT
// Gearbox Protocol. Generalized leverage for DeFi protocols
// (c) Gearbox Holdings, 2022
pragma solidity ^0.8.10;
/// @title Version interface
/// @notice Defines contract version
interface IVersion {
/// @notice Contract version
function version() external view returns (uint256);
}// SPDX-License-Identifier: MIT
// Gearbox Protocol. Generalized leverage for DeFi protocols
// (c) Gearbox Holdings, 2022
pragma solidity ^0.8.10;
import { IVersion } from "./IVersion.sol";
interface IACLExceptions {
/// @dev Thrown when attempting to delete an address from a set that is not a pausable admin
error AddressNotPausableAdminException(address addr);
/// @dev Thrown when attempting to delete an address from a set that is not a unpausable admin
error AddressNotUnpausableAdminException(address addr);
}
interface IACLEvents {
/// @dev Emits when a new admin is added that can pause contracts
event PausableAdminAdded(address indexed newAdmin);
/// @dev Emits when a Pausable admin is removed
event PausableAdminRemoved(address indexed admin);
/// @dev Emits when a new admin is added that can unpause contracts
event UnpausableAdminAdded(address indexed newAdmin);
/// @dev Emits when an Unpausable admin is removed
event UnpausableAdminRemoved(address indexed admin);
}
/// @title ACL interface
interface IACL is IACLEvents, IACLExceptions, IVersion {
/// @dev Returns true if the address is a pausable admin and false if not
/// @param addr Address to check
function isPausableAdmin(address addr) external view returns (bool);
/// @dev Returns true if the address is unpausable admin and false if not
/// @param addr Address to check
function isUnpausableAdmin(address addr) external view returns (bool);
/// @dev Returns true if an address has configurator rights
/// @param account Address to check
function isConfigurator(address account) external view returns (bool);
/// @dev Returns address of configurator
function owner() external view returns (address);
}// SPDX-License-Identifier: MIT
// Gearbox Protocol. Generalized leverage for DeFi protocols
// (c) Gearbox Foundation, 2023.
pragma solidity ^0.8.17;
import {IVersion} from "@gearbox-protocol/core-v2/contracts/interfaces/IVersion.sol";
uint256 constant NO_VERSION_CONTROL = 0;
bytes32 constant AP_CONTRACTS_REGISTER = "CONTRACTS_REGISTER";
bytes32 constant AP_ACL = "ACL";
bytes32 constant AP_PRICE_ORACLE = "PRICE_ORACLE";
bytes32 constant AP_ACCOUNT_FACTORY = "ACCOUNT_FACTORY";
bytes32 constant AP_DATA_COMPRESSOR = "DATA_COMPRESSOR";
bytes32 constant AP_TREASURY = "TREASURY";
bytes32 constant AP_GEAR_TOKEN = "GEAR_TOKEN";
bytes32 constant AP_WETH_TOKEN = "WETH_TOKEN";
bytes32 constant AP_WETH_GATEWAY = "WETH_GATEWAY";
bytes32 constant AP_ROUTER = "ROUTER";
bytes32 constant AP_BOT_LIST = "BOT_LIST";
bytes32 constant AP_GEAR_STAKING = "GEAR_STAKING";
bytes32 constant AP_ZAPPER_REGISTER = "ZAPPER_REGISTER";
interface IAddressProviderV3Events {
/// @notice Emitted when an address is set for a contract key
event SetAddress(bytes32 indexed key, address indexed value, uint256 indexed version);
}
/// @title Address provider V3 interface
interface IAddressProviderV3 is IAddressProviderV3Events, IVersion {
function addresses(bytes32 key, uint256 _version) external view returns (address);
function getAddressOrRevert(bytes32 key, uint256 _version) external view returns (address result);
function setAddress(bytes32 key, address value, bool saveVersion) external;
}// SPDX-License-Identifier: BUSL-1.1
// Gearbox Protocol. Generalized leverage for DeFi protocols
// (c) Gearbox Foundation, 2023.
pragma solidity ^0.8.17;
import {ZeroAddressException} from "../interfaces/IExceptions.sol";
/// @title Sanity check trait
abstract contract SanityCheckTrait {
/// @dev Ensures that passed address is non-zero
modifier nonZeroAddress(address addr) {
_revertIfZeroAddress(addr);
_;
}
/// @dev Reverts if address is zero
function _revertIfZeroAddress(address addr) private pure {
if (addr == address(0)) revert ZeroAddressException();
}
}{
"remappings": [
"@1inch/=node_modules/@1inch/",
"@arbitrum/=node_modules/@arbitrum/",
"@chainlink/=node_modules/@chainlink/",
"@eth-optimism/=node_modules/@eth-optimism/",
"@gearbox-protocol/=node_modules/@gearbox-protocol/",
"@openzeppelin/=node_modules/@openzeppelin/",
"@redstone-finance/=node_modules/@redstone-finance/",
"ds-test/=lib/forge-std/lib/ds-test/src/",
"eth-gas-reporter/=node_modules/eth-gas-reporter/",
"forge-std/=lib/forge-std/src/"
],
"optimizer": {
"enabled": true,
"runs": 1000
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs"
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "london",
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_creditManager","type":"address"},{"internalType":"address","name":"_vault","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"CallerNotCreditFacadeException","type":"error"},{"inputs":[],"name":"ZeroAddressException","type":"error"},{"inputs":[],"name":"_gearboxAdapterType","outputs":[{"internalType":"enum AdapterType","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_gearboxAdapterVersion","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acl","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"addressProvider","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"asset","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"assetMask","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"creditManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"tokensToEnable","type":"uint256"},{"internalType":"uint256","name":"tokensToDisable","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"leftoverAmount","type":"uint256"}],"name":"depositDiff","outputs":[{"internalType":"uint256","name":"tokensToEnable","type":"uint256"},{"internalType":"uint256","name":"tokensToDisable","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"mint","outputs":[{"internalType":"uint256","name":"tokensToEnable","type":"uint256"},{"internalType":"uint256","name":"tokensToDisable","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"tokensToEnable","type":"uint256"},{"internalType":"uint256","name":"tokensToDisable","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"leftoverAmount","type":"uint256"}],"name":"redeemDiff","outputs":[{"internalType":"uint256","name":"tokensToEnable","type":"uint256"},{"internalType":"uint256","name":"tokensToDisable","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sharesMask","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"targetContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"tokensToEnable","type":"uint256"},{"internalType":"uint256","name":"tokensToDisable","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
6101606040523480156200001257600080fd5b506040516200114f3803806200114f83398101604081905262000035916200031d565b8181816001600160a01b0316632954018c6040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000076573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200009c919062000355565b80620000a8816200025d565b604051632bdad0e360e11b8152621050d360ea1b6004820152600060248201526001600160a01b038316906357b5a1c690604401602060405180830381865afa158015620000fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000120919062000355565b6001600160a01b0316608052508190506200013b816200025d565b6001600160a01b03831660a081905260408051630a55006360e21b81529051632954018c916004808201926020929091908290030181865afa15801562000186573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001ac919062000355565b6001600160a01b0390811660c05291821660e05250604080516338d52e0f60e01b8152905191841692506338d52e0f9160048083019260209291908290030181865afa15801562000201573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000227919062000355565b6001600160a01b0316610100819052620002419062000288565b61012052620002508162000288565b6101405250620003949050565b6001600160a01b0381166200028557604051635919af9760e11b815260040160405180910390fd5b50565b60a051604051636ae17a4360e11b81526001600160a01b038381166004830152600092169063d5c2f48690602401602060405180830381865afa158015620002d4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002fa91906200037a565b92915050565b80516001600160a01b03811681146200031857600080fd5b919050565b600080604083850312156200033157600080fd5b6200033c8362000300565b91506200034c6020840162000300565b90509250929050565b6000602082840312156200036857600080fd5b620003738262000300565b9392505050565b6000602082840312156200038d57600080fd5b5051919050565b60805160a05160c05160e051610100516101205161014051610d0c620004436000396000818161012c015281816108a3015261093b0152600081816102a5015281816108d2015261090a0152600081816101b30152818161040101528181610845015261087b01526000818161024201526103280152600061017401526000818161026901528181610602015281816106d20152818161099f0152610a32015260006102cc0152610d0c6000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c806394bf804d11610097578063c12c21c011610066578063c12c21c014610264578063ce30bbdb1461028b578063d823dcd5146102a0578063de287359146102c757600080fd5b806394bf804d14610204578063b460af9414610217578063ba0876521461022a578063bd90df701461023d57600080fd5b80632954018c116100d35780632954018c1461016f57806338d52e0f146101ae5780636e553f65146101d557806378aa73a4146101e857600080fd5b80630acb3202146100fa5780631a0a59a1146101275780631f4f702e1461015c575b600080fd5b61010d610108366004610ab4565b6102ee565b604080519283526020830191909152015b60405180910390f35b61014e7f000000000000000000000000000000000000000000000000000000000000000081565b60405190815260200161011e565b61010d61016a366004610ab4565b6103c7565b6101967f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161011e565b6101967f000000000000000000000000000000000000000000000000000000000000000081565b61010d6101e3366004610ae5565b610494565b6101f161012c81565b60405161ffff909116815260200161011e565b61010d610212366004610ae5565b6104c3565b61010d610225366004610b15565b610546565b61010d610238366004610b15565b6105dd565b6101967f000000000000000000000000000000000000000000000000000000000000000081565b6101967f000000000000000000000000000000000000000000000000000000000000000081565b610293601581565b60405161011e9190610b57565b61014e7f000000000000000000000000000000000000000000000000000000000000000081565b6101967f000000000000000000000000000000000000000000000000000000000000000081565b6000806102f9610600565b60006103036106ce565b6040516370a0823160e01b81526001600160a01b0380831660048301529192506000917f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa15801561036f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103939190610b7f565b90508481116103a9575060009485945092505050565b8490036103bb82826001881115610757565b90945092505050915091565b6000806103d2610600565b60006103dc6106ce565b6040516370a0823160e01b81526001600160a01b0380831660048301529192506000917f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015610448573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061046c9190610b7f565b9050848111610482575060009485945092505050565b8490036103bb828260018811156107cd565b60008061049f610600565b60006104a96106ce565b90506104b7818660006107cd565b90969095509350505050565b6000806104ce610600565b60006104d86106ce565b604051602481018790526001600160a01b03821660448201529091506104b79060009060640160408051601f198184030181529190526020810180516001600160e01b03167f94bf804d0000000000000000000000000000000000000000000000000000000017905261083d565b600080610551610600565b600061055b6106ce565b604051602481018890526001600160a01b0382166044820181905260648201529091506105d09060009060840160408051601f198184030181529190526020810180516001600160e01b03167fb460af94000000000000000000000000000000000000000000000000000000001790526108fb565b9097909650945050505050565b6000806105e8610600565b60006105f26106ce565b90506105d081876000610757565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316632f7a18816040518163ffffffff1660e01b8152600401602060405180830381865afa15801561065e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106829190610b98565b6001600160a01b0316336001600160a01b0316146106cc576040517f0c1d6a3f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166334878f546040518163ffffffff1660e01b8152600401602060405180830381865afa15801561072e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107529190610b98565b905090565b604051602481018390526001600160a01b03841660448201819052606482015260009081906104b790849060840160408051601f198184030181529190526020810180516001600160e01b03167fba087652000000000000000000000000000000000000000000000000000000001790526108fb565b6000806104b78385876040516024016107f99291909182526001600160a01b0316602082015260400190565b60408051601f198184030181529190526020810180516001600160e01b03167f6e553f65000000000000000000000000000000000000000000000000000000001790525b60008061086c7f0000000000000000000000000000000000000000000000000000000000000000600019610960565b610875836109ff565b506108a17f00000000000000000000000000000000000000000000000000000000000000006001610960565b7f00000000000000000000000000000000000000000000000000000000000000009150836108d05760006108f2565b7f00000000000000000000000000000000000000000000000000000000000000005b90509250929050565b600080610907836109ff565b507f00000000000000000000000000000000000000000000000000000000000000009150836109375760006108f2565b50927f000000000000000000000000000000000000000000000000000000000000000092509050565b6040517ffa30b30f0000000000000000000000000000000000000000000000000000000081526001600160a01b038381166004830152602482018390527f0000000000000000000000000000000000000000000000000000000000000000169063fa30b30f90604401600060405180830381600087803b1580156109e357600080fd5b505af11580156109f7573d6000803e3d6000fd5b505050505050565b6040517f09c5eabe0000000000000000000000000000000000000000000000000000000081526060906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906309c5eabe90610a67908590600401610be0565b6000604051808303816000875af1158015610a86573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610aae9190810190610c29565b92915050565b600060208284031215610ac657600080fd5b5035919050565b6001600160a01b0381168114610ae257600080fd5b50565b60008060408385031215610af857600080fd5b823591506020830135610b0a81610acd565b809150509250929050565b600080600060608486031215610b2a57600080fd5b833592506020840135610b3c81610acd565b91506040840135610b4c81610acd565b809150509250925092565b6020810160198310610b7957634e487b7160e01b600052602160045260246000fd5b91905290565b600060208284031215610b9157600080fd5b5051919050565b600060208284031215610baa57600080fd5b8151610bb581610acd565b9392505050565b60005b83811015610bd7578181015183820152602001610bbf565b50506000910152565b6020815260008251806020840152610bff816040850160208701610bbc565b601f01601f19169190910160400192915050565b634e487b7160e01b600052604160045260246000fd5b600060208284031215610c3b57600080fd5b815167ffffffffffffffff80821115610c5357600080fd5b818401915084601f830112610c6757600080fd5b815181811115610c7957610c79610c13565b604051601f8201601f19908116603f01168101908382118183101715610ca157610ca1610c13565b81604052828152876020848701011115610cba57600080fd5b610ccb836020830160208801610bbc565b97965050505050505056fea2646970667358221220ed979738d0e0b11cc47a5a26227695cca7eac8c268681ca02e02c8b0000a5a8d64736f6c634300081100330000000000000000000000006950f4190aa1e1339519d5d4d89796ae4165cd5c00000000000000000000000083f20f44975d03b1b09e64809b757c47f942beea
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c806394bf804d11610097578063c12c21c011610066578063c12c21c014610264578063ce30bbdb1461028b578063d823dcd5146102a0578063de287359146102c757600080fd5b806394bf804d14610204578063b460af9414610217578063ba0876521461022a578063bd90df701461023d57600080fd5b80632954018c116100d35780632954018c1461016f57806338d52e0f146101ae5780636e553f65146101d557806378aa73a4146101e857600080fd5b80630acb3202146100fa5780631a0a59a1146101275780631f4f702e1461015c575b600080fd5b61010d610108366004610ab4565b6102ee565b604080519283526020830191909152015b60405180910390f35b61014e7f000000000000000000000000000000000000000000000000000000000000002081565b60405190815260200161011e565b61010d61016a366004610ab4565b6103c7565b6101967f0000000000000000000000009ea7b04da02a5373317d745c1571c84aad03321d81565b6040516001600160a01b03909116815260200161011e565b6101967f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f81565b61010d6101e3366004610ae5565b610494565b6101f161012c81565b60405161ffff909116815260200161011e565b61010d610212366004610ae5565b6104c3565b61010d610225366004610b15565b610546565b61010d610238366004610b15565b6105dd565b6101967f00000000000000000000000083f20f44975d03b1b09e64809b757c47f942beea81565b6101967f0000000000000000000000006950f4190aa1e1339519d5d4d89796ae4165cd5c81565b610293601581565b60405161011e9190610b57565b61014e7f000000000000000000000000000000000000000000000000000000000000000481565b6101967f000000000000000000000000523da3a8961e4dd4f6206dbf7e6c749f51796bb381565b6000806102f9610600565b60006103036106ce565b6040516370a0823160e01b81526001600160a01b0380831660048301529192506000917f00000000000000000000000083f20f44975d03b1b09e64809b757c47f942beea16906370a0823190602401602060405180830381865afa15801561036f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103939190610b7f565b90508481116103a9575060009485945092505050565b8490036103bb82826001881115610757565b90945092505050915091565b6000806103d2610600565b60006103dc6106ce565b6040516370a0823160e01b81526001600160a01b0380831660048301529192506000917f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f16906370a0823190602401602060405180830381865afa158015610448573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061046c9190610b7f565b9050848111610482575060009485945092505050565b8490036103bb828260018811156107cd565b60008061049f610600565b60006104a96106ce565b90506104b7818660006107cd565b90969095509350505050565b6000806104ce610600565b60006104d86106ce565b604051602481018790526001600160a01b03821660448201529091506104b79060009060640160408051601f198184030181529190526020810180516001600160e01b03167f94bf804d0000000000000000000000000000000000000000000000000000000017905261083d565b600080610551610600565b600061055b6106ce565b604051602481018890526001600160a01b0382166044820181905260648201529091506105d09060009060840160408051601f198184030181529190526020810180516001600160e01b03167fb460af94000000000000000000000000000000000000000000000000000000001790526108fb565b9097909650945050505050565b6000806105e8610600565b60006105f26106ce565b90506105d081876000610757565b7f0000000000000000000000006950f4190aa1e1339519d5d4d89796ae4165cd5c6001600160a01b0316632f7a18816040518163ffffffff1660e01b8152600401602060405180830381865afa15801561065e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106829190610b98565b6001600160a01b0316336001600160a01b0316146106cc576040517f0c1d6a3f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b60007f0000000000000000000000006950f4190aa1e1339519d5d4d89796ae4165cd5c6001600160a01b03166334878f546040518163ffffffff1660e01b8152600401602060405180830381865afa15801561072e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107529190610b98565b905090565b604051602481018390526001600160a01b03841660448201819052606482015260009081906104b790849060840160408051601f198184030181529190526020810180516001600160e01b03167fba087652000000000000000000000000000000000000000000000000000000001790526108fb565b6000806104b78385876040516024016107f99291909182526001600160a01b0316602082015260400190565b60408051601f198184030181529190526020810180516001600160e01b03167f6e553f65000000000000000000000000000000000000000000000000000000001790525b60008061086c7f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f600019610960565b610875836109ff565b506108a17f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f6001610960565b7f00000000000000000000000000000000000000000000000000000000000000209150836108d05760006108f2565b7f00000000000000000000000000000000000000000000000000000000000000045b90509250929050565b600080610907836109ff565b507f00000000000000000000000000000000000000000000000000000000000000049150836109375760006108f2565b50927f000000000000000000000000000000000000000000000000000000000000002092509050565b6040517ffa30b30f0000000000000000000000000000000000000000000000000000000081526001600160a01b038381166004830152602482018390527f0000000000000000000000006950f4190aa1e1339519d5d4d89796ae4165cd5c169063fa30b30f90604401600060405180830381600087803b1580156109e357600080fd5b505af11580156109f7573d6000803e3d6000fd5b505050505050565b6040517f09c5eabe0000000000000000000000000000000000000000000000000000000081526060906001600160a01b037f0000000000000000000000006950f4190aa1e1339519d5d4d89796ae4165cd5c16906309c5eabe90610a67908590600401610be0565b6000604051808303816000875af1158015610a86573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610aae9190810190610c29565b92915050565b600060208284031215610ac657600080fd5b5035919050565b6001600160a01b0381168114610ae257600080fd5b50565b60008060408385031215610af857600080fd5b823591506020830135610b0a81610acd565b809150509250929050565b600080600060608486031215610b2a57600080fd5b833592506020840135610b3c81610acd565b91506040840135610b4c81610acd565b809150509250925092565b6020810160198310610b7957634e487b7160e01b600052602160045260246000fd5b91905290565b600060208284031215610b9157600080fd5b5051919050565b600060208284031215610baa57600080fd5b8151610bb581610acd565b9392505050565b60005b83811015610bd7578181015183820152602001610bbf565b50506000910152565b6020815260008251806020840152610bff816040850160208701610bbc565b601f01601f19169190910160400192915050565b634e487b7160e01b600052604160045260246000fd5b600060208284031215610c3b57600080fd5b815167ffffffffffffffff80821115610c5357600080fd5b818401915084601f830112610c6757600080fd5b815181811115610c7957610c79610c13565b604051601f8201601f19908116603f01168101908382118183101715610ca157610ca1610c13565b81604052828152876020848701011115610cba57600080fd5b610ccb836020830160208801610bbc565b97965050505050505056fea2646970667358221220ed979738d0e0b11cc47a5a26227695cca7eac8c268681ca02e02c8b0000a5a8d64736f6c63430008110033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000006950f4190aa1e1339519d5d4d89796ae4165cd5c00000000000000000000000083f20f44975d03b1b09e64809b757c47f942beea
-----Decoded View---------------
Arg [0] : _creditManager (address): 0x6950F4190aa1e1339519d5d4d89796ae4165CD5c
Arg [1] : _vault (address): 0x83F20F44975D03b1b09e64809B757c47f942BEeA
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000006950f4190aa1e1339519d5d4d89796ae4165cd5c
Arg [1] : 00000000000000000000000083f20f44975d03b1b09e64809b757c47f942beea
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.