Overview
Currently only the address initiating the transaction can be recorded as the payer. Add delegation so a sponsoring address can pay an invoice on behalf of another address (e.g. a company paying on behalf of an employee).
Acceptance Criteria
pay_invoice_delegated(invoice_id, on_behalf_of: Address) function
- Caller provides funds;
on_behalf_of address is recorded as the payer
on_behalf_of must have signed a delegation authorization stored via set_delegation(invoice_id, delegate: Address)
set_delegation callable only by the address granting the delegation
- Delegation is single-use — consumed on first
pay_invoice_delegated call
- Payment history records both the
payer (on_behalf_of) and executor (caller)
- Emits
DelegatedPayment { invoice_id, payer, executor, amount, ledger } event
- Integration tests: delegation grant → delegated pay, replay attack prevention
Overview
Currently only the address initiating the transaction can be recorded as the payer. Add delegation so a sponsoring address can pay an invoice on behalf of another address (e.g. a company paying on behalf of an employee).
Acceptance Criteria
pay_invoice_delegated(invoice_id, on_behalf_of: Address)functionon_behalf_ofaddress is recorded as the payeron_behalf_ofmust have signed a delegation authorization stored viaset_delegation(invoice_id, delegate: Address)set_delegationcallable only by the address granting the delegationpay_invoice_delegatedcallpayer(on_behalf_of) andexecutor(caller)DelegatedPayment { invoice_id, payer, executor, amount, ledger }event