-
Notifications
You must be signed in to change notification settings - Fork 77
/
Copy pathEventsLib.sol
150 lines (132 loc) · 6.09 KB
/
EventsLib.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;
import {Id, MarketParams} from "../interfaces/IMorpho.sol";
/// @title EventsLib
/// @author Morpho Labs
/// @custom:contact [email protected]
/// @notice Library exposing events.
library EventsLib {
/// @notice Emitted when setting a new owner.
/// @param newOwner The new owner of the contract.
event SetOwner(address indexed newOwner);
/// @notice Emitted when setting a new fee.
/// @param id The market id.
/// @param newFee The new fee.
event SetFee(Id indexed id, uint256 newFee);
/// @notice Emitted when setting a new fee recipient.
/// @param newFeeRecipient The new fee recipient.
event SetFeeRecipient(address indexed newFeeRecipient);
/// @notice Emitted when enabling an IRM.
/// @param irm The IRM that was enabled.
event EnableIrm(address indexed irm);
/// @notice Emitted when enabling an LLTV.
/// @param lltv The LLTV that was enabled.
event EnableLltv(uint256 lltv);
/// @notice Emitted when creating a market.
/// @param id The market id.
/// @param marketParams The market that was created.
event CreateMarket(Id indexed id, MarketParams marketParams);
/// @notice Emitted on supply of assets.
/// @dev Warning: `feeRecipient` receives some shares during interest accrual without any supply event emitted.
/// @param id The market id.
/// @param caller The caller.
/// @param onBehalf The owner of the modified position.
/// @param assets The amount of assets supplied.
/// @param shares The amount of shares minted.
event Supply(Id indexed id, address indexed caller, address indexed onBehalf, uint256 assets, uint256 shares);
/// @notice Emitted on withdrawal of assets.
/// @param id The market id.
/// @param caller The caller.
/// @param onBehalf The owner of the modified position.
/// @param receiver The address that received the withdrawn assets.
/// @param assets The amount of assets withdrawn.
/// @param shares The amount of shares burned.
event Withdraw(
Id indexed id,
address caller,
address indexed onBehalf,
address indexed receiver,
uint256 assets,
uint256 shares
);
/// @notice Emitted on borrow of assets.
/// @param id The market id.
/// @param caller The caller.
/// @param onBehalf The owner of the modified position.
/// @param receiver The address that received the borrowed assets.
/// @param assets The amount of assets borrowed.
/// @param shares The amount of shares minted.
event Borrow(
Id indexed id,
address caller,
address indexed onBehalf,
address indexed receiver,
uint256 assets,
uint256 shares
);
/// @notice Emitted on repayment of assets.
/// @param id The market id.
/// @param caller The caller.
/// @param onBehalf The owner of the modified position.
/// @param assets The amount of assets repaid. May be 1 over the corresponding market's `totalBorrowAssets`.
/// @param shares The amount of shares burned.
event Repay(Id indexed id, address indexed caller, address indexed onBehalf, uint256 assets, uint256 shares);
/// @notice Emitted on supply of collateral.
/// @param id The market id.
/// @param caller The caller.
/// @param onBehalf The owner of the modified position.
/// @param assets The amount of collateral supplied.
event SupplyCollateral(Id indexed id, address indexed caller, address indexed onBehalf, uint256 assets);
/// @notice Emitted on withdrawal of collateral.
/// @param id The market id.
/// @param caller The caller.
/// @param onBehalf The owner of the modified position.
/// @param receiver The address that received the withdrawn collateral.
/// @param assets The amount of collateral withdrawn.
event WithdrawCollateral(
Id indexed id, address caller, address indexed onBehalf, address indexed receiver, uint256 assets
);
/// @notice Emitted on liquidation of a position.
/// @param id The market id.
/// @param caller The caller.
/// @param borrower The borrower of the position.
/// @param repaidAssets The amount of assets repaid. May be 1 over the corresponding market's `totalBorrowAssets`.
/// @param repaidShares The amount of shares burned.
/// @param seizedAssets The amount of collateral seized.
/// @param badDebtAssets The amount of assets of bad debt realized.
/// @param badDebtShares The amount of borrow shares of bad debt realized.
event Liquidate(
Id indexed id,
address indexed caller,
address indexed borrower,
uint256 repaidAssets,
uint256 repaidShares,
uint256 seizedAssets,
uint256 badDebtAssets,
uint256 badDebtShares
);
/// @notice Emitted on flash loan.
/// @param caller The caller.
/// @param token The token that was flash loaned.
/// @param assets The amount that was flash loaned.
event FlashLoan(address indexed caller, address indexed token, uint256 assets);
/// @notice Emitted when setting an authorization.
/// @param caller The caller.
/// @param authorizer The authorizer address.
/// @param authorized The authorized address.
/// @param newIsAuthorized The new authorization status.
event SetAuthorization(
address indexed caller, address indexed authorizer, address indexed authorized, bool newIsAuthorized
);
/// @notice Emitted when setting an authorization with a signature.
/// @param caller The caller.
/// @param authorizer The authorizer address.
/// @param usedNonce The nonce that was used.
event IncrementNonce(address indexed caller, address indexed authorizer, uint256 usedNonce);
/// @notice Emitted when accruing interest.
/// @param id The market id.
/// @param prevBorrowRate The previous borrow rate.
/// @param interest The amount of interest accrued.
/// @param feeShares The amount of shares minted as fee.
event AccrueInterest(Id indexed id, uint256 prevBorrowRate, uint256 interest, uint256 feeShares);
}