rollup.emitDelegateCallVoucher
Emits a delegate-call voucher — like a voucher, but executed with DELEGATECALL: the destination's code runs in the application contract's own storage context, address and balance. An advanced primitive for library-style execution and upgrade patterns; with great power comes great responsibility over the application contract's state.
Encoded on-chain as DelegateCallVoucher(address,bytes) and added to the outputs merkle tree (provable).
Usage
const = .({
: "0x5FbDB2315678afecb367f032d93F642f64180aa3", // library contract
: ,
});Returns
bigint — the output index among all provable outputs ever emitted by the application.
Parameters
destination
- Type:
AddressLike— 0x-prefixed hex string,BufferorUint8Array - Required; must be exactly 20 bytes
The contract whose code will run in the application contract's context.
payload
- Type:
BytesLike— 0x-prefixed hex string,BufferorUint8Array - Default: empty
Calldata for the delegate call. There is no value parameter — DELEGATECALL cannot transfer ether.
Errors
| Condition | Error |
|---|---|
destination not 20 bytes / malformed hex | TypeError |
| Output larger than the machine's output buffer | RollupError with negative errno |