Skip to content
Logo

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, Buffer or Uint8Array
  • 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, Buffer or Uint8Array
  • Default: empty

Calldata for the delegate call. There is no value parameter — DELEGATECALL cannot transfer ether.

Errors

ConditionError
destination not 20 bytes / malformed hexTypeError
Output larger than the machine's output bufferRollupError with negative errno