Messages: CreateCompensate and ExecuteOrCancelCompensate
The CreateCompensate message allows the executor to register a Compensate request that is executable after three days using ExecutorOrCancelCompensate. It may be canceled at any time.
Only the compensator may create, execute, or cancel these requests.
Executing the Compensate request performs the following actions:
Deletes an
orderIdfromliquidityOrdersorperpOrdersandperpOrderEx, iforderTypeis not nullTransfers an arbitrary amount of jettons to an arbitrary address, if
refundReceiveris not null andrefundAmountis nonzeroTransfers an arbitrary fee to the compensate receiver, if
executionFeeReceiveris not null andexecutionFeeis nonzeroDeletes the
compensateId(request ID) from the map that stores the requests
Inputs
The incoming messages have the following structures:
orderTypeValidation: None.
Impact: Determines which map the
orderIdshould be removed from, if any.
orderIdValidation: None.
Impact: Determines which value to remove from the map chosen by
orderType. If the order does not exist, the request can still be created, but when executed, nothing will be removed from the map.
trxIdValidation: None.
Impact: Identifier for the message — does not affect handler logic.
refundReceiverValidation: None.
Impact: If not null and
refundAmountis greater than zero, the executor will transferrefundAmountto this address. If null, no transfer occurs.
refundAmountValidation: None.
Impact: If greater than zero and
refundReceiveris not null, the executor will transfer this amount torefundReceiver. If zero, no transfer occurs.
executionFeeReceiverValidation: None.
Impact: If not null and
executionFeeis greater than zero, the executor will transferexecutionFeeto this address. If null, no transfer occurs.
executionFeeValidation: None.
Impact: If greater than zero and
executionFeeReceiveris not null, the executor will transfer this amount toexecutionFeeReceiver. If zero, no transfer occurs.
isCancelValidation: None.
Impact: If
true, the request is canceled. Iffalse, the request is executed.
compensateIdValidation: The
unlockTimeassociated with thiscompensateIdmust be less than the current time.Impact: Specifies which request to execute or cancel. The request is always removed from the map on successful execution of the handler.
trxIdValidation: None.
Impact: Identifier for the message — does not affect handler logic.
Test coverage
The tests cover the basic logic of the CreateCompensate and execute path of the ExecuteOrCancelCompensate messages.
We recommend adding tests to cover negative cases (e.g., where parameter validation fails) to prevent regressions.
Intended branches
Negative behavior