104 lines
3.1 KiB
Solidity
104 lines
3.1 KiB
Solidity
// SPDX-License-Identifier: MIT
|
|
pragma solidity ^0.8.24;
|
|
|
|
/**
|
|
* @title IVault
|
|
* @notice Interface for DBIS Institutional Vault
|
|
* @dev Vault represents a leveraged position with collateral and debt tracking
|
|
*/
|
|
interface IVault {
|
|
/**
|
|
* @notice Emitted when a position snapshot is taken
|
|
* @param collateralBefore Previous collateral amount
|
|
* @param debtBefore Previous debt amount
|
|
* @param collateralAfter New collateral amount
|
|
* @param debtAfter New debt amount
|
|
* @param healthFactorBefore Previous health factor (scaled by 1e18)
|
|
* @param healthFactorAfter New health factor (scaled by 1e18)
|
|
*/
|
|
event PositionSnapshot(
|
|
uint256 collateralBefore,
|
|
uint256 debtBefore,
|
|
uint256 collateralAfter,
|
|
uint256 debtAfter,
|
|
uint256 healthFactorBefore,
|
|
uint256 healthFactorAfter
|
|
);
|
|
|
|
/**
|
|
* @notice Emitted when collateral is added to the position
|
|
* @param asset Asset address
|
|
* @param amount Amount added
|
|
*/
|
|
event CollateralAdded(address indexed asset, uint256 amount);
|
|
|
|
/**
|
|
* @notice Emitted when debt is repaid
|
|
* @param asset Asset address
|
|
* @param amount Amount repaid
|
|
*/
|
|
event DebtRepaid(address indexed asset, uint256 amount);
|
|
|
|
/**
|
|
* @notice Get total collateral value in USD (scaled by 1e8)
|
|
*/
|
|
function getTotalCollateralValue() external view returns (uint256);
|
|
|
|
/**
|
|
* @notice Get total debt value in USD (scaled by 1e8)
|
|
*/
|
|
function getTotalDebtValue() external view returns (uint256);
|
|
|
|
/**
|
|
* @notice Get current health factor (scaled by 1e18)
|
|
*/
|
|
function getHealthFactor() external view returns (uint256);
|
|
|
|
/**
|
|
* @notice Get current LTV (Loan-to-Value ratio, scaled by 1e18)
|
|
*/
|
|
function getLTV() external view returns (uint256);
|
|
|
|
/**
|
|
* @notice Record addition of collateral
|
|
* @param asset Asset address
|
|
* @param amount Amount added
|
|
*/
|
|
function recordCollateralAdded(address asset, uint256 amount) external;
|
|
|
|
/**
|
|
* @notice Record repayment of debt
|
|
* @param asset Asset address
|
|
* @param amount Amount repaid
|
|
*/
|
|
function recordDebtRepaid(address asset, uint256 amount) external;
|
|
|
|
/**
|
|
* @notice Take a position snapshot for invariant checking
|
|
* @return collateralBefore Previous collateral value
|
|
* @return debtBefore Previous debt value
|
|
* @return healthFactorBefore Previous health factor
|
|
*/
|
|
function snapshotPosition()
|
|
external
|
|
returns (
|
|
uint256 collateralBefore,
|
|
uint256 debtBefore,
|
|
uint256 healthFactorBefore
|
|
);
|
|
|
|
/**
|
|
* @notice Verify position improved (invariant check)
|
|
* @param collateralBefore Previous collateral value
|
|
* @param debtBefore Previous debt value
|
|
* @param healthFactorBefore Previous health factor
|
|
* @return success True if position improved
|
|
*/
|
|
function verifyPositionImproved(
|
|
uint256 collateralBefore,
|
|
uint256 debtBefore,
|
|
uint256 healthFactorBefore
|
|
) external view returns (bool success);
|
|
}
|
|
|