MarginCallSubSkeleton
Implementation of the MarginCall sub-skeleton facet for the TMI-Fraction Protocol.
This facet serves as a sub-core component (sub-skeleton) of a TMI-Fraction Platform, enabling eligible users (e.g., campaign issuers)
to add margin and prevent liquidation when their campaign is in the MARGIN_CALL
state. This sub-skeleton is intended for Platforms
that support SALE BBO (BuyBackOption) campaigns.
IMPORTANT:
- This implementation is intended only for Platforms that issue SALE BBO (BuyBackOption) campaigns.
- The margin amount is denominated in the campaign's funding packet.
The process of adding margin to prevent campaign liquidation is triggered when addMargin()
is executed, following a sequential
pipeline of five phases:
-
State Check: The Platform interacts with its
MarginCallState
sub-internal facet to verify that the current state of the targeted campaign is the correct state for margin addition to occur (i.e., inMARGIN_CALL
state). -
Time Check: The Platform interacts with its
MarginCallTime
sub-internal facet to verify that the margin call period has not expired (i.e., current timestamp has not surpassed the configured ending timestamp of the campaign's current margin call). -
Eligibility Check: The Platform interacts with its
MarginCallHedgerEligibility
sub-internal facet to verify the eligibility of the user (caller) attempting to add margin (e.g., only the creator of the campaign is allowed). -
Amount Check: The Platform interacts with its
MarginCallAmount
sub-internal facet to verify that the specified amount of funds to be added as margin meets the campaign's current margin call requirements (e.g., accounting for configured thresholds and any previous margin additions). -
Add Margin Action: The Platform interacts with its
DoAddMargin
sub-internal facet to transfer the specified amount of funds from the user (caller) to the Platform and subsequently update the campaign's state to the one that allows for buyback, thereby finalizing the process.
MarginAdded
Emitted at addMargin()
.
addMargin
Allows users to add margin to prevent the liquidation of the specified SALE BBO campaign.
_Users must meet eligibility criteria (see marginCall
Eligibility sub-internal facets).
This action should only be allowed when the campaign's state is MARGIN_CALL
.
Emits a {MarginAdded} event._
Parameters
Name | Type | Description |
---|---|---|
campaignId | uint256 | The unique identifier of the targeted campaign. |
packetsMarginAmount | uint256 | The amount of funding packets to be added as margin. |