Keeping field order and precision intact in a Chainlink MVR bundle

A multi-variable response feed returns a bundle containing several values. Decoding every word as if it had the precision of the first field can produce plausible but incorrect numbers.

Associate each decoded numeric field with its own scale

Obtain the schema for the specific feed, decode latestBundle() accordingly and read bundleDecimals() where applicable. This illustrative two-number bundle has scales six and two. Its first raw value represents 123.456789 and its second represents 25.00. The example prints the integer part and unpadded remainder for each position.

const values = [123456789n, 2500n];
const scales = [6, 2];
console.log(values.map((v, i) => [v / 10n**BigInt(scales[i]), v % 10n**BigInt(scales[i])]));

Validate the bundle as a unit

Read its timestamp and metadata in the same block context as the payload. Fix the expected field labels, types and ordering in a decoding fixture so a schema mismatch fails before a dashboard is updated. A tuple of the expected length is not sufficient validation: swapping two integer fields can still decode without an ABI error. Non-numeric fields need their own schema-defined handling.

docs.chain.link MVR feed components