Skip to content

FulfillmentContextLibrary

Library for packing, unpacking, and storing FulfillmentContext structs

Uses bit manipulation to pack all fields into a single uint256 for transient storage

State Variables

VALID_MASK

uint256 private constant VALID_MASK = 1 << 127;

PRICE_MASK

uint256 private constant PRICE_MASK = (1 << 96) - 1;

Functions

pack

Packs the struct into a single 256-bit slots and sets the validation bit.

function pack(FulfillmentContext memory x) internal pure returns (uint256);
Parameters
NameTypeDescription
xFulfillmentContextThe FulfillmentContext struct to pack
Returns
NameTypeDescription
<none>uint256Packed uint256 containing valid bit and price

unpack

Unpacks the struct from a single uint256

function unpack(uint256 packed) internal pure returns (FulfillmentContext memory);
Parameters
NameTypeDescription
packeduint256Packed uint256 containing the valid bit and price
Returns
NameTypeDescription
<none>FulfillmentContextThe unpacked FulfillmentContext struct

store

Packs and stores the object to transient storage

function store(FulfillmentContext memory x, bytes32 requestDigest) internal;
Parameters
NameTypeDescription
xFulfillmentContextThe FulfillmentContext struct to store
requestDigestbytes32The storage key for the transient storage

load

Loads from transient storage and unpacks to FulfillmentContext

function load(bytes32 requestDigest) internal view returns (FulfillmentContext memory);
Parameters
NameTypeDescription
requestDigestbytes32The storage key to load from
Returns
NameTypeDescription
<none>FulfillmentContextThe loaded and unpacked FulfillmentContext struct