User Flows
Settle PnL
Key user flow walkthroughs
Any realized and unrealized PnL accrued from open or closed positions needs to be “Settled” into the USDC balance of the account. PnL settlement can happen anytime for any account if other users trigger a settlement. Any user can also trigger PnL settlement of their own account by following these steps:
1
Get a Settle PnL nonce
Get a nonce from Get settle PnL nonce.
2
Obtain signature from EIP-712
Sign an EIP-712 message in the following format:
where:
Name | Type | Required | Description |
---|---|---|---|
brokerId | string | Y | Broker ID, the valid list can be found [here] |
chainId | int | Y | Chain ID of the connected chain where the message was signed |
settleNonce | int | Y | Valid withdrawal nonce from Get settle PnL nonce |
timestamp | timestamp | Y | current timestamp in UNIX milliseconds |
3
Request PnL settlement
Request a PnL settlement through Request Pnl settlement API.
Example
The example code is very similar to the Orderly key registration, except it uses the EIP-712 on-chain domain and the signed message is different.