This repository has been archived by the owner on Jul 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathICollateral.sol
41 lines (37 loc) · 2.34 KB
/
ICollateral.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.13;
import "@equilibria/root/number/types/UFixed18.sol";
import "@equilibria/root/number/types/Fixed18.sol";
import "@equilibria/root/token/types/Token18.sol";
import "./IController.sol";
import "./IProduct.sol";
interface ICollateral {
event Deposit(address indexed user, IProduct indexed product, UFixed18 amount);
event Withdrawal(address indexed user, IProduct indexed product, UFixed18 amount);
event AccountSettle(IProduct indexed product, address indexed account, Fixed18 amount, UFixed18 newShortfall);
event ProductSettle(IProduct indexed product, UFixed18 protocolFee, UFixed18 productFee);
event Liquidation(address indexed user, IProduct indexed product, address liquidator, UFixed18 fee);
event ShortfallResolution(IProduct indexed product, UFixed18 amount);
event FeeClaim(address indexed account, UFixed18 amount);
error CollateralCantLiquidate(UFixed18 totalMaintenance, UFixed18 totalCollateral);
error CollateralInsufficientCollateralError();
error CollateralUnderLimitError();
error CollateralZeroAddressError();
error CollateralAccountLiquidatingError(address account);
function token() external view returns (Token18);
function fees(address account) external view returns (UFixed18);
function initialize(IController controller_) external;
function depositTo(address account, IProduct product, UFixed18 amount) external;
function withdrawTo(address receiver, IProduct product, UFixed18 amount) external;
function withdrawFrom(address account, address receiver, IProduct product, UFixed18 amount) external;
function liquidate(address account, IProduct product) external;
function settleAccount(address account, Fixed18 amount) external;
function settleProduct(UFixed18 amount) external;
function collateral(address account, IProduct product) external view returns (UFixed18);
function collateral(IProduct product) external view returns (UFixed18);
function shortfall(IProduct product) external view returns (UFixed18);
function liquidatable(address account, IProduct product) external view returns (bool);
function liquidatableNext(address account, IProduct product) external view returns (bool);
function resolveShortfall(IProduct product, UFixed18 amount) external;
function claimFee() external;
}