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);
Name | Type | Description |
---|---|---|
x | FulfillmentContext | The FulfillmentContext struct to pack |
Name | Type | Description |
---|---|---|
<none> | uint256 | Packed uint256 containing valid bit and price |
unpack
Unpacks the struct from a single uint256
function unpack(uint256 packed) internal pure returns (FulfillmentContext memory);
Name | Type | Description |
---|---|---|
packed | uint256 | Packed uint256 containing the valid bit and price |
Name | Type | Description |
---|---|---|
<none> | FulfillmentContext | The unpacked FulfillmentContext struct |
store
Packs and stores the object to transient storage
function store(FulfillmentContext memory x, bytes32 requestDigest) internal;
Name | Type | Description |
---|---|---|
x | FulfillmentContext | The FulfillmentContext struct to store |
requestDigest | bytes32 | The storage key for the transient storage |
load
Loads from transient storage and unpacks to FulfillmentContext
function load(bytes32 requestDigest) internal view returns (FulfillmentContext memory);
Name | Type | Description |
---|---|---|
requestDigest | bytes32 | The storage key to load from |
Name | Type | Description |
---|---|---|
<none> | FulfillmentContext | The loaded and unpacked FulfillmentContext struct |