Topup

Adjusting collateral requirements during the deal.

Once a deal is taken, both parties can send requests to each other in the form of a Topup request.

This is a request to add to the currently existing collateral. You can only add not remove collateral.

This feature is meant to give traders more freedom and control over their deal.

This is meant to increase your risk or profit exposure based on changing market sentiment.

Conditions:

  • Deal must be active and not expired or settled.

  • Requests are not limited.

  • One party sends a request first.

  • The other party has to accept request for it to be binding.

  • Collateral is then moved from both parties and locked in use.

  • For Call and Put Options, collateral is moved direct from Taker to Writer.

  • For Equity Swaps collateral is only locked in use, incrementing the value of the deal.

  • Once added the collateral cant be removed.

topupHedge Function

This function is unified to handle requests by both parties. It only accepts requests from taker or writer. It uses msg.sender to determine if party wants to increment topup request or initiate it.

It actively transfers token balances to lockedInUse on acceptance or request.

If a request is not accepted, the requester can increment the active request amount.

All requests are stored under the hedge struct, under the array hedge.topupRequests. It works alongside topupMap[topupRequestID].state as the global mapping that keeps track of the status of each request outside the hedge struct.

Depending on the party, after all the above are updated and msg.sender has enough balance in vault to proceed, we update topupMap[topupRequestID].amountWriter and topupMap[topupRequestID].amountTaker.

Finally, hedge.cost and hedge.amount are updated for the hedgeMap to reflect the new collateral amounts for the deal.

rejectTopupRequest Function

Rejecting and cancelling are handled outside of the topupHedge function. Using the functions:

rejectTopupRequest

cancelTopupRequest

Both which point to the same mapping topupMap used in request above.

Topup mapping is then updated to rejected or falsetopupMap[_requestID].state = 2; so the request disappears from the deal page.

cancelTopupRequest Function

A separate function to cancel the requests stored in the topupMap by request Id.

Only the creator of the request can cancel, on condition the request was not accepted already by the other party.

Last updated

Logo

Xeon Protocol © 2024