Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00| Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
Latest 6 internal transactions
Advanced mode:
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 15959243 | 28 days ago | Contract Creation | 0 ETH | |||
| 8795338 | 111 days ago | Contract Creation | 0 ETH | |||
| 4666930 | 159 days ago | Contract Creation | 0 ETH | |||
| 2909974 | 179 days ago | Contract Creation | 0 ETH | |||
| 2237097 | 187 days ago | Contract Creation | 0 ETH | |||
| 2237097 | 187 days ago | Contract Creation | 0 ETH |
Cross-Chain Transactions
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
DebtAllocatorFactory
Compiler Version
v0.8.18+commit.87f61d96
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity)
/**
*Submitted for verification at KatanaScan.com on 2025-07-11
*/
// SPDX-License-Identifier: GNU AGPLv3
pragma solidity >=0.8.18 ^0.8.0;
// lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
/**
* @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);
}
// lib/openzeppelin-contracts/contracts/utils/math/Math.sol
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)
/**
* @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);
}
}
}
// lib/tokenized-strategy-periphery/src/utils/Clonable.sol
contract Clonable {
/// @notice Set to the address to auto clone from.
address public original;
/**
* @notice Clone the contracts default `original` contract.
* @return Address of the new Minimal Proxy clone.
*/
function _clone() internal virtual returns (address) {
return _clone(original);
}
/**
* @notice Clone any `_original` contract.
* @return _newContract Address of the new Minimal Proxy clone.
*/
function _clone(
address _original
) internal virtual returns (address _newContract) {
// Copied from https://github.com/optionality/clone-factory/blob/master/contracts/CloneFactory.sol
bytes20 addressBytes = bytes20(_original);
assembly {
// EIP-1167 bytecode
let clone_code := mload(0x40)
mstore(
clone_code,
0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000
)
mstore(add(clone_code, 0x14), addressBytes)
mstore(
add(clone_code, 0x28),
0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000
)
_newContract := create(0, clone_code, 0x37)
}
}
}
// lib/tokenized-strategy-periphery/src/utils/Governance.sol
contract Governance {
/// @notice Emitted when the governance address is updated.
event GovernanceTransferred(
address indexed previousGovernance,
address indexed newGovernance
);
modifier onlyGovernance() {
_checkGovernance();
_;
}
/// @notice Checks if the msg sender is the governance.
function _checkGovernance() internal view virtual {
require(governance == msg.sender, "!governance");
}
/// @notice Address that can set the default base fee and provider
address public governance;
constructor(address _governance) {
governance = _governance;
emit GovernanceTransferred(address(0), _governance);
}
/**
* @notice Sets a new address as the governance of the contract.
* @dev Throws if the caller is not current governance.
* @param _newGovernance The new governance address.
*/
function transferGovernance(
address _newGovernance
) external virtual onlyGovernance {
require(_newGovernance != address(0), "ZERO ADDRESS");
address oldGovernance = governance;
governance = _newGovernance;
emit GovernanceTransferred(oldGovernance, _newGovernance);
}
}
// lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.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);
}
// lib/openzeppelin-contracts/contracts/interfaces/IERC4626.sol
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC4626.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);
}
// lib/yearn-vaults-v3/contracts/interfaces/IVault.sol
interface IVault is IERC4626 {
// STRATEGY EVENTS
event StrategyChanged(address indexed strategy, uint256 change_type);
event StrategyReported(
address indexed strategy,
uint256 gain,
uint256 loss,
uint256 current_debt,
uint256 protocol_fees,
uint256 total_fees,
uint256 total_refunds
);
// DEBT MANAGEMENT EVENTS
event DebtUpdated(
address indexed strategy,
uint256 current_debt,
uint256 new_debt
);
// ROLE UPDATES
event RoleSet(address indexed account, uint256 role);
event UpdateRoleManager(address indexed role_manager);
event UpdateAccountant(address indexed accountant);
event UpdateDefaultQueue(address[] new_default_queue);
event UpdateUseDefaultQueue(bool use_default_queue);
event UpdatedMaxDebtForStrategy(
address indexed sender,
address indexed strategy,
uint256 new_debt
);
event UpdateAutoAllocate(bool auto_allocate);
event UpdateDepositLimit(uint256 deposit_limit);
event UpdateMinimumTotalIdle(uint256 minimum_total_idle);
event UpdateProfitMaxUnlockTime(uint256 profit_max_unlock_time);
event DebtPurchased(address indexed strategy, uint256 amount);
event Shutdown();
struct StrategyParams {
uint256 activation;
uint256 last_report;
uint256 current_debt;
uint256 max_debt;
}
function FACTORY() external view returns (uint256);
function strategies(address) external view returns (StrategyParams memory);
function default_queue(uint256) external view returns (address);
function use_default_queue() external view returns (bool);
function auto_allocate() external view returns (bool);
function minimum_total_idle() external view returns (uint256);
function deposit_limit() external view returns (uint256);
function deposit_limit_module() external view returns (address);
function withdraw_limit_module() external view returns (address);
function accountant() external view returns (address);
function roles(address) external view returns (uint256);
function role_manager() external view returns (address);
function future_role_manager() external view returns (address);
function isShutdown() external view returns (bool);
function nonces(address) external view returns (uint256);
function initialize(
address,
string memory,
string memory,
address,
uint256
) external;
function setName(string memory) external;
function setSymbol(string memory) external;
function set_accountant(address new_accountant) external;
function set_default_queue(address[] memory new_default_queue) external;
function set_use_default_queue(bool) external;
function set_auto_allocate(bool) external;
function set_deposit_limit(uint256 deposit_limit) external;
function set_deposit_limit(
uint256 deposit_limit,
bool should_override
) external;
function set_deposit_limit_module(
address new_deposit_limit_module
) external;
function set_deposit_limit_module(
address new_deposit_limit_module,
bool should_override
) external;
function set_withdraw_limit_module(
address new_withdraw_limit_module
) external;
function set_minimum_total_idle(uint256 minimum_total_idle) external;
function setProfitMaxUnlockTime(
uint256 new_profit_max_unlock_time
) external;
function set_role(address account, uint256 role) external;
function add_role(address account, uint256 role) external;
function remove_role(address account, uint256 role) external;
function transfer_role_manager(address role_manager) external;
function accept_role_manager() external;
function unlockedShares() external view returns (uint256);
function pricePerShare() external view returns (uint256);
function get_default_queue() external view returns (address[] memory);
function process_report(
address strategy
) external returns (uint256, uint256);
function buy_debt(address strategy, uint256 amount) external;
function add_strategy(address new_strategy) external;
function revoke_strategy(address strategy) external;
function force_revoke_strategy(address strategy) external;
function update_max_debt_for_strategy(
address strategy,
uint256 new_max_debt
) external;
function update_debt(
address strategy,
uint256 target_debt
) external returns (uint256);
function update_debt(
address strategy,
uint256 target_debt,
uint256 max_loss
) external returns (uint256);
function shutdown_vault() external;
function totalIdle() external view returns (uint256);
function totalDebt() external view returns (uint256);
function apiVersion() external view returns (string memory);
function assess_share_of_unrealised_losses(
address strategy,
uint256 assets_needed
) external view returns (uint256);
function profitMaxUnlockTime() external view returns (uint256);
function fullProfitUnlockDate() external view returns (uint256);
function profitUnlockingRate() external view returns (uint256);
function lastProfitUpdate() external view returns (uint256);
//// NON-STANDARD ERC-4626 FUNCTIONS \\\\
function withdraw(
uint256 assets,
address receiver,
address owner,
uint256 max_loss
) external returns (uint256);
function withdraw(
uint256 assets,
address receiver,
address owner,
uint256 max_loss,
address[] memory strategies
) external returns (uint256);
function redeem(
uint256 shares,
address receiver,
address owner,
uint256 max_loss
) external returns (uint256);
function redeem(
uint256 shares,
address receiver,
address owner,
uint256 max_loss,
address[] memory strategies
) external returns (uint256);
function maxWithdraw(
address owner,
uint256 max_loss
) external view returns (uint256);
function maxWithdraw(
address owner,
uint256 max_loss,
address[] memory strategies
) external view returns (uint256);
function maxRedeem(
address owner,
uint256 max_loss
) external view returns (uint256);
function maxRedeem(
address owner,
uint256 max_loss,
address[] memory strategies
) external view returns (uint256);
//// NON-STANDARD ERC-20 FUNCTIONS \\\\
function DOMAIN_SEPARATOR() external view returns (bytes32);
function permit(
address owner,
address spender,
uint256 amount,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external returns (bool);
}
// src/debtAllocators/DebtAllocator.sol
interface IBaseFee {
function basefee_global() external view returns (uint256);
}
/**
* @title YearnV3 Debt Allocator
* @author yearn.finance
* @notice
* This Debt Allocator is meant to be used alongside
* Yearn V3 vaults to provide the needed triggers for a keeper
* to perform automated debt updates for the vaults strategies.
*
* @dev
* Each vault that should be managed by this allocator will
* need to be added by first setting a `minimumChange` for the
* vault, which will act as the minimum amount of funds to move that will
* trigger a debt update. Then adding each strategy by setting a
* `targetRatio` and optionally a `maxRatio`.
*
* The allocator aims to allocate debt between the strategies
* based on their set target ratios. Which are denominated in basis
* points and represent the percent of total assets that specific
* strategy should hold (i.e 1_000 == 10% of the vaults `totalAssets`).
*
* The trigger will attempt to allocate up to the `maxRatio` when
* the strategy has `minimumChange` amount less than the `targetRatio`.
* And will pull funds to the `targetRatio` when it has `minimumChange`
* more than its `maxRatio`.
*/
contract DebtAllocator is Governance {
/// @notice An event emitted when the base fee provider is set.
event UpdatedBaseFeeProvider(address baseFeeProvider);
/// @notice An event emitted when a keeper is added or removed.
event UpdateKeeper(address indexed keeper, bool allowed);
/// @notice An event emitted when the max base fee is updated.
event UpdateMaxAcceptableBaseFee(uint256 newMaxAcceptableBaseFee);
/// @notice An event emitted when a strategies debt ratios are Updated.
event UpdateStrategyDebtRatio(
address indexed vault,
address indexed strategy,
uint256 newTargetRatio,
uint256 newMaxRatio,
uint256 newTotalDebtRatio
);
/// @notice An event emitted when a strategy is added or removed.
event StrategyChanged(
address indexed vault,
address indexed strategy,
Status status
);
/// @notice An event emitted when the minimum change is updated.
event UpdateMinimumChange(address indexed vault, uint256 newMinimumChange);
/// @notice An even emitted when the paused status is updated.
event UpdatePaused(address indexed vault, bool indexed status);
/// @notice An event emitted when the minimum time to wait is updated.
event UpdateMinimumWait(uint256 newMinimumWait);
/// @notice An event emitted when a keeper is added or removed.
event UpdateManager(address indexed manager, bool allowed);
/// @notice An event emitted when the max debt update loss is updated.
event UpdateMaxDebtUpdateLoss(uint256 newMaxDebtUpdateLoss);
/// @notice Status when a strategy is added or removed from the allocator.
enum Status {
NULL,
ADDED,
REMOVED
}
/// @notice Struct for each strategies info.
struct StrategyConfig {
// Flag to set when a strategy is added.
bool added;
// The ideal percent in Basis Points the strategy should have.
uint16 targetRatio;
// The max percent of assets the strategy should hold.
uint16 maxRatio;
// Timestamp of the last time debt was updated.
// The debt updates must be done through this allocator
// for this to be used.
uint96 lastUpdate;
// We have an extra 120 bits in the slot.
// So we declare the variable in the struct so it can be
// used if this contract is inherited.
uint120 open;
}
/// @notice Struct to hold the vault's info.
struct VaultConfig {
// Optional flag to stop the triggers.
bool paused;
// The minimum amount denominated in asset that will
// need to be moved to trigger a debt update.
uint128 minimumChange;
// Total debt ratio currently allocated in basis points.
// Can't be more than 10_000.
uint16 totalDebtRatio;
}
/// @notice Used during the `shouldUpdateDebt` to hold the data.
struct StrategyDebtInfo {
VaultConfig vaultConfig;
StrategyConfig strategyConfig;
uint256 vaultAssets;
uint256 targetDebt;
uint256 maxDebt;
uint256 currentIdle;
uint256 minIdle;
uint256 toChange;
}
/// @notice Make sure the caller is governance or a manager.
modifier onlyManagers() {
_isManager();
_;
}
/// @notice Make sure the caller is a keeper
modifier onlyKeepers() {
_isKeeper();
_;
}
/// @notice Check is either factories governance or local manager.
function _isManager() internal view virtual {
require(managers[msg.sender] || msg.sender == governance, "!manager");
}
/// @notice Check is one of the allowed keepers.
function _isKeeper() internal view virtual {
require(keepers[msg.sender], "!keeper");
}
uint256 internal constant MAX_BPS = 10_000;
/// @notice Time to wait between debt updates in seconds.
uint256 public minimumWait;
/// @notice Provider to read current block's base fee.
address public baseFeeProvider;
/// @notice Max loss to accept on debt updates in basis points.
uint256 public maxDebtUpdateLoss;
/// @notice Max the chains base fee can be during debt update.
// Will default to max uint256 and need to be set to be used.
uint256 public maxAcceptableBaseFee;
/// @notice Mapping of addresses that are allowed to update debt.
mapping(address => bool) public keepers;
/// @notice Mapping of addresses that are allowed to update debt ratios.
mapping(address => bool) public managers;
mapping(address => VaultConfig) internal _vaultConfigs;
/// @notice Mapping of vault => strategy => its config.
mapping(address => mapping(address => StrategyConfig))
internal _strategyConfigs;
constructor() Governance(msg.sender) {}
/**
* @notice Initialize the contract after being cloned.
* @dev Sets default values for the global variables.
*/
function initialize(address _governance) external {
require(governance == address(0), "initialized");
require(_governance != address(0), "ZERO ADDRESS");
governance = _governance;
emit GovernanceTransferred(address(0), _governance);
// Default max base fee to uint max.
maxAcceptableBaseFee = type(uint256).max;
// Default to allow 1 BP loss.
maxDebtUpdateLoss = 1;
// Default minimum wait to 6 hours
minimumWait = 60 * 60 * 6;
// Default to allow governance to be a keeper.
keepers[_governance] = true;
emit UpdateKeeper(_governance, true);
}
/**
* @notice Debt update wrapper for the vault.
* @dev This contract must have the DEBT_MANAGER role assigned to them.
*
* This will also uses the `maxUpdateDebtLoss` during debt
* updates to assure decreases did not realize profits outside
* of the allowed range.
*/
function update_debt(
address _vault,
address _strategy,
uint256 _targetDebt
) public virtual onlyKeepers {
// If going to 0 record full balance first.
if (_targetDebt == 0) {
IVault(_vault).process_report(_strategy);
}
// Update debt with the default max loss.
IVault(_vault).update_debt(_strategy, _targetDebt, maxDebtUpdateLoss);
// Update the last time the strategies debt was updated.
_strategyConfigs[_vault][_strategy].lastUpdate = uint96(
block.timestamp
);
}
/**
* @notice Check if a strategy's debt should be updated.
* @dev This should be called by a keeper to decide if a strategies
* debt should be updated and if so by how much.
*
* @param _vault Address of the vault to update.
* @param _strategy Address of the strategy to check.
* @return . Bool representing if the debt should be updated.
* @return . Calldata if `true` or reason if `false`.
*/
function shouldUpdateDebt(
address _vault,
address _strategy
) public view virtual returns (bool, bytes memory) {
// Store all local variables in a struct to avoid stack to deep
StrategyDebtInfo memory strategyDebtInfo;
strategyDebtInfo.vaultConfig = getVaultConfig(_vault);
// Don't do anything if paused.
if (strategyDebtInfo.vaultConfig.paused) {
return (false, bytes("Paused"));
}
// Check the base fee isn't too high.
if (!isCurrentBaseFeeAcceptable()) return (false, bytes("Base Fee"));
// Get the strategy specific debt config.
strategyDebtInfo.strategyConfig = getStrategyConfig(_vault, _strategy);
// Make sure the strategy has been added to the allocator.
if (!strategyDebtInfo.strategyConfig.added) {
return (false, bytes("!added"));
}
if (
block.timestamp - strategyDebtInfo.strategyConfig.lastUpdate <=
minimumWait
) {
return (false, bytes("min wait"));
}
// Retrieve the strategy specific parameters.
IVault.StrategyParams memory params = IVault(_vault).strategies(
_strategy
);
// Make sure its an active strategy.
require(params.activation != 0, "!active");
strategyDebtInfo.vaultAssets = IVault(_vault).totalAssets();
// Get the target debt for the strategy based on vault assets.
strategyDebtInfo.targetDebt = Math.min(
(strategyDebtInfo.vaultAssets *
strategyDebtInfo.strategyConfig.targetRatio) / MAX_BPS,
// Make sure it is not more than the max allowed.
params.max_debt
);
// Get the max debt we would want the strategy to have.
strategyDebtInfo.maxDebt = Math.min(
(strategyDebtInfo.vaultAssets *
strategyDebtInfo.strategyConfig.maxRatio) / MAX_BPS,
// Make sure it is not more than the max allowed.
params.max_debt
);
// If we need to add more.
if (strategyDebtInfo.targetDebt > params.current_debt) {
strategyDebtInfo.currentIdle = IVault(_vault).totalIdle();
strategyDebtInfo.minIdle = IVault(_vault).minimum_total_idle();
// We can't add more than the available idle.
if (strategyDebtInfo.minIdle >= strategyDebtInfo.currentIdle) {
return (false, bytes("No Idle"));
}
// Add up to the max if possible
strategyDebtInfo.toChange = Math.min(
strategyDebtInfo.maxDebt - params.current_debt,
// Can't take more than is available.
Math.min(
strategyDebtInfo.currentIdle - strategyDebtInfo.minIdle,
IVault(_strategy).maxDeposit(_vault)
)
);
// If the amount to add is over our threshold.
if (
strategyDebtInfo.toChange >
strategyDebtInfo.vaultConfig.minimumChange
) {
// Return true and the calldata.
return (
true,
abi.encodeCall(
this.update_debt,
(
_vault,
_strategy,
params.current_debt + strategyDebtInfo.toChange
)
)
);
}
// If current debt is greater than our max.
} else if (strategyDebtInfo.maxDebt < params.current_debt) {
strategyDebtInfo.toChange =
params.current_debt -
strategyDebtInfo.targetDebt;
strategyDebtInfo.currentIdle = IVault(_vault).totalIdle();
strategyDebtInfo.minIdle = IVault(_vault).minimum_total_idle();
if (strategyDebtInfo.minIdle > strategyDebtInfo.currentIdle) {
// Pull at least the amount needed for minIdle.
strategyDebtInfo.toChange = Math.max(
strategyDebtInfo.toChange,
strategyDebtInfo.minIdle - strategyDebtInfo.currentIdle
);
}
// Find out by how much. Aim for the target.
strategyDebtInfo.toChange = Math.min(
strategyDebtInfo.toChange,
// Account for the current liquidity constraints.
// Use max redeem to match vault logic.
IVault(_strategy).convertToAssets(
IVault(_strategy).maxRedeem(_vault)
)
);
// Check if it's over the threshold.
if (
strategyDebtInfo.toChange >
strategyDebtInfo.vaultConfig.minimumChange
) {
// Can't lower debt if there are unrealised losses.
if (
IVault(_vault).assess_share_of_unrealised_losses(
_strategy,
params.current_debt
) != 0
) {
return (false, bytes("unrealised loss"));
}
// If so return true and the calldata.
return (
true,
abi.encodeCall(
this.update_debt,
(
_vault,
_strategy,
params.current_debt - strategyDebtInfo.toChange
)
)
);
}
}
// Either no change or below our minimumChange.
return (false, bytes("Below Min"));
}
/*//////////////////////////////////////////////////////////////
STRATEGY MANAGEMENT
//////////////////////////////////////////////////////////////*/
/**
* @notice Increase a strategies target debt ratio.
* @dev `setStrategyDebtRatio` functions will do all needed checks.
* @param _strategy The address of the strategy to increase the debt ratio for.
* @param _increase The amount in Basis Points to increase it.
*/
function increaseStrategyDebtRatio(
address _vault,
address _strategy,
uint256 _increase
) external virtual {
setStrategyDebtRatio(
_vault,
_strategy,
getStrategyTargetRatio(_vault, _strategy) + _increase
);
}
/**
* @notice Decrease a strategies target debt ratio.
* @param _strategy The address of the strategy to decrease the debt ratio for.
* @param _decrease The amount in Basis Points to decrease it.
*/
function decreaseStrategyDebtRatio(
address _vault,
address _strategy,
uint256 _decrease
) external virtual {
setStrategyDebtRatio(
_vault,
_strategy,
getStrategyTargetRatio(_vault, _strategy) - _decrease
);
}
/**
* @notice Sets a new target debt ratio for a strategy.
* @dev This will default to a 20% increase for max debt.
*
* @param _strategy Address of the strategy to set.
* @param _targetRatio Amount in Basis points to allocate.
*/
function setStrategyDebtRatio(
address _vault,
address _strategy,
uint256 _targetRatio
) public virtual {
uint256 maxRatio = Math.min((_targetRatio * 12_000) / MAX_BPS, MAX_BPS);
setStrategyDebtRatio(_vault, _strategy, _targetRatio, maxRatio);
}
/**
* @notice Sets a new target debt ratio for a strategy.
* @dev A `minimumChange` for that strategy must be set first.
* This is to prevent debt from being updated too frequently.
*
* @param _vault Address of the vault
* @param _strategy Address of the strategy to set.
* @param _targetRatio Amount in Basis points to allocate.
* @param _maxRatio Max ratio to give on debt increases.
*/
function setStrategyDebtRatio(
address _vault,
address _strategy,
uint256 _targetRatio,
uint256 _maxRatio
) public virtual onlyManagers {
VaultConfig memory vaultConfig = getVaultConfig(_vault);
// Make sure a minimumChange has been set.
require(vaultConfig.minimumChange != 0, "!minimum");
// Cannot be more than 100%.
require(_maxRatio <= MAX_BPS, "max too high");
// Max cannot be lower than the target.
require(_maxRatio >= _targetRatio, "max ratio");
// Get the current config.
StrategyConfig memory strategyConfig = getStrategyConfig(
_vault,
_strategy
);
// Set added flag if not set yet.
if (!strategyConfig.added) {
strategyConfig.added = true;
emit StrategyChanged(_vault, _strategy, Status.ADDED);
}
// Get what will be the new total debt ratio.
uint256 newTotalDebtRatio = vaultConfig.totalDebtRatio -
strategyConfig.targetRatio +
_targetRatio;
// Make sure it is under 100% allocated
require(newTotalDebtRatio <= MAX_BPS, "ratio too high");
// Update local config.
strategyConfig.targetRatio = uint16(_targetRatio);
strategyConfig.maxRatio = uint16(_maxRatio);
// Write to storage.
_strategyConfigs[_vault][_strategy] = strategyConfig;
_vaultConfigs[_vault].totalDebtRatio = uint16(newTotalDebtRatio);
emit UpdateStrategyDebtRatio(
_vault,
_strategy,
_targetRatio,
_maxRatio,
newTotalDebtRatio
);
}
/**
* @notice Remove a strategy from this debt allocator.
* @dev Will delete the full config for the strategy
* @param _vault Address of the vault
* @param _strategy Address of the address ro remove.
*/
function removeStrategy(
address _vault,
address _strategy
) external virtual onlyManagers {
StrategyConfig memory strategyConfig = getStrategyConfig(
_vault,
_strategy
);
require(strategyConfig.added, "!added");
uint256 target = strategyConfig.targetRatio;
// Remove any debt ratio the strategy holds.
if (target != 0) {
uint256 newRatio = _vaultConfigs[_vault].totalDebtRatio - target;
_vaultConfigs[_vault].totalDebtRatio = uint16(newRatio);
emit UpdateStrategyDebtRatio(_vault, _strategy, 0, 0, newRatio);
}
// Remove the full config including the `added` flag.
delete _strategyConfigs[_vault][_strategy];
// Emit Event.
emit StrategyChanged(_vault, _strategy, Status.REMOVED);
}
/*//////////////////////////////////////////////////////////////
VAULT MANAGEMENT
//////////////////////////////////////////////////////////////*/
/**
* @notice Set the minimum change variable for a strategy.
* @dev This is the minimum amount of debt to be
* added or pulled for it to trigger an update.
*
* @param _vault Address of the vault
* @param _minimumChange The new minimum to set for the strategy.
*/
function setMinimumChange(
address _vault,
uint256 _minimumChange
) external virtual onlyGovernance {
require(_minimumChange > 0, "zero change");
// Make sure it fits in the slot size.
require(_minimumChange < type(uint128).max, "too high");
// Set the new minimum.
_vaultConfigs[_vault].minimumChange = uint128(_minimumChange);
emit UpdateMinimumChange(_vault, _minimumChange);
}
/**
* @notice Allows governance to pause the triggers.
* @param _vault Address of the vault
* @param _status Status to set the `paused` bool to.
*/
function setPaused(
address _vault,
bool _status
) external virtual onlyGovernance {
require(_status != _vaultConfigs[_vault].paused, "already set");
_vaultConfigs[_vault].paused = _status;
emit UpdatePaused(_vault, _status);
}
/*//////////////////////////////////////////////////////////////
ALLOCATOR MANAGEMENT
//////////////////////////////////////////////////////////////*/
/**
* @notice Set the minimum time to wait before re-updating a strategies debt.
* @dev This is only enforced per strategy.
* @param _minimumWait The minimum time in seconds to wait.
*/
function setMinimumWait(
uint256 _minimumWait
) external virtual onlyGovernance {
minimumWait = _minimumWait;
emit UpdateMinimumWait(_minimumWait);
}
/**
* @notice Set if a manager can update ratios.
* @param _address The address to set mapping for.
* @param _allowed If the address can call {update_debt}.
*/
function setManager(
address _address,
bool _allowed
) external virtual onlyGovernance {
managers[_address] = _allowed;
emit UpdateManager(_address, _allowed);
}
/**
* @notice Set the max loss in Basis points to allow on debt updates.
* @dev Withdrawing during debt updates use {redeem} which allows for 100% loss.
* This can be used to assure a loss is not realized on redeem outside the tolerance.
* @param _maxDebtUpdateLoss The max loss to accept on debt updates.
*/
function setMaxDebtUpdateLoss(
uint256 _maxDebtUpdateLoss
) external virtual onlyGovernance {
require(_maxDebtUpdateLoss <= MAX_BPS, "higher than max");
maxDebtUpdateLoss = _maxDebtUpdateLoss;
emit UpdateMaxDebtUpdateLoss(_maxDebtUpdateLoss);
}
/**
* @notice
* Used to set our baseFeeProvider, which checks the network's current base
* fee price to determine whether it is an optimal time to harvest or tend.
*
* This may only be called by governance.
* @param _baseFeeProvider Address of our baseFeeProvider
*/
function setBaseFeeProvider(
address _baseFeeProvider
) external virtual onlyGovernance {
baseFeeProvider = _baseFeeProvider;
emit UpdatedBaseFeeProvider(_baseFeeProvider);
}
/**
* @notice Set the max acceptable base fee.
* @dev This defaults to max uint256 and will need to
* be set for it to be used.
*
* Is denominated in gwei. So 50gwei would be set as 50e9.
*
* @param _maxAcceptableBaseFee The new max base fee.
*/
function setMaxAcceptableBaseFee(
uint256 _maxAcceptableBaseFee
) external virtual onlyGovernance {
maxAcceptableBaseFee = _maxAcceptableBaseFee;
emit UpdateMaxAcceptableBaseFee(_maxAcceptableBaseFee);
}
/**
* @notice Set if a keeper can update debt.
* @param _address The address to set mapping for.
* @param _allowed If the address can call {update_debt}.
*/
function setKeeper(
address _address,
bool _allowed
) external virtual onlyGovernance {
keepers[_address] = _allowed;
emit UpdateKeeper(_address, _allowed);
}
/**
* @notice Get a strategies full config.
* @dev Used for customizations by inheriting the contract.
* @param _vault Address of the vault
* @param _strategy Address of the strategy.
* @return The strategies current Config.
*/
function getStrategyConfig(
address _vault,
address _strategy
) public view virtual returns (StrategyConfig memory) {
return _strategyConfigs[_vault][_strategy];
}
/**
* @notice Get a vaults full config.
* @dev Used for customizations by inheriting the contract.
* @param _vault Address of the vault.
* @return The vaults current Config.
*/
function getVaultConfig(
address _vault
) public view virtual returns (VaultConfig memory) {
return _vaultConfigs[_vault];
}
/**
* @notice Get a vaults current total debt.
* @param _vault Address of the vault
*/
function totalDebtRatio(
address _vault
) external view virtual returns (uint256) {
return getVaultConfig(_vault).totalDebtRatio;
}
/**
* @notice Get a vaults minimum change required.
* @param _vault Address of the vault
*/
function minimumChange(
address _vault
) external view virtual returns (uint256) {
return getVaultConfig(_vault).minimumChange;
}
/**
* @notice Get the paused status of a vault
* @param _vault Address of the vault
*/
function isPaused(address _vault) public view virtual returns (bool) {
return getVaultConfig(_vault).paused;
}
/**
* @notice Get a strategies target debt ratio.
* @param _vault Address of the vault
* @param _strategy Address of the strategy.
* @return The strategies current targetRatio.
*/
function getStrategyTargetRatio(
address _vault,
address _strategy
) public view virtual returns (uint256) {
return getStrategyConfig(_vault, _strategy).targetRatio;
}
/**
* @notice Get a strategies max debt ratio.
* @param _vault Address of the vault
* @param _strategy Address of the strategy.
* @return The strategies current maxRatio.
*/
function getStrategyMaxRatio(
address _vault,
address _strategy
) public view virtual returns (uint256) {
return getStrategyConfig(_vault, _strategy).maxRatio;
}
/**
* @notice Returns wether or not the current base fee is acceptable
* based on the `maxAcceptableBaseFee`.
* @return . If the current base fee is acceptable.
*/
function isCurrentBaseFeeAcceptable() public view virtual returns (bool) {
address _baseFeeProvider = baseFeeProvider;
if (_baseFeeProvider == address(0)) return true;
return
maxAcceptableBaseFee >= IBaseFee(_baseFeeProvider).basefee_global();
}
}
// src/debtAllocators/DebtAllocatorFactory.sol
/**
* @title YearnV3 Debt Allocator Factory
* @author yearn.finance
* @notice
* Factory to deploy a debt allocator for a YearnV3 vault.
*/
contract DebtAllocatorFactory is Clonable {
/// @notice An event emitted when a new debt allocator is added or deployed.
event NewDebtAllocator(
address indexed allocator,
address indexed governance
);
constructor() {
// Deploy a dummy allocator as the original.
original = address(new DebtAllocator());
}
/**
* @notice Clones a new debt allocator.
* @param _governance Address to control the debt allocator.
* @return newAllocator Address of the new debt allocator
*/
function newDebtAllocator(
address _governance
) public virtual returns (address newAllocator) {
// Clone new allocator off the original.
newAllocator = _clone();
// Initialize the new allocator.
DebtAllocator(newAllocator).initialize(_governance);
// Emit event.
emit NewDebtAllocator(newAllocator, _governance);
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"allocator","type":"address"},{"indexed":true,"internalType":"address","name":"governance","type":"address"}],"name":"NewDebtAllocator","type":"event"},{"inputs":[{"internalType":"address","name":"_governance","type":"address"}],"name":"newDebtAllocator","outputs":[{"internalType":"address","name":"newAllocator","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"original","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]Contract Creation Code
608060405234801561001057600080fd5b5060405161001d9061005f565b604051809103906000f080158015610039573d6000803e3d6000fd5b50600080546001600160a01b0319166001600160a01b039290921691909117905561006c565b6120638061027183390190565b6101f68061007b6000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c806328d34c901461003b57806346c715fa1461006a575b600080fd5b61004e610049366004610190565b61007d565b6040516001600160a01b03909116815260200160405180910390f35b60005461004e906001600160a01b031681565b6000610087610123565b60405163189acdbd60e31b81526001600160a01b0384811660048301529192509082169063c4d66de890602401600060405180830381600087803b1580156100ce57600080fd5b505af11580156100e2573d6000803e3d6000fd5b50506040516001600160a01b038086169350841691507fb87aa110ff22ca00092bbab091c1b6464f413dcfe6391c7fcfc0454f8e1989cb90600090a3919050565b60008054610139906001600160a01b031661013e565b905090565b6000808260601b9050604051733d602d80600a3d3981f3363d3d373d3d3d363d7360601b81528160148201526e5af43d82803e903d91602b57fd5bf360881b60288201526037816000f0949350505050565b6000602082840312156101a257600080fd5b81356001600160a01b03811681146101b957600080fd5b939250505056fea26469706673582212208d6a86474b0074449ceffde6618e47786f81b6d0d38e3bf05a36fed5611ac8f564736f6c63430008120033608060405234801561001057600080fd5b50600080546001600160a01b031916339081178255604051909182917f5f56bee8cffbe9a78652a74a60705edede02af10b0bbb888ca44b79a0d42ce80908290a350612002806100616000396000f3fe608060405234801561001057600080fd5b50600436106101f05760003560e01c806389eba0d21161010f578063d38bfff4116100a2578063e7c0290811610071578063e7c02908146104cc578063e803ea8a146104df578063f0eb754b146104f2578063fdff9b4d1461050557600080fd5b8063d38bfff41461044f578063da5f328614610462578063de1eb9a314610475578063e10efcdd146104b957600080fd5b8063a5e90eee116100de578063a5e90eee1461040d578063bf95ab4914610420578063c4d66de814610429578063d1b9e8531461043c57600080fd5b806389eba0d2146103c15780638c177c86146103d45780638e67d7b3146103e757806397b51442146103fa57600080fd5b80633bbd64bc116101875780635b14f183116101565780635b14f1831461037f5780635e25b351146103925780637c7727e2146103a55780638401fb5c146103ae57600080fd5b80633bbd64bc146102fd57806347003cb7146103205780634ad0f1d01461034b5780635aa6e6751461036c57600080fd5b8063244edd79116101c3578063244edd79146102aa57806334a9e75c146102bf5780633820f4b7146102d75780633ad921e1146102ea57600080fd5b8063089b1334146101f55780630dedca241461021b57806312c1c1d61461028e578063187d00e314610297575b600080fd5b610208610203366004611cb9565b610528565b6040519081526020015b60405180910390f35b61022e610229366004611cb9565b610545565b6040516102129190600060a082019050825115158252602083015161ffff808216602085015280604086015116604085015250506001600160601b0360608401511660608301526001600160781b03608084015116608083015292915050565b61020860015481565b6102086102a5366004611cec565b6105fd565b6102bd6102b8366004611cec565b61061b565b005b6102c7610678565b6040519015158152602001610212565b6102bd6102e5366004611d07565b610701565b6102086102f8366004611cb9565b61073b565b6102c761030b366004611cec565b60056020526000908152604090205460ff1681565b600254610333906001600160a01b031681565b6040516001600160a01b039091168152602001610212565b61035e610359366004611cb9565b610756565b604051610212929190611d43565b600054610333906001600160a01b031681565b6102c761038d366004611cec565b610fad565b6102bd6103a0366004611d9b565b610fbf565b61020860035481565b6102bd6103bc366004611ddd565b6112b2565b6102bd6103cf366004611e07565b6113b1565b6102bd6103e2366004611d07565b611469565b6102bd6103f5366004611cb9565b611488565b6102bd610408366004611e43565b6115fa565b6102bd61041b366004611e07565b611637565b61020860045481565b6102bd610437366004611cec565b611697565b6102bd61044a366004611e07565b6117d8565b6102bd61045d366004611cec565b611838565b6102bd610470366004611d07565b6118d5565b610488610483366004611cec565b611a28565b604080518251151581526020808401516001600160801b0316908201529181015161ffff1690820152606001610212565b6102bd6104c7366004611e43565b611a93565b6102bd6104da366004611e43565b611ad0565b6102bd6104ed366004611d07565b611b51565b610208610500366004611cec565b611b6b565b6102c7610513366004611cec565b60066020526000908152604090205460ff1681565b60006105348383610545565b6020015161ffff1690505b92915050565b6040805160a081018252600080825260208201819052918101829052606081018290526080810191909152506001600160a01b039182166000908152600860209081526040808320939094168252918252829020825160a081018452905460ff811615158252610100810461ffff9081169383019390935263010000008104909216928101929092526501000000000081046001600160601b03166060830152600160881b90046001600160781b0316608082015290565b600061060882611a28565b602001516001600160801b031692915050565b610623611b84565b600280546001600160a01b0319166001600160a01b0383169081179091556040519081527f67e5dbcc4220aeab916964e219b9ccf7ed0417129db5bdc201368a1fcf2568b2906020015b60405180910390a150565b6002546000906001600160a01b03168061069457600191505090565b806001600160a01b0316639436dce46040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106f69190611e5c565b600454101591505090565b600061072761271061071584612ee0611e8b565b61071f9190611ea2565b612710611bce565b905061073584848484610fbf565b50505050565b60006107478383610545565b6040015161ffff169392505050565b600060606107e1604080516101608101825260006101008201818152610120830182905261014083018290528252825160a0810184528181526020808201839052938101829052606081018290526080810191909152909182019081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6107ea85611a28565b808252511561081b57505060408051808201909152600681526514185d5cd95960d21b602082015260009150610fa6565b610823610678565b610851575050604080518082019091526008815267426173652046656560c01b602082015260009150610fa6565b61085b8585610545565b602082018190525161088f57505060408051808201909152600681526508585919195960d21b602082015260009150610fa6565b6001546020820151606001516108ae906001600160601b031642611ec4565b116108dd5750506040805180820190915260088152671b5a5b881dd85a5d60c21b602082015260009150610fa6565b6040516339ebf82360e01b81526001600160a01b038581166004830152600091908716906339ebf82390602401608060405180830381865afa158015610927573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061094b9190611ed7565b805190915060000361098e5760405162461bcd60e51b81526020600482015260076024820152662161637469766560c81b60448201526064015b60405180910390fd5b856001600160a01b03166301e1d1146040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f09190611e5c565b604083018190526020808401510151610a2b9161271091610a179161ffff90911690611e8b565b610a219190611ea2565b8260600151611bce565b826060018181525050610a5661271083602001516040015161ffff168460400151610a179190611e8b565b6080830152604081015160608301511115610cb857856001600160a01b0316639aa7df946040518163ffffffff1660e01b8152600401602060405180830381865afa158015610aa9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610acd9190611e5c565b8260a0018181525050856001600160a01b031663356d64096040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b14573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b389190611e5c565b60c0830181905260a083015111610b76576000604051806040016040528060078152602001664e6f2049646c6560c81b815250935093505050610fa6565b610c1481604001518360800151610b8d9190611ec4565b610c0f8460c001518560a00151610ba49190611ec4565b60405163402d267d60e01b81526001600160a01b038b811660048301528a169063402d267d906024015b602060405180830381865afa158015610beb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0f9190611e5c565b611bce565b60e083018190528251602001516001600160801b03161015610cb3576001306001600160a01b031663da5f328688888660e001518660400151610c579190611f4b565b6040516001600160a01b0393841660248201529290911660448301526064820152608401604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050935093505050610fa6565b610f7b565b806040015182608001511015610f7b5781606001518160400151610cdc9190611ec4565b8260e0018181525050856001600160a01b0316639aa7df946040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d23573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d479190611e5c565b8260a0018181525050856001600160a01b031663356d64096040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d8e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610db29190611e5c565b60c0830181905260a08301511015610deb57610de58260e001518360a001518460c00151610de09190611ec4565b611be6565b60e08301525b60e0820151604051636c82bbbf60e11b81526001600160a01b038881166004830152610e869291908816906307a2d13a90829063d905777e90602401602060405180830381865afa158015610e44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e689190611e5c565b6040518263ffffffff1660e01b8152600401610bce91815260200190565b60e083018190528251602001516001600160801b03161015610f7b5760408181015190516366d3ae5760e01b81526001600160a01b0387811660048301526024820192909252908716906366d3ae5790604401602060405180830381865afa158015610ef6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1a9190611e5c565b15610f545760006040518060400160405280600f81526020016e756e7265616c69736564206c6f737360881b815250935093505050610fa6565b6001306001600160a01b031663da5f328688888660e001518660400151610c579190611ec4565b6000604051806040016040528060098152602001682132b637bb9026b4b760b91b8152509350935050505b9250929050565b6000610fb882611a28565b5192915050565b610fc7611bf5565b6000610fd285611a28565b905080602001516001600160801b031660000361101c5760405162461bcd60e51b8152602060048201526008602482015267216d696e696d756d60c01b6044820152606401610985565b61271082111561105d5760405162461bcd60e51b815260206004820152600c60248201526b0dac2f040e8dede40d0d2ced60a31b6044820152606401610985565b828210156110995760405162461bcd60e51b81526020600482015260096024820152686d617820726174696f60b81b6044820152606401610985565b60006110a58686610545565b80519091506110fa5760018082526040516001600160a01b0380881692908916917f74e371e67bf6588ac73ab3570a86b39104276481dbd65d5a5b1069c30e93fb5d916110f191611f5e565b60405180910390a35b600084826020015184604001516111119190611f86565b61ffff1661111f9190611f4b565b90506127108111156111645760405162461bcd60e51b815260206004820152600e60248201526d0e4c2e8d2de40e8dede40d0d2ced60931b6044820152606401610985565b61ffff858116602084810191825286831660408087019182526001600160a01b038c8116600081815260088652838120928e168082529286528381208a518154985196516060808e015160808f015162ffffff19909c1693151562ffff00191693909317610100998d16999099029890981770ffffffffffffffffffffffffffff00000019166301000000918c169190910270ffffffffffffffffffffffff0000000000191617650100000000006001600160601b03909216919091021770ffffffffffffffffffffffffffffffffff16600160881b6001600160781b03909916890217905581815260078652839020805461ffff60881b19169789169096029690961790945580518a815292830189905282018590529192917f2a89fa60115b9af6e21a6c6aa32d141e9cfbf77472d27fbf2e7a5a8c2efaf995910160405180910390a350505050505050565b6112ba611b84565b600081116112f85760405162461bcd60e51b815260206004820152600b60248201526a7a65726f206368616e676560a81b6044820152606401610985565b6001600160801b0381106113395760405162461bcd60e51b81526020600482015260086024820152670e8dede40d0d2ced60c31b6044820152606401610985565b6001600160a01b038216600081815260076020908152604091829020805470ffffffffffffffffffffffffffffffff0019166101006001600160801b0387160217905590518381527fcc89de2055a7d9f6f377def5afb15de666c80b1c8904b545f151406494fea09b91015b60405180910390a25050565b6113b9611b84565b6001600160a01b03821660009081526007602052604090205460ff161515811515036114155760405162461bcd60e51b815260206004820152600b60248201526a185b1c9958591e481cd95d60aa1b6044820152606401610985565b6001600160a01b038216600081815260076020526040808220805460ff191685151590811790915590519092917f1025423f8fe1ce5c139f49ee3b9b04389e51044ef7602e445a93114390d1294391a35050565b6114838383836114798787610528565b6102e59190611f4b565b505050565b611490611bf5565b600061149c8383610545565b80519091506114d65760405162461bcd60e51b815260206004820152600660248201526508585919195960d21b6044820152606401610985565b602081015161ffff168015611590576001600160a01b038416600090815260076020526040812054611514908390600160881b900461ffff16611ec4565b6001600160a01b038681166000818152600760209081526040808320805461ffff60881b1916600160881b61ffff891602179055805183815291820192909252908101849052929350908616917f2a89fa60115b9af6e21a6c6aa32d141e9cfbf77472d27fbf2e7a5a8c2efaf9959060600160405180910390a3505b6001600160a01b0380851660008181526008602090815260408083209488168084529490915280822091909155517f74e371e67bf6588ac73ab3570a86b39104276481dbd65d5a5b1069c30e93fb5d906115ec90600290611f5e565b60405180910390a350505050565b611602611b84565b60018190556040518181527f9ec10f66a14add2cbfe1672f0eb70b447c7efd557dffcc3077069ca88ac18ed49060200161066d565b61163f611b84565b6001600160a01b038216600081815260066020908152604091829020805460ff191685151590811790915591519182527f28313cd3caea26c974df558965acd2331e5e52597da1446395364c1573229a5291016113a5565b6000546001600160a01b0316156116de5760405162461bcd60e51b815260206004820152600b60248201526a1a5b9a5d1a585b1a5e995960aa1b6044820152606401610985565b6001600160a01b0381166117235760405162461bcd60e51b815260206004820152600c60248201526b5a45524f204144445245535360a01b6044820152606401610985565b600080546001600160a01b0319166001600160a01b03831690811782556040519091907f5f56bee8cffbe9a78652a74a60705edede02af10b0bbb888ca44b79a0d42ce80908290a36000196004556001600381905561546081556001600160a01b038216600081815260056020908152604091829020805460ff191685179055905192835290917f465c356447ab4144076254f033e216e3ba04a16610457682ed579a7fdaebd776910160405180910390a250565b6117e0611b84565b6001600160a01b038216600081815260056020908152604091829020805460ff191685151590811790915591519182527f465c356447ab4144076254f033e216e3ba04a16610457682ed579a7fdaebd77691016113a5565b611840611b84565b6001600160a01b0381166118855760405162461bcd60e51b815260206004820152600c60248201526b5a45524f204144445245535360a01b6044820152606401610985565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f5f56bee8cffbe9a78652a74a60705edede02af10b0bbb888ca44b79a0d42ce809190a35050565b6118dd611c54565b8060000361195357604051631bb0ae3560e21b81526001600160a01b038381166004830152841690636ec2b8d49060240160408051808303816000875af115801561192c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119509190611fa8565b50505b60035460405163ba54971f60e01b81526001600160a01b0384811660048301526024820184905260448201929092529084169063ba54971f906064016020604051808303816000875af11580156119ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119d29190611e5c565b50506001600160a01b0391821660009081526008602090815260408083209390941682529190915220805470ffffffffffffffffffffffff0000000000191665010000000000426001600160601b031602179055565b6040805160608082018352600080835260208084018290529284018190526001600160a01b039490941684526007825292829020825193840183525460ff81161515845261010081046001600160801b031691840191909152600160881b900461ffff169082015290565b611a9b611b84565b60048190556040518181527f9c4501a8aff298ab08ef744135375b60fe1470ad4c4881269aeea25da506e6409060200161066d565b611ad8611b84565b612710811115611b1c5760405162461bcd60e51b815260206004820152600f60248201526e0d0d2ced0cae440e8d0c2dc40dac2f608b1b6044820152606401610985565b60038190556040518181527ffa0cf4f23183a14ad0492993e47bfba1260d2534558c9d01693296caf9f31ee39060200161066d565b611483838383611b618787610528565b6102e59190611ec4565b6000611b7682611a28565b6040015161ffff1692915050565b6000546001600160a01b03163314611bcc5760405162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b6044820152606401610985565b565b6000818310611bdd5781611bdf565b825b9392505050565b6000818311611bdd5781611bdf565b3360009081526006602052604090205460ff1680611c1d57506000546001600160a01b031633145b611bcc5760405162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b6044820152606401610985565b3360009081526005602052604090205460ff16611bcc5760405162461bcd60e51b815260206004820152600760248201526610b5b2b2b832b960c91b6044820152606401610985565b80356001600160a01b0381168114611cb457600080fd5b919050565b60008060408385031215611ccc57600080fd5b611cd583611c9d565b9150611ce360208401611c9d565b90509250929050565b600060208284031215611cfe57600080fd5b611bdf82611c9d565b600080600060608486031215611d1c57600080fd5b611d2584611c9d565b9250611d3360208501611c9d565b9150604084013590509250925092565b821515815260006020604081840152835180604085015260005b81811015611d7957858101830151858201606001528201611d5d565b506000606082860101526060601f19601f830116850101925050509392505050565b60008060008060808587031215611db157600080fd5b611dba85611c9d565b9350611dc860208601611c9d565b93969395505050506040820135916060013590565b60008060408385031215611df057600080fd5b611df983611c9d565b946020939093013593505050565b60008060408385031215611e1a57600080fd5b611e2383611c9d565b915060208301358015158114611e3857600080fd5b809150509250929050565b600060208284031215611e5557600080fd5b5035919050565b600060208284031215611e6e57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761053f5761053f611e75565b600082611ebf57634e487b7160e01b600052601260045260246000fd5b500490565b8181038181111561053f5761053f611e75565b600060808284031215611ee957600080fd5b6040516080810181811067ffffffffffffffff82111715611f1a57634e487b7160e01b600052604160045260246000fd5b8060405250825181526020830151602082015260408301516040820152606083015160608201528091505092915050565b8082018082111561053f5761053f611e75565b6020810160038310611f8057634e487b7160e01b600052602160045260246000fd5b91905290565b61ffff828116828216039080821115611fa157611fa1611e75565b5092915050565b60008060408385031215611fbb57600080fd5b50508051602090910151909290915056fea26469706673582212209603d847ce52df8abe69303275c28e8c489b00acb98a346ba54b6da0d01e569064736f6c63430008120033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100365760003560e01c806328d34c901461003b57806346c715fa1461006a575b600080fd5b61004e610049366004610190565b61007d565b6040516001600160a01b03909116815260200160405180910390f35b60005461004e906001600160a01b031681565b6000610087610123565b60405163189acdbd60e31b81526001600160a01b0384811660048301529192509082169063c4d66de890602401600060405180830381600087803b1580156100ce57600080fd5b505af11580156100e2573d6000803e3d6000fd5b50506040516001600160a01b038086169350841691507fb87aa110ff22ca00092bbab091c1b6464f413dcfe6391c7fcfc0454f8e1989cb90600090a3919050565b60008054610139906001600160a01b031661013e565b905090565b6000808260601b9050604051733d602d80600a3d3981f3363d3d373d3d3d363d7360601b81528160148201526e5af43d82803e903d91602b57fd5bf360881b60288201526037816000f0949350505050565b6000602082840312156101a257600080fd5b81356001600160a01b03811681146101b957600080fd5b939250505056fea26469706673582212208d6a86474b0074449ceffde6618e47786f81b6d0d38e3bf05a36fed5611ac8f564736f6c63430008120033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 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.