Function: amend(address account, AmendArgs args)
This function amends an existing limit order for the specified account. It can be called by the account itself or an approved operator, and it handles matching and settling amended orders with the existing order book. It also notifies the CLOBManager for token settlement and applies fees.
Inputs
account
Control: Full control.
Constraints: Should be
msg.sender
itself or an approved operator for theaccount
and the owner of the order.Impact: The owner of the order being amended.
args
Control: Full control.
Constraints:
args.limitOrderType
can only bePOST_ONLY
.Impact: Contains
orderId
,amountInBase
,price
,cancelTimestamp
,side
,limitOrderType
, andsettlement
.
Branches and code coverage
Intended branches
If
args.cancelTimestamp
is less than the currentblock.timestamp
, the order will be canceled successfully without a fee.If
args.amountInBase
is less than thesettings.minLimitOrderAmountInBase
, the order will be canceled successfully without a fee.The
side
of the order has been changed successfully.The
price
of the order has been updated successfully.
Negative behavior
order.owner != account
.The caller is not an
account
oroperator
of the account.price % tickSize != 0
.args.price == 0
.limitOrderType == LimitOrderType.GOOD_TILL_CANCELLED
.order.id
does not exist.