Events
Useful events are emitted when interacting with the Morpho protocol, which enables position tracking for example.
Emitted once a supply transaction is successful. It contains the total amount supplied by the user which is currently matched in peer-to-peer with borrowers (
_balanceInP2P
) and the total amount supplied by the user to the underlying protocol's pool, which may get matched later with new borrowers (_balanceOnPool
).Units are not standardized!
To get the underlying ERC20 token amount equivalent, compute:
balanceInP2PInUnderlying = _balanceInP2P.mul(
_p2pSupplyIndex)
balanceOnPoolInUnderlying = _balanceOnPool.mul(_poolSupplyIndex)
Where
_p2pSupplyIndex
is the current supply index (as a WAD-point number) used by Morpho to accrue interests and _poolSupplyIndex
is the current underlying pool token supply exchange rate (as a WAD-point number). See CompoundMath for further details.event Supplied(
address indexed _supplier,
address indexed _onBehalf,
address indexed _poolTokenAddress,
uint256 _amount,
uint256 _balanceOnPool,
uint256 _balanceInP2P,
);
Parameter | Type | Description |
---|---|---|
_supplier | address | The address sending the underlying tokens. |
_onBehalf | address | The address of the supplier who benefits from the supplied amount. |
_poolTokenAddress | address | The address of the underlying protocol's pool token to supply to. |
_amount | uint256 | The amount of underlying ERC20 supplied by the user in this transaction. |
_balanceOnPool | uint256 | The total balance of underlying pool token supplied on pool by the user (in pool unit). |
_balanceInP2P | uint256 | The total balance supplied by the user and matched in peer-to-peer (in peer-to-peer unit). |
Emitted once a borrow transaction is successful. It contains the total amount borrowed by the user which is currently matched in peer-to-peer with suppliers (
_balanceInP2P
) and the total amount borrowed by the user from the underlying protocol's pool, which may get matched later with new suppliers (_balanceOnPool
).Units are not standardized!
To get the underlying ERC20 token amount equivalent, compute:
balanceInP2PInUnderlying = _balanceInP2P.mul(
_p2pBorrowIndex)
balanceOnPoolInUnderlying = _balanceOnPool.mul(_poolBorrowIndex)
Where
_p2pBorrowIndex
is the current borrow index (as a WAD-point number) used by Morpho to accrue interests and _poolBorrowIndex
is the current underlying pool token borrow exchange rate (as a WAD-point number). See CompoundMath for further details.event Borrowed(
address indexed _user,
address indexed _poolTokenAddress,
uint256 _amount,
uint256 _balanceOnPool,
uint256 _balanceInP2P,
);
Parameter | Type | Description |
---|---|---|
_user | address | The address of the borrower. |
_poolTokenAddress | address | The address of the underlying protocol's pool token to borrow from. |
_amount | uint256 | The amount of underlying ERC20 borrowed by the user in this transaction. |
_balanceOnPool | uint256 | The total balance of underlying pool token borrowed from the pool by the user (in pool unit). |
_balanceInP2P | uint256 | The total balance borrowed by the user and matched in peer-to-peer (in peer-to-peer unit). |
Emitted once a withdraw transaction is successful. It contains the total amount supplied by the user which is currently matched in peer-to-peer with borrowers (
_balanceInP2P
) and the total amount supplied by the user to the underlying protocol's pool, which may get matched later with new borrowers (_balanceOnPool
).Units are not standardized!
To get the underlying ERC20 token amount equivalent, compute:
balanceInP2PInUnderlying = _balanceInP2P.mul(
_p2pSupplyIndex)
balanceOnPoolInUnderlying = _balanceOnPool.mul(_poolSupplyIndex)
Where
_p2pSupplyIndex
is the current supply index (as a WAD-point number) used by Morpho to accrue interests and _poolSupplyIndex
is the current underlying pool token supply exchange rate (as a WAD-point number). See CompoundMath for further details. event Withdrawn(
address indexed _supplier,
address indexed _receiver,
address indexed _poolTokenAddress,
uint256 _amount,
uint256 _balanceOnPool,
uint256 _balanceInP2P
);
The
Withdrawn
event is emitted when a withdraw transaction is successful.Parameter | Type | Description |
---|---|---|
_supplier | address | The address of the supplier whose supply is withdrawn. |
_receiver | address | The address receiving the withdrawn underlying tokens. |
_poolTokenAddress | address | The address of the underlying protocol's pool token to withdraw from. |
_amount | uint256 | The amount of underlying ERC20 withdrawn by the user in this transaction. |
_balanceOnPool | uint256 | The total balance of underlying pool token supplied on pool by the user (in pool unit). |
_balanceInP2P | uint256 | The total balance supplied by the user and matched in peer-to-peer (in peer-to-peer unit). |
Emitted once a repay transaction is successful. It contains the total amount borrowed by the user which is currently matched in peer-to-peer with suppliers (
_balanceInP2P
) and the total amount borrowed by the user from the underlying protocol's pool, which may get matched later with new suppliers (_balanceOnPool
).Units are not standardized!
To get the underlying ERC20 token amount equivalent, compute:
balanceInP2PInUnderlying = _balanceInP2P.mul(
_p2pBorrowIndex)
balanceOnPoolInUnderlying = _balanceOnPool.mul(_poolBorrowIndex)
Where
_p2pBorrowIndex
is the current borrow index (as a WAD-point number) used by Morpho to accrue interests and _poolBorrowIndex
is the current underlying pool token borrow exchange rate (as a WAD-point number). See CompoundMath for further details.event Repaid(
address indexed _repayer,
address indexed _onBehalf,
address indexed _poolTokenAddress,
uint256 _amount,
uint256 _balanceOnPool,
uint256 _balanceInP2P,
);
The
Repaid
event is emitted when a repay transaction is successful.Parameter | Type | Description |
---|---|---|
_repayer | address | The address of the repayer. |
_onBehalf | address | The borrower who benefits from the repaid amount. |
_poolTokenAddress | address | The address of the underlying protocol's pool token to repay to. |
_amount | uint256 | The amount of underlying ERC20 repaid by the user in this transaction. |
_balanceOnPool | uint256 | The total balance of underlying pool token borrowed from the pool by the user (in pool unit). |
_balanceInP2P | uint256 | The total balance borrowed by the user and matched in peer-to-peer (in peer-to-peer unit). |
Emitted once a liquidation is successful. It contains the amount repaid by the liquidator to cover the debt of the liquidated user (
_amountRepaid
), as well as the amount of collateral token seized to the liquidator (which includes the liquidation premium, _amountSeized
).This event emits amounts repaid and seized in the underlying ERC20 token unit.
event Liquidated(
address _liquidator,
address indexed _liquidated,
address indexed _poolTokenBorrowedAddress,
uint256 _amountRepaid,
address indexed _poolTokenCollateralAddress,
uint256 _amountSeized,
);
Parameter | Type | Description |
---|---|---|
_liquidator | address | The address of the liquidator who repaid the debt. |
_liquidated | address | The address of the user liquidated. |
_amountRepaid | uint256 | The total amount of underlying ERC20 repaid. |
_poolTokenBorrowedAddress | address | The address of the borrowed asset. |
_amountSeized | uint256 | The total amount of underlying ERC20 collateral seized. |
_poolTokenCollateralAddress | address | The address of the collateral asset seized. |
Emitted whenever a supplier's position in Morpho's priority queue is updated (e.g. whenever a supplier is matched or unmatched with a borrower). It contains the total amount supplied by the user which is currently matched in peer-to-peer with borrowers (
_balanceInP2P
) and the total amount supplied by the user to the underlying protocol's pool, which may get matched later with new borrowers (_balanceOnPool
).Units are not standardized!
To get the underlying ERC20 token amount equivalent, compute:
balanceInP2PInUnderlying = _balanceInP2P.mul(
_p2pSupplyIndex)
balanceOnPoolInUnderlying = _balanceOnPool.mul(_poolSupplyIndex)
Where
_p2pSupplyIndex
is the current supply index (as a WAD-point number) used by Morpho to accrue interests and _poolSupplyIndex
is the current underlying pool token supply exchange rate (as a WAD-point number). See CompoundMath for further details.event SupplierPositionUpdated(
address indexed _user,
address indexed _poolTokenAddress,
uint256 _balanceOnPool,
uint256 _balanceInP2P,
);
Parameter | Type | Description |
---|---|---|
_user | address | The address of the supplier. |
_poolTokenAddress | address | The address of the underlying protocol's pool token on which the supplier's position was updated. |
_balanceOnPool | uint256 | The total balance of underlying pool token supplied on pool by the user (in pool unit). |
_balanceInP2P | uint256 | The total balance supplied by the user and matched in peer-to-peer (in P2P unit). |
Emitted whenever a borrower's position in Morpho's priority queue is updated (e.g. whenever a borrower is matched or unmatched with a supplier). It contains the total amount borrowed by the user which is currently matched in peer-to-peer with suppliers (
_balanceInP2P
) and the total amount borrowed by the user from the underlying protocol's pool, which may get matched later with new suppliers (_balanceOnPool
).Units are not standardized!
To get the underlying ERC20 token amount equivalent, compute:
balanceInP2PInUnderlying = _balanceInP2P.mul(_p2pBorrowIndex)
balanceOnPoolInUnderlying = _balanceOnPool.mul(_poolBorrowIndex)
Where
_p2pBorrowIndex
is the current borrow index (as a WAD-point number) used by Morpho to accrue interests and _poolBorrowIndex
is the current underlying pool token borrow exchange rate (as a WAD-point number). See CompoundMath for further details.event BorrowerPositionUpdated(
address indexed _user,
address indexed _poolTokenAddress,
uint256 _balanceOnPool,
uint256 _balanceInP2P,
);
Parameter | Type | Description |
---|---|---|
_user | address | The address of the borrower |
_poolTokenAddress | address | The address of the underlying protocol's pool token on which the borrower's position was updated. |
_balanceOnPool | uint256 | The total balance of underlying pool token borrowed from the pool by the user (in pool unit). |
_balanceInP2P | uint256 | The total balance borrowed by the user and matched in peer-to-peer (in P2P unit). |
Emitted whenever the delta mechanism is triggered on the supply side (because of an excess of liquidity due to an incompletely handled repay). It contains the address of the underlying protocol's pool targeted by the delta (
_poolTokenAddress
) and the difference between the amount virtually supplied in peer-to-peer and the amount truly matched in peer-to-peer (_p2pSupplyDelta
).Units are not standardized!
To get the underlying ERC20 token amount equivalent, compute:
p2pSupplyDeltaInUnderlying = _p2pSupplyDelta.mul(
_p2pSupplyIndex)
Where
p2pSupplyIndex
is the current supply index (as a WAD-point number) used by Morpho to accrue interests. See CompoundMath for further details.event P2PSupplyDeltaUpdated(
address indexed _poolTokenAddress,
uint256 _p2pSupplyDelta,
);
Parameter | Type | Description |
---|---|---|
_poolTokenAddress | address | The address of the underlying protocol's pool token on which the supply delta is udpated. |
_p2pSupplyDelta | uint256 | The difference between the amount virtually supplied in peer-to-peer and the amount truly matched in peer-to-peer. |
Emitted whenever the delta mechanism is triggered on the borrow side (because of an excess of debt due to an incompletely handled withdrawal). It contains the address of the underlying protocol's pool targeted by the delta (
_poolTokenAddress
) and the difference between the amount virtually borrowed in peer-to-peer and the amount truly matched in peer-to-peer (_p2pBorrowDelta
).Units are not standardized!
To get the underlying ERC20 token amount equivalent, compute:
p2pBorrowDeltaInUnderlying = _p2pBorrowDelta.mul(
_p2pBorrowIndex)
Where
p2pBorrowIndex
is the current borrow index (as a WAD-point number) used by Morpho to accrue interests. See CompoundMath for further details.event P2PBorrowDeltaUpdated(
address indexed _poolTokenAddress,
uint256 _p2pBorrowDelta,
);
Parameter | Type | Description |
---|---|---|
_poolTokenAddress | address | The address of the underlying protocol's pool token on which the borrow delta is udpated. |
_p2pBorrowDelta | uint256 | The difference between the amount virtually borrowed in peer-to-peer and the amount truly matched in peer-to-peer. |
Last modified 1mo ago