Skip to content

Commit b06e552

Browse files
committed
docs: enhance receiveApproval function documentation with important notes on order matching and deal cost calculation
1 parent 024675e commit b06e552

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

contracts/facets/IexecEscrowTokenFacet.sol

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ contract IexecEscrowTokenFacet is IexecEscrowToken, IexecTokenSpender, FacetBase
8080
* The `data` parameter should be ABI-encoded orders if matching is desired:
8181
* abi.encode(appOrder, datasetOrder, workerpoolOrder, requestOrder)
8282
*
83+
* @dev Important notes:
84+
* - Match orders sponsoring is NOT supported. The requester (sender) always pays for the deal.
85+
* - Clients must compute the exact deal cost and deposit the right amount for the deal to be matched.
86+
* The deal cost = (appPrice + datasetPrice + workerpoolPrice) * volume.
87+
* - If insufficient funds are deposited, the match will fail.
8388
*
8489
* @param sender The address that approved tokens (must be requester if matching)
8590
* @param amount Amount of tokens approved and to be deposited
@@ -90,6 +95,9 @@ contract IexecEscrowTokenFacet is IexecEscrowToken, IexecTokenSpender, FacetBase
9095
*
9196
* @custom:example
9297
* ```solidity
98+
* // Compute deal cost
99+
* uint256 dealCost = (appPrice + datasetPrice + workerpoolPrice) * volume;
100+
*
93101
* // Encode orders
94102
* bytes memory data = abi.encode(appOrder, datasetOrder, workerpoolOrder, requestOrder);
95103
*

0 commit comments

Comments
 (0)