Skip to main content
External library used to pack and unpack values

pack

function pack(uint256[] _values, uint256[] _bitLengths) external pure returns (uint256 packed)
Packs values array into a single uint256

Parameters

NameTypeDescription
_valuesuint256[]values to pack
_bitLengthsuint256[]corresponding bit lengths for each value

unpack

function unpack(uint256 _packed, uint256[] _bitLengths) external pure returns (uint256[] values)
Unpacks a single uint256 into an array of values

Parameters

NameTypeDescription
_packeduint256packed value
_bitLengthsuint256[]corresponding bit lengths for each value

unpack256To64

function unpack256To64(uint256 _packed) external pure returns (uint64 a, uint64 b, uint64 c, uint64 d)
Unpacks a single uint256 into 4 uint64 values

Parameters

NameTypeDescription
_packeduint256packed value

Return Values

NameTypeDescription
auint64returned value 1
buint64returned value 2
cuint64returned value 3
duint64returned value 4

unpackTriggerOrder

function unpackTriggerOrder(uint256 _packed) external pure returns (uint8 orderType, address trader, uint32 index)
Unpacks trigger order calldata into 3 values

Parameters

NameTypeDescription
_packeduint256packed value

Return Values

NameTypeDescription
orderTypeuint8order type
traderaddresstrader address
indexuint32trade index