ERC-8492 Task Escrow Settlement Deduction Standard (Settlement Deductions for Task Escrows)
Draft · Vaults & DeFi · created 2026-11-09
A standard that lets an escrow paying out task compensation withhold third-party shares, such as taxes, referral fees, or loan repayments, at every payout, while ensuring that the deduction logic itself can never block the payout.
Why it is needed
Current on-chain escrows offer only two options: pay the full task amount to the payee and leave the entire third-party share, such as taxes, referral fees, or loan repayments, to the payee's goodwill, or charge a single fee set by an administrator. A per-task hook set by the requester can be removed by the requester, and if it reverts it blocks the task itself by design. As a result, existing approaches cannot provide a tax that neither the requester nor the payee can switch off, a repayment guarantee a lender can trust enough to advance funds, or an assurance that the payee still gets paid even if the deduction logic breaks.
What to implement
function onTaskCreated(uint256 taskId, address asset, uint256 amountPerSettlement) external;: When a task is created, the escrow notifies the policy of the task ID, the asset, and the expected payout size.function deductions(uint256 taskId, uint256 settlementId, address payee, uint256 amount) external returns (uint256 total);: Called before every payout, returning a single number for how much of the total amount the policy will withhold.event PayoutSettled(uint256 indexed taskId, uint256 indexed settlementId, address indexed payee, uint256 amount, uint256 deducted);: An event that records the payout amount and the deducted amount for every payout.event DeductionsSkipped(uint256 indexed taskId, uint256 indexed settlementId);: Signals that the policy's response was invalid, so the full amount was paid out with no deduction.event PayoutCredited(uint256 indexed taskId, uint256 indexed settlementId, address indexed payee, uint256 amount);: Signals that a payout amount that could not be delivered directly to the payee has been accrued as credit.event PayoutWithdrawn(uint256 indexed taskId, address indexed account, uint256 amount);: Signals that accrued credit has been withdrawn to the corresponding account.function creditOf(uint256 taskId, address account) external view returns (uint256);: Queries the amount of credit a specific account has not yet withdrawn from a specific task.function withdrawCredit(uint256 taskId, address account) external;: Can be called by anyone to transfer the full credit of an account to that account.function deductionPolicy() external view returns (address);: Returns the address of the deduction policy used by the escrow for its entire lifetime (0 if none).function deductionGas() external view returns (uint256);: Returns the fixed gas budget G always guaranteed for the policy call.function vaultOf(uint256 taskId) external view returns (address);: Returns the vault address where the task's funds are actually held and from which they are disbursed.function taxOf(address asset) external view returns (address treasury, uint16 bps);: Returns the tax recipient and the tax rate (in basis points) for a specific asset.function assignPayment(uint256 taskId, address recipient, uint16 bps, uint256 amount) external;: The payee assigns part of their payout to a recipient such as a referrer or a lender.function release(uint256 taskId, address payee) external;: Only the recipient who received the assignment can call this to release that assignment.function owedOf(uint256 taskId, address recipient) external view returns (uint256);: Queries the total deducted amount a specific recipient has not yet claimed.function claim(uint256 taskId, address recipient) external;: Can be called by anyone to actually pay out the deducted amount accrued to a recipient.
In depth
Separation of roles between the escrow and the policy
The escrow is responsible only for when and how safely to call the policy; the policy decides how much to withhold and to whom. The escrow calls onTaskCreated once at task creation to notify the policy of the asset and expected payout size, and calls deductions before every payout, receiving back only a single number, the deducted amount d. An approach that returns the full list of recipients was rejected, because it shifts the policy's bookkeeping burden onto every escrow. Thanks to this structure, escrow code shrinks to a few dozen lines, and the escrow never needs to be modified when a new kind of deduction is introduced.
Calling deductions before every payout, with a fixed payee
On every payout path except refunds (including the default and timeout paths), the escrow must call deductions(taskId, settlementId, payee, amount) before paying out, and settlementId must be unique within the task. The function that processes the payout cannot take payee as an argument, and the payee must already be fixed in escrow state before the payout. This prevents a payer from bypassing an assignment, when that assignment is bound to a specific address, by paying the same person at a new address.
The fixed gas budget G and starvation prevention
The escrow must apply a constant gas limit G to the policy call across the entire escrow, and before the call it must verify that gasleft() exceeds G*64/63 plus the cost of the call itself. Under EIP-150's 63/64 rule, without this check a caller could send just enough gas to make the policy call fail, turning the payout into a full-amount payout and skipping deductions such as a lender's share. With this check in place, a failure within the budget can only be interpreted as a genuine policy error.
Failed or invalid responses are treated as full payout
A response is valid only if the policy call succeeds, returns exactly 32 bytes, and the returned value d is at most amount. If it is invalid (the call fails, there is no code, the return is out of range, etc.), the escrow must pay the full amount to the payee and emit a DeductionsSkipped event. Under no circumstances can a policy failure or bug block a payout, preventing a single policy defect from freezing payouts across the entire escrow.
The credit ledger and four events
The amount d withheld by the policy is not delivered immediately; it accrues as the policy's credit in the task's vault and can only be withdrawn via withdrawCredit, callable by anyone. During settlement, no deduction recipient, such as a tax collector, referrer, or lender, is ever called, so none of them can block settlement or trigger reentrancy. Every payout leaves a PayoutSettled record, a rejected transfer leaves a PayoutCredited record, and a withdrawal leaves a PayoutWithdrawn record, letting a third party reconstruct the ledger without any escrow-specific events.
Constraints the policy must observe
The deductions function cannot CALL, CALLCODE, or STATICCALL any account other than a precompile, cannot create an account or SELFDESTRUCT, and cannot write to a storage slot that was previously empty (only updating pre-allocated slots is allowed). This is because, under a gas schedule like EIP-8037 that prices storage creation separately from execution gas, a policy creating a new slot would break the guarantee of the fixed gas budget G. onTaskCreated and deductions must only be callable by their own escrow.
Reference policy profile (optional)
The standard optionally presents a reference implementation. Taxes are read once from ITaxSchedule at task creation and locked to that task, so a later rate change does not affect tasks already created. Referral fees and loan repayments can only be assigned to a payee's own payout via assignPayment, cannot be revoked, and can only be released by that recipient via release. The sum of all deductions cannot exceed the cap set by maxDeductionBps, and tax is deducted first, followed by assignments in the order they were made.
A proposal still in Draft stage
This proposal is in Draft status, written in November 2026, and is still undergoing community discussion and implementation review. Interface identifiers or detailed requirements may change in future discussion, or the proposal itself may stall.
Things to watch out for
- The policy is trusted by the deployer, not by the payee: Even a policy that complies with the specification can withhold up to the entire payout. The payee must verify the escrow's policy and its cap directly before performing the task, which is also why the reference profile has a fixed cap.
- Policies, schedules, and escrows that can change: The policy's address is fixed, but its code is not. An upgradeable proxy, a policy whose owner can change its rules, or an EIP-7702 delegated account that its key holder can reassign can all alter the payout outcome of an already-open task or halt deductions, so a policy that wants to be trusted must be immutable.
- Manipulating the tax rate around task creation: Because the tax rate is locked at task creation, whoever manages the schedule can raise the rate right before a task is created and lower it right after, locking a high rate onto that particular task alone. Payees and lenders should check lockedTaxOf before working or lending.
- Gas starvation and future gas repricing: The escrow must set G to cover the policy's worst case, with margin for future gas price repricing as well. If a network upgrade pushes the policy over G, every payout turns into a full-amount payout with no deduction.
- Reentrancy: A policy cannot make external calls within deductions, and no other payout, withdrawal, or refund can begin during a payout. Since the transfer step of a payout can execute the asset's or the payee's code, without this ordering guarantee reentrancy could corrupt the ledger.