#
Solidity API
#
Bytes
#
toBytes32
function toBytes32(bytes input, uint256 offset) internal pure returns (bytes32 output)
Converts a bytes
memory blob to a single bytes32
memory value, starting at the given byte offset.
#
equals
function equals(bytes a, bytes b) internal pure returns (bool)
#
setLength
function setLength(bytes input, uint256 length) internal pure returns (bytes)
In-place set the length of a bytes
memory value.
#
setBytes1
function setBytes1(bytes32 input, uint256 index, bytes1 overwrite) internal pure returns (bytes32 output)
Overwrite a single byte of a bytes32
value and return the new value.
#
setBytes2
function setBytes2(bytes32 input, uint256 index, bytes2 overwrite) internal pure returns (bytes32 output)
Overwrite two bytes of a bytes32
value and return the new value.
#
setBytes4
function setBytes4(bytes32 input, uint256 index, bytes4 overwrite) internal pure returns (bytes32 output)
Overwrite four bytes of a bytes32
value and return the new value.
#
setBytes4
function setBytes4(bytes input, uint256 offset, bytes4 overwrite) internal pure returns (bytes)
In-place overwrite four bytes of a bytes memory
value.
#
slice1
function slice1(bytes data, uint256 start) internal pure returns (bytes1)
Slice bytes to bytes1 without copying data
#
slice1
function slice1(bytes32 data, uint256 start) internal pure returns (bytes1)
#
slice2
function slice2(bytes data, uint256 start) internal pure returns (bytes2)
Slice bytes to bytes2 without copying data
#
slice2
function slice2(bytes32 data, uint256 start) internal pure returns (bytes2)
#
slice3
function slice3(bytes data, uint256 start) internal pure returns (bytes3)
Slice bytes to bytes3 without copying data
#
slice4
function slice4(bytes data, uint256 start) internal pure returns (bytes4)
Slice bytes to bytes4 without copying data
#
slice4
function slice4(bytes32 data, uint256 start) internal pure returns (bytes4)
#
slice5
function slice5(bytes data, uint256 start) internal pure returns (bytes5)
Slice bytes to bytes5 without copying data
#
slice6
function slice6(bytes data, uint256 start) internal pure returns (bytes6)
Slice bytes to bytes6 without copying data
#
slice7
function slice7(bytes data, uint256 start) internal pure returns (bytes7)
Slice bytes to bytes7 without copying data
#
slice8
function slice8(bytes data, uint256 start) internal pure returns (bytes8)
Slice bytes to bytes8 without copying data
#
slice9
function slice9(bytes data, uint256 start) internal pure returns (bytes9)
Slice bytes to bytes9 without copying data
#
slice10
function slice10(bytes data, uint256 start) internal pure returns (bytes10)
Slice bytes to bytes10 without copying data
#
slice11
function slice11(bytes data, uint256 start) internal pure returns (bytes11)
Slice bytes to bytes11 without copying data
#
slice12
function slice12(bytes data, uint256 start) internal pure returns (bytes12)
Slice bytes to bytes12 without copying data
#
slice13
function slice13(bytes data, uint256 start) internal pure returns (bytes13)
Slice bytes to bytes13 without copying data
#
slice14
function slice14(bytes data, uint256 start) internal pure returns (bytes14)
Slice bytes to bytes14 without copying data
#
slice15
function slice15(bytes data, uint256 start) internal pure returns (bytes15)
Slice bytes to bytes15 without copying data
#
slice16
function slice16(bytes data, uint256 start) internal pure returns (bytes16)
Slice bytes to bytes16 without copying data
#
slice17
function slice17(bytes data, uint256 start) internal pure returns (bytes17)
Slice bytes to bytes17 without copying data
#
slice18
function slice18(bytes data, uint256 start) internal pure returns (bytes18)
Slice bytes to bytes18 without copying data
#
slice19
function slice19(bytes data, uint256 start) internal pure returns (bytes19)
Slice bytes to bytes19 without copying data
#
slice20
function slice20(bytes data, uint256 start) internal pure returns (bytes20)
Slice bytes to bytes20 without copying data
#
slice21
function slice21(bytes data, uint256 start) internal pure returns (bytes21)
Slice bytes to bytes21 without copying data
#
slice22
function slice22(bytes data, uint256 start) internal pure returns (bytes22)
Slice bytes to bytes22 without copying data
#
slice23
function slice23(bytes data, uint256 start) internal pure returns (bytes23)
Slice bytes to bytes23 without copying data
#
slice24
function slice24(bytes data, uint256 start) internal pure returns (bytes24)
Slice bytes to bytes24 without copying data
#
slice25
function slice25(bytes data, uint256 start) internal pure returns (bytes25)
Slice bytes to bytes25 without copying data
#
slice26
function slice26(bytes data, uint256 start) internal pure returns (bytes26)
Slice bytes to bytes26 without copying data
#
slice27
function slice27(bytes data, uint256 start) internal pure returns (bytes27)
Slice bytes to bytes27 without copying data
#
slice28
function slice28(bytes data, uint256 start) internal pure returns (bytes28)
Slice bytes to bytes28 without copying data
#
slice29
function slice29(bytes data, uint256 start) internal pure returns (bytes29)
Slice bytes to bytes29 without copying data
#
slice30
function slice30(bytes data, uint256 start) internal pure returns (bytes30)
Slice bytes to bytes30 without copying data
#
slice31
function slice31(bytes data, uint256 start) internal pure returns (bytes31)
Slice bytes to bytes31 without copying data
#
slice32
function slice32(bytes data, uint256 start) internal pure returns (bytes32)
Slice bytes to bytes32 without copying data
#
IStore
#
StoreSetRecord
event StoreSetRecord(uint256 table, bytes32[] key, bytes data)
#
StoreSetField
event StoreSetField(uint256 table, bytes32[] key, uint8 schemaIndex, bytes data)
#
StoreDeleteRecord
event StoreDeleteRecord(uint256 table, bytes32[] key)
#
registerSchema
function registerSchema(uint256 table, Schema schema, Schema keySchema) external
#
getSchema
function getSchema(uint256 table) external view returns (Schema schema)
#
getKeySchema
function getKeySchema(uint256 table) external view returns (Schema schema)
#
setMetadata
function setMetadata(uint256 table, string tableName, string[] fieldNames) external
#
registerStoreHook
function registerStoreHook(uint256 table, contract IStoreHook hook) external
#
setRecord
function setRecord(uint256 table, bytes32[] key, bytes data) external
#
setField
function setField(uint256 table, bytes32[] key, uint8 schemaIndex, bytes data) external
#
pushToField
function pushToField(uint256 table, bytes32[] key, uint8 schemaIndex, bytes dataToPush) external
#
deleteRecord
function deleteRecord(uint256 table, bytes32[] key) external
#
getRecord
function getRecord(uint256 table, bytes32[] key) external view returns (bytes data)
#
getRecord
function getRecord(uint256 table, bytes32[] key, Schema schema) external view returns (bytes data)
#
getField
function getField(uint256 table, bytes32[] key, uint8 schemaIndex) external view returns (bytes data)
#
isStore
function isStore() external view
#
IStoreHook
#
onSetRecord
function onSetRecord(uint256 table, bytes32[] key, bytes data) external
#
onBeforeSetField
function onBeforeSetField(uint256 table, bytes32[] key, uint8 schemaIndex, bytes data) external
#
onAfterSetField
function onAfterSetField(uint256 table, bytes32[] key, uint8 schemaIndex, bytes data) external
#
onDeleteRecord
function onDeleteRecord(uint256 table, bytes32[] key) external
#
Memory
#
load
function load(uint256 memoryPointer) internal pure returns (bytes32 data)
#
load
function load(uint256 memoryPointer, uint256 offset) internal pure returns (bytes32 data)
#
dataPointer
function dataPointer(bytes data) internal pure returns (uint256 memoryPointer)
#
lengthPointer
function lengthPointer(bytes data) internal pure returns (uint256 memoryPointer)
#
store
function store(uint256 memoryPointer, bytes32 value) internal pure
#
copy
function copy(uint256 fromPointer, uint256 toPointer, uint256 length) internal view
#
PackedCounter
#
PackedCounterLib
#
pack
function pack(uint16[] counters) internal pure returns (PackedCounter)
Encode the given counters into a single packed counter
- 4 bytes for the accumulated length
- 2 bytes per counter -> max 14 counters
#
pack
function pack(uint16 a) internal pure returns (PackedCounter)
#
pack
function pack(uint16 a, uint16 b) internal pure returns (PackedCounter)
#
pack
function pack(uint16 a, uint16 b, uint16 c) internal pure returns (PackedCounter)
#
pack
function pack(uint16 a, uint16 b, uint16 c, uint16 d) internal pure returns (PackedCounter)
#
total
function total(PackedCounter packedCounter) internal pure returns (uint256)
Decode the accumulated counter (first four bytes of packed counter)
#
atIndex
function atIndex(PackedCounter packedCounter, uint256 index) internal pure returns (uint256)
Decode the counter at the given index (two bytes per counter after the first four bytes)
#
setAtIndex
function setAtIndex(PackedCounter packedCounter, uint256 index, uint256 newValueAtIndex) internal pure returns (PackedCounter)
Set a counter at the given index, return the new packed counter
#
unwrap
function unwrap(PackedCounter packedCounter) internal pure returns (bytes32)
#
Schema
#
SchemaLib
#
SchemaLib_InvalidLength
error SchemaLib_InvalidLength(uint256 length)
#
SchemaLib_StaticTypeAfterDynamicType
error SchemaLib_StaticTypeAfterDynamicType()
#
encode
function encode(enum SchemaType[] _schema) internal pure returns (Schema)
Encode the given schema into a single bytes32
#
encode
function encode(enum SchemaType a) internal pure returns (Schema)
#
encode
function encode(enum SchemaType a, enum SchemaType b) internal pure returns (Schema)
#
encode
function encode(enum SchemaType a, enum SchemaType b, enum SchemaType c) internal pure returns (Schema)
#
encode
function encode(enum SchemaType a, enum SchemaType b, enum SchemaType c, enum SchemaType d) internal pure returns (Schema)
#
encode
function encode(enum SchemaType a, enum SchemaType b, enum SchemaType c, enum SchemaType d, enum SchemaType e) internal pure returns (Schema)
#
encode
function encode(enum SchemaType a, enum SchemaType b, enum SchemaType c, enum SchemaType d, enum SchemaType e, enum SchemaType f) internal pure returns (Schema)
#
staticDataLength
function staticDataLength(Schema schema) internal pure returns (uint256)
Get the length of the static data for the given schema
#
atIndex
function atIndex(Schema schema, uint256 index) internal pure returns (enum SchemaType)
Get the type of the data for the given schema at the given index
#
numDynamicFields
function numDynamicFields(Schema schema) internal pure returns (uint8)
Get the number of dynamic length fields for the given schema
#
numStaticFields
function numStaticFields(Schema schema) internal pure returns (uint8)
Get the number of static fields for the given schema
#
numFields
function numFields(Schema schema) internal pure returns (uint8)
Get the total number of fields for the given schema
#
isEmpty
function isEmpty(Schema schema) internal pure returns (bool)
Check if the given schema is empty
#
validate
function validate(Schema schema, bool allowEmpty) internal pure
#
unwrap
function unwrap(Schema schema) internal pure returns (bytes32)
Unwrap the schema
#
Slice
#
SliceLib
#
Slice_OutOfBounds
error Slice_OutOfBounds(bytes data, uint256 start, uint256 end)
#
MASK_LEN
uint256 MASK_LEN
#
MASK_PTR
uint256 MASK_PTR
#
fromBytes
function fromBytes(bytes data) internal pure returns (Slice)
Converts a bytes array to a slice (without copying data)
#
getSubslice
function getSubslice(bytes data, uint256 start) internal pure returns (Slice)
Subslice a bytes array using the given start index until the end of the array (without copying data)
#
getSubslice
function getSubslice(bytes data, uint256 start, uint256 end) internal pure returns (Slice)
Subslice a bytes array using the given indexes (without copying data) The start index is inclusive, the end index is exclusive
#
SliceInstance
#
pointer
function pointer(Slice self) internal pure returns (uint256)
Returns the pointer to the start of a slice
#
length
function length(Slice self) internal pure returns (uint256)
Returns the slice length in bytes
#
toBytes
function toBytes(Slice self) internal view returns (bytes data)
Copies the slice to a new bytes array The slice will NOT point to the new bytes array
#
toBytes32
function toBytes32(Slice self) internal pure returns (bytes32 result)
#
Storage
TODO Probably not fully optimized (see https://github.com/latticexyz/mud/issues/444)
#
store
function store(uint256 storagePointer, bytes data) internal
#
store
function store(uint256 storagePointer, bytes32 data) internal
#
store
function store(uint256 storagePointer, uint256 offset, bytes data) internal
#
store
function store(uint256 storagePointer, uint256 offset, uint256 memoryPointer, uint256 length) internal
Stores raw bytes to storage at the given storagePointer and offset (keeping the rest of the word intact)
#
load
function load(uint256 storagePointer) internal view returns (bytes32 word)
#
load
function load(uint256 storagePointer, uint256 length) internal view returns (bytes)
#
load
function load(uint256 storagePointer, uint256 length, uint256 offset) internal view returns (bytes result)
Load raw bytes from storage at the given storagePointer, offset, and length
#
load
function load(uint256 storagePointer, uint256 length, uint256 offset, uint256 memoryPointer) internal view
Append raw bytes from storage at the given storagePointer, offset, and length to the given memoryPointer
#
Store
#
constructor
constructor() internal
#
getSchema
function getSchema(uint256 table) public view virtual returns (Schema schema)
#
getKeySchema
function getKeySchema(uint256 table) public view virtual returns (Schema schema)
#
getRecord
function getRecord(uint256 table, bytes32[] key) public view virtual returns (bytes data)
#
getRecord
function getRecord(uint256 table, bytes32[] key, Schema schema) public view virtual returns (bytes data)
#
getField
function getField(uint256 table, bytes32[] key, uint8 schemaIndex) public view virtual returns (bytes data)
#
isStore
function isStore() public view
#
StoreCore
#
StoreSetRecord
event StoreSetRecord(uint256 tableId, bytes32[] key, bytes data)
#
StoreSetField
event StoreSetField(uint256 tableId, bytes32[] key, uint8 schemaIndex, bytes data)
#
StoreDeleteRecord
event StoreDeleteRecord(uint256 tableId, bytes32[] key)
#
StoreCore_TableAlreadyExists
error StoreCore_TableAlreadyExists(uint256 tableId, string tableIdString)
#
StoreCore_TableNotFound
error StoreCore_TableNotFound(uint256 tableId, string tableIdString)
#
StoreCore_NotImplemented
error StoreCore_NotImplemented()
#
StoreCore_InvalidDataLength
error StoreCore_InvalidDataLength(uint256 expected, uint256 received)
#
StoreCore_InvalidFieldNamesLength
error StoreCore_InvalidFieldNamesLength(uint256 expected, uint256 received)
#
StoreCore_NotDynamicField
error StoreCore_NotDynamicField()
#
initialize
function initialize() internal
Initialize internal tables. Consumers must call this function in their constructor. TODO: should we turn the schema table into a "proper table" and register it here? (see https://github.com/latticexyz/mud/issues/444)
#
getSchema
function getSchema(uint256 tableId) internal view returns (Schema schema)
Get the schema for the given tableId
#
getKeySchema
function getKeySchema(uint256 tableId) internal view returns (Schema keySchema)
Get the key schema for the given tableId
#
hasTable
function hasTable(uint256 tableId) internal view returns (bool)
Check if a table with the given tableId exists
#
registerSchema
function registerSchema(uint256 tableId, Schema valueSchema, Schema keySchema) internal
Register a new tableId schema
#
setMetadata
function setMetadata(uint256 tableId, string tableName, string[] fieldNames) internal
Set metadata for a given tableId
#
registerStoreHook
function registerStoreHook(uint256 tableId, contract IStoreHook hook) internal
#
setRecord
function setRecord(uint256 tableId, bytes32[] key, bytes data) internal
Set full data record for the given tableId and key tuple (static and dynamic data)
#
setField
function setField(uint256 tableId, bytes32[] key, uint8 schemaIndex, bytes data) internal
#
deleteRecord
function deleteRecord(uint256 tableId, bytes32[] key) internal
#
pushToField
function pushToField(uint256 tableId, bytes32[] key, uint8 schemaIndex, bytes dataToPush) internal
#
getRecord
function getRecord(uint256 tableId, bytes32[] key) internal view returns (bytes)
Get full record (all fields, static and dynamic data) for the given tableId and key tuple (loading schema from storage)
#
getRecord
function getRecord(uint256 tableId, bytes32[] key, Schema schema) internal view returns (bytes)
Get full record (all fields, static and dynamic data) for the given tableId and key tuple, with the given schema
#
getField
function getField(uint256 tableId, bytes32[] key, uint8 schemaIndex) internal view returns (bytes)
Get a single field from the given tableId and key tuple (loading schema from storage)
#
getField
function getField(uint256 tableId, bytes32[] key, uint8 schemaIndex, Schema schema) internal view returns (bytes)
Get a single field from the given tableId and key tuple, with the given schema
#
StoreCoreInternal
#
SLOT
bytes32 SLOT
#
SCHEMA_TABLE
uint256 SCHEMA_TABLE
#
_getSchema
function _getSchema(uint256 tableId) internal view returns (Schema)
#
_getKeySchema
function _getKeySchema(uint256 tableId) internal view returns (Schema)
#
_registerSchemaUnchecked
function _registerSchemaUnchecked(uint256 tableId, Schema valueSchema, Schema keySchema) internal
Register a new tableId schema without validity checks
#
_setStaticField
function _setStaticField(uint256 tableId, bytes32[] key, Schema schema, uint8 schemaIndex, bytes data) internal
#
_setDynamicField
function _setDynamicField(uint256 tableId, bytes32[] key, Schema schema, uint8 schemaIndex, bytes data) internal
#
_pushToDynamicField
function _pushToDynamicField(uint256 tableId, bytes32[] key, Schema schema, uint8 schemaIndex, bytes dataToPush) internal
#
_getStaticData
function _getStaticData(uint256 tableId, bytes32[] key, uint256 memoryPointer) internal view
Get full static record for the given tableId and key tuple (loading schema's static length from storage)
#
_getStaticData
function _getStaticData(uint256 tableId, bytes32[] key, uint256 length, uint256 memoryPointer) internal view
Get full static data for the given tableId and key tuple, with the given static length
#
_getStaticField
function _getStaticField(uint256 tableId, bytes32[] key, uint8 schemaIndex, Schema schema) internal view returns (bytes)
Get a single static field from the given tableId and key tuple, with the given schema
#
_getDynamicField
function _getDynamicField(uint256 tableId, bytes32[] key, uint8 schemaIndex, Schema schema) internal view returns (bytes)
Get a single dynamic field from the given tableId and key tuple, with the given schema
#
_getStaticDataLocation
function _getStaticDataLocation(uint256 tableId, bytes32[] key) internal pure returns (uint256)
Compute the storage location based on tableId id and index tuple
#
_getStaticDataOffset
function _getStaticDataOffset(Schema schema, uint8 schemaIndex) internal pure returns (uint256)
Get storage offset for the given schema and (static length) index
#
_getDynamicDataLocation
function _getDynamicDataLocation(uint256 tableId, bytes32[] key, uint8 schemaIndex) internal pure returns (uint256)
Compute the storage location based on tableId id and index tuple
#
_getDynamicDataLengthLocation
function _getDynamicDataLengthLocation(uint256 tableId, bytes32[] key) internal pure returns (uint256)
Compute the storage location for the length of the dynamic data
#
_loadEncodedDynamicDataLength
function _loadEncodedDynamicDataLength(uint256 tableId, bytes32[] key) internal view returns (PackedCounter)
Get the length of the dynamic data for the given schema and index
#
_setDynamicDataLengthAtIndex
function _setDynamicDataLengthAtIndex(uint256 tableId, bytes32[] key, uint8 dynamicSchemaIndex, uint256 newLengthAtIndex) internal
Set the length of the dynamic data (in bytes) for the given schema and index
#
StoreCoreExtended
#
getRecord
function getRecord(uint256 tableId, bytes32 _key) internal view returns (bytes)
#
getData
function getData(uint256 tableId, bytes32[2] _key) internal view returns (bytes)
#
StoreSwitch
Call IStore functions on self or msg.sender, depending on whether the call is a delegatecall or regular call.
#
StoreSwitch_InvalidInsideConstructor
error StoreSwitch_InvalidInsideConstructor()
#
isDelegateCall
function isDelegateCall() internal view returns (bool success)
Detect whether the current call is a delegatecall or regular call. (The isStore method doesn't return a value to save gas, but it if exists, the call will succeed.)
#
registerStoreHook
function registerStoreHook(uint256 table, contract IStoreHook hook) internal
#
getSchema
function getSchema(uint256 table) internal view returns (Schema schema)
#
setMetadata
function setMetadata(uint256 table, string tableName, string[] fieldNames) internal
#
registerSchema
function registerSchema(uint256 table, Schema schema, Schema keySchema) internal
#
setRecord
function setRecord(uint256 table, bytes32[] key, bytes data) internal
#
setField
function setField(uint256 table, bytes32[] key, uint8 fieldIndex, bytes data) internal
#
pushToField
function pushToField(uint256 table, bytes32[] key, uint8 fieldIndex, bytes dataToPush) internal
#
deleteRecord
function deleteRecord(uint256 table, bytes32[] key) internal
#
getRecord
function getRecord(uint256 table, bytes32[] key) internal view returns (bytes)
#
getRecord
function getRecord(uint256 table, bytes32[] key, Schema schema) internal view returns (bytes)
#
getField
function getField(uint256 table, bytes32[] key, uint8 fieldIndex) internal view returns (bytes)
#
StoreView
#
StoreView_NotImplemented
error StoreView_NotImplemented()
#
registerSchema
function registerSchema(uint256, Schema, Schema) public virtual
Not implemented in StoreView
#
setMetadata
function setMetadata(uint256, string, string[]) public virtual
Not implemented in StoreView
#
setRecord
function setRecord(uint256, bytes32[], bytes) public virtual
Not implemented in StoreView
#
setField
function setField(uint256, bytes32[], uint8, bytes) public virtual
Not implemented in StoreView
#
pushToField
function pushToField(uint256, bytes32[], uint8, bytes) public virtual
Not implemented in StoreView
#
registerStoreHook
function registerStoreHook(uint256, contract IStoreHook) public virtual
Not implemented in StoreView
#
deleteRecord
function deleteRecord(uint256, bytes32[]) public virtual
Not implemented in StoreView
#
TableId
#
toString
function toString(uint256 tableId) internal pure returns (string)
#
Utils
#
divCeil
function divCeil(uint256 a, uint256 b) internal pure returns (uint256)
#
leftMask
function leftMask(uint256 byteLength) internal pure returns (uint256)
Adapted from https://github.com/dk1a/solidity-stringutils/blob/main/src/utils/mem.sol#L149-L167
_Left-aligned byte mask (e.g. for partial mload/mstore). For byteLength >= 32 returns type(uint256).max
length 0: 0x000000...000000 length 1: 0xff0000...000000 length 2: 0xffff00...000000 ... length 30: 0xffffff...ff0000 length 31: 0xffffff...ffff00 length 32+: 0xffffff...ffffff_
#
_tableId
uint256 _tableId
#
CallbacksTableId
uint256 CallbacksTableId
#
Callbacks
#
getSchema
function getSchema() internal pure returns (Schema)
Get the table's schema
#
getKeySchema
function getKeySchema() internal pure returns (Schema)
#
getMetadata
function getMetadata() internal pure returns (string, string[])
Get the table's metadata
#
registerSchema
function registerSchema() internal
Register the table's schema
#
setMetadata
function setMetadata() internal
Set the table's metadata
#
get
function get(bytes32 key) internal view returns (bytes24[] value)
Get value
#
set
function set(bytes32 key, bytes24[] value) internal
Set value
#
push
function push(bytes32 key, bytes24 _element) internal
Push an element to value
#
encode
function encode(bytes24[] value) internal view returns (bytes)
Tightly pack full data using this table's schema
#
deleteRecord
function deleteRecord(bytes32 key) internal
#
_tableId
uint256 _tableId
#
HooksTableId
uint256 HooksTableId
#
Hooks
#
getSchema
function getSchema() internal pure returns (Schema)
Get the table's schema
#
getKeySchema
function getKeySchema() internal pure returns (Schema)
#
getMetadata
function getMetadata() internal pure returns (string, string[])
Get the table's metadata
#
registerSchema
function registerSchema() internal
Register the table's schema
#
setMetadata
function setMetadata() internal
Set the table's metadata
#
get
function get(bytes32 key) internal view returns (address[] value)
Get value
#
set
function set(bytes32 key, address[] value) internal
Set value
#
push
function push(bytes32 key, address _element) internal
Push an element to value
#
encode
function encode(address[] value) internal view returns (bytes)
Tightly pack full data using this table's schema
#
deleteRecord
function deleteRecord(bytes32 key) internal
#
_tableId
uint256 _tableId
#
MixedTableId
uint256 MixedTableId
#
MixedData
struct MixedData {
uint32 u32;
uint128 u128;
uint32[] a32;
string s;
}
#
Mixed
#
getSchema
function getSchema() internal pure returns (Schema)
Get the table's schema
#
getKeySchema
function getKeySchema() internal pure returns (Schema)
#
getMetadata
function getMetadata() internal pure returns (string, string[])
Get the table's metadata
#
registerSchema
function registerSchema() internal
Register the table's schema
#
setMetadata
function setMetadata() internal
Set the table's metadata
#
getU32
function getU32(bytes32 key) internal view returns (uint32 u32)
Get u32
#
setU32
function setU32(bytes32 key, uint32 u32) internal
Set u32
#
getU128
function getU128(bytes32 key) internal view returns (uint128 u128)
Get u128
#
setU128
function setU128(bytes32 key, uint128 u128) internal
Set u128
#
getA32
function getA32(bytes32 key) internal view returns (uint32[] a32)
Get a32
#
setA32
function setA32(bytes32 key, uint32[] a32) internal
Set a32
#
pushA32
function pushA32(bytes32 key, uint32 _element) internal
Push an element to a32
#
getS
function getS(bytes32 key) internal view returns (string s)
Get s
#
setS
function setS(bytes32 key, string s) internal
Set s
#
pushS
function pushS(bytes32 key, string _slice) internal
Push a slice to s
#
get
function get(bytes32 key) internal view returns (struct MixedData _table)
Get the full data
#
set
function set(bytes32 key, uint32 u32, uint128 u128, uint32[] a32, string s) internal
Set the full data using individual values
#
set
function set(bytes32 key, struct MixedData _table) internal
Set the full data using the data struct
#
decode
function decode(bytes _blob) internal view returns (struct MixedData _table)
Decode the tightly packed blob using this table's schema
#
encode
function encode(uint32 u32, uint128 u128, uint32[] a32, string s) internal view returns (bytes)
Tightly pack full data using this table's schema
#
deleteRecord
function deleteRecord(bytes32 key) internal
#
_tableId
uint256 _tableId
#
StoreMetadataTableId
uint256 StoreMetadataTableId
#
StoreMetadataData
struct StoreMetadataData {
string tableName;
bytes abiEncodedFieldNames;
}
#
StoreMetadata
#
getSchema
function getSchema() internal pure returns (Schema)
Get the table's schema
#
getKeySchema
function getKeySchema() internal pure returns (Schema)
#
getMetadata
function getMetadata() internal pure returns (string, string[])
Get the table's metadata
#
registerSchema
function registerSchema() internal
Register the table's schema
#
registerSchema
function registerSchema(contract IStore _store) internal
Register the table's schema (using the specified store)
#
setMetadata
function setMetadata() internal
Set the table's metadata
#
setMetadata
function setMetadata(contract IStore _store) internal
Set the table's metadata (using the specified store)
#
getTableName
function getTableName(uint256 tableId) internal view returns (string tableName)
Get tableName
#
getTableName
function getTableName(contract IStore _store, uint256 tableId) internal view returns (string tableName)
Get tableName (using the specified store)
#
setTableName
function setTableName(uint256 tableId, string tableName) internal
Set tableName
#
setTableName
function setTableName(contract IStore _store, uint256 tableId, string tableName) internal
Set tableName (using the specified store)
#
pushTableName
function pushTableName(uint256 tableId, string _slice) internal
Push a slice to tableName
#
pushTableName
function pushTableName(contract IStore _store, uint256 tableId, string _slice) internal
Push a slice to tableName (using the specified store)
#
getAbiEncodedFieldNames
function getAbiEncodedFieldNames(uint256 tableId) internal view returns (bytes abiEncodedFieldNames)
Get abiEncodedFieldNames
#
getAbiEncodedFieldNames
function getAbiEncodedFieldNames(contract IStore _store, uint256 tableId) internal view returns (bytes abiEncodedFieldNames)
Get abiEncodedFieldNames (using the specified store)
#
setAbiEncodedFieldNames
function setAbiEncodedFieldNames(uint256 tableId, bytes abiEncodedFieldNames) internal
Set abiEncodedFieldNames
#
setAbiEncodedFieldNames
function setAbiEncodedFieldNames(contract IStore _store, uint256 tableId, bytes abiEncodedFieldNames) internal
Set abiEncodedFieldNames (using the specified store)
#
pushAbiEncodedFieldNames
function pushAbiEncodedFieldNames(uint256 tableId, bytes _slice) internal
Push a slice to abiEncodedFieldNames
#
pushAbiEncodedFieldNames
function pushAbiEncodedFieldNames(contract IStore _store, uint256 tableId, bytes _slice) internal
Push a slice to abiEncodedFieldNames (using the specified store)
#
get
function get(uint256 tableId) internal view returns (struct StoreMetadataData _table)
Get the full data
#
get
function get(contract IStore _store, uint256 tableId) internal view returns (struct StoreMetadataData _table)
Get the full data (using the specified store)
#
set
function set(uint256 tableId, string tableName, bytes abiEncodedFieldNames) internal
Set the full data using individual values
#
set
function set(contract IStore _store, uint256 tableId, string tableName, bytes abiEncodedFieldNames) internal
Set the full data using individual values (using the specified store)
#
set
function set(uint256 tableId, struct StoreMetadataData _table) internal
Set the full data using the data struct
#
set
function set(contract IStore _store, uint256 tableId, struct StoreMetadataData _table) internal
Set the full data using the data struct (using the specified store)
#
decode
function decode(bytes _blob) internal view returns (struct StoreMetadataData _table)
Decode the tightly packed blob using this table's schema
#
encode
function encode(string tableName, bytes abiEncodedFieldNames) internal view returns (bytes)
Tightly pack full data using this table's schema
#
deleteRecord
function deleteRecord(uint256 tableId) internal
#
deleteRecord
function deleteRecord(contract IStore _store, uint256 tableId) internal
#
_tableId
uint256 _tableId
#
Vector2TableId
uint256 Vector2TableId
#
Vector2Data
struct Vector2Data {
uint32 x;
uint32 y;
}
#
Vector2
#
getSchema
function getSchema() internal pure returns (Schema)
Get the table's schema
#
getKeySchema
function getKeySchema() internal pure returns (Schema)
#
getMetadata
function getMetadata() internal pure returns (string, string[])
Get the table's metadata
#
registerSchema
function registerSchema() internal
Register the table's schema
#
setMetadata
function setMetadata() internal
Set the table's metadata
#
getX
function getX(bytes32 key) internal view returns (uint32 x)
Get x
#
setX
function setX(bytes32 key, uint32 x) internal
Set x
#
getY
function getY(bytes32 key) internal view returns (uint32 y)
Get y
#
setY
function setY(bytes32 key, uint32 y) internal
Set y
#
get
function get(bytes32 key) internal view returns (struct Vector2Data _table)
Get the full data
#
set
function set(bytes32 key, uint32 x, uint32 y) internal
Set the full data using individual values
#
set
function set(bytes32 key, struct Vector2Data _table) internal
Set the full data using the data struct
#
decode
function decode(bytes _blob) internal pure returns (struct Vector2Data _table)
Decode the tightly packed blob using this table's schema
#
encode
function encode(uint32 x, uint32 y) internal view returns (bytes)
Tightly pack full data using this table's schema
#
deleteRecord
function deleteRecord(bytes32 key) internal
#
DecodeSlice
#
decodeArray_uint8
function decodeArray_uint8(Slice self) internal pure returns (uint8[] output)
#
decodeArray_uint16
function decodeArray_uint16(Slice self) internal pure returns (uint16[] output)
#
decodeArray_uint24
function decodeArray_uint24(Slice self) internal pure returns (uint24[] output)
#
decodeArray_uint32
function decodeArray_uint32(Slice self) internal pure returns (uint32[] output)
#
decodeArray_uint40
function decodeArray_uint40(Slice self) internal pure returns (uint40[] output)
#
decodeArray_uint48
function decodeArray_uint48(Slice self) internal pure returns (uint48[] output)
#
decodeArray_uint56
function decodeArray_uint56(Slice self) internal pure returns (uint56[] output)
#
decodeArray_uint64
function decodeArray_uint64(Slice self) internal pure returns (uint64[] output)
#
decodeArray_uint72
function decodeArray_uint72(Slice self) internal pure returns (uint72[] output)
#
decodeArray_uint80
function decodeArray_uint80(Slice self) internal pure returns (uint80[] output)
#
decodeArray_uint88
function decodeArray_uint88(Slice self) internal pure returns (uint88[] output)
#
decodeArray_uint96
function decodeArray_uint96(Slice self) internal pure returns (uint96[] output)
#
decodeArray_uint104
function decodeArray_uint104(Slice self) internal pure returns (uint104[] output)
#
decodeArray_uint112
function decodeArray_uint112(Slice self) internal pure returns (uint112[] output)
#
decodeArray_uint120
function decodeArray_uint120(Slice self) internal pure returns (uint120[] output)
#
decodeArray_uint128
function decodeArray_uint128(Slice self) internal pure returns (uint128[] output)
#
decodeArray_uint136
function decodeArray_uint136(Slice self) internal pure returns (uint136[] output)
#
decodeArray_uint144
function decodeArray_uint144(Slice self) internal pure returns (uint144[] output)
#
decodeArray_uint152
function decodeArray_uint152(Slice self) internal pure returns (uint152[] output)
#
decodeArray_uint160
function decodeArray_uint160(Slice self) internal pure returns (uint160[] output)
#
decodeArray_uint168
function decodeArray_uint168(Slice self) internal pure returns (uint168[] output)
#
decodeArray_uint176
function decodeArray_uint176(Slice self) internal pure returns (uint176[] output)
#
decodeArray_uint184
function decodeArray_uint184(Slice self) internal pure returns (uint184[] output)
#
decodeArray_uint192
function decodeArray_uint192(Slice self) internal pure returns (uint192[] output)
#
decodeArray_uint200
function decodeArray_uint200(Slice self) internal pure returns (uint200[] output)
#
decodeArray_uint208
function decodeArray_uint208(Slice self) internal pure returns (uint208[] output)
#
decodeArray_uint216
function decodeArray_uint216(Slice self) internal pure returns (uint216[] output)
#
decodeArray_uint224
function decodeArray_uint224(Slice self) internal pure returns (uint224[] output)
#
decodeArray_uint232
function decodeArray_uint232(Slice self) internal pure returns (uint232[] output)
#
decodeArray_uint240
function decodeArray_uint240(Slice self) internal pure returns (uint240[] output)
#
decodeArray_uint248
function decodeArray_uint248(Slice self) internal pure returns (uint248[] output)
#
decodeArray_uint256
function decodeArray_uint256(Slice self) internal pure returns (uint256[] output)
#
decodeArray_int8
function decodeArray_int8(Slice self) internal pure returns (int8[] output)
#
decodeArray_int16
function decodeArray_int16(Slice self) internal pure returns (int16[] output)
#
decodeArray_int24
function decodeArray_int24(Slice self) internal pure returns (int24[] output)
#
decodeArray_int32
function decodeArray_int32(Slice self) internal pure returns (int32[] output)
#
decodeArray_int40
function decodeArray_int40(Slice self) internal pure returns (int40[] output)
#
decodeArray_int48
function decodeArray_int48(Slice self) internal pure returns (int48[] output)
#
decodeArray_int56
function decodeArray_int56(Slice self) internal pure returns (int56[] output)
#
decodeArray_int64
function decodeArray_int64(Slice self) internal pure returns (int64[] output)
#
decodeArray_int72
function decodeArray_int72(Slice self) internal pure returns (int72[] output)
#
decodeArray_int80
function decodeArray_int80(Slice self) internal pure returns (int80[] output)
#
decodeArray_int88
function decodeArray_int88(Slice self) internal pure returns (int88[] output)
#
decodeArray_int96
function decodeArray_int96(Slice self) internal pure returns (int96[] output)
#
decodeArray_int104
function decodeArray_int104(Slice self) internal pure returns (int104[] output)
#
decodeArray_int112
function decodeArray_int112(Slice self) internal pure returns (int112[] output)
#
decodeArray_int120
function decodeArray_int120(Slice self) internal pure returns (int120[] output)
#
decodeArray_int128
function decodeArray_int128(Slice self) internal pure returns (int128[] output)
#
decodeArray_int136
function decodeArray_int136(Slice self) internal pure returns (int136[] output)
#
decodeArray_int144
function decodeArray_int144(Slice self) internal pure returns (int144[] output)
#
decodeArray_int152
function decodeArray_int152(Slice self) internal pure returns (int152[] output)
#
decodeArray_int160
function decodeArray_int160(Slice self) internal pure returns (int160[] output)
#
decodeArray_int168
function decodeArray_int168(Slice self) internal pure returns (int168[] output)
#
decodeArray_int176
function decodeArray_int176(Slice self) internal pure returns (int176[] output)
#
decodeArray_int184
function decodeArray_int184(Slice self) internal pure returns (int184[] output)
#
decodeArray_int192
function decodeArray_int192(Slice self) internal pure returns (int192[] output)
#
decodeArray_int200
function decodeArray_int200(Slice self) internal pure returns (int200[] output)
#
decodeArray_int208
function decodeArray_int208(Slice self) internal pure returns (int208[] output)
#
decodeArray_int216
function decodeArray_int216(Slice self) internal pure returns (int216[] output)
#
decodeArray_int224
function decodeArray_int224(Slice self) internal pure returns (int224[] output)
#
decodeArray_int232
function decodeArray_int232(Slice self) internal pure returns (int232[] output)
#
decodeArray_int240
function decodeArray_int240(Slice self) internal pure returns (int240[] output)
#
decodeArray_int248
function decodeArray_int248(Slice self) internal pure returns (int248[] output)
#
decodeArray_int256
function decodeArray_int256(Slice self) internal pure returns (int256[] output)
#
decodeArray_bytes1
function decodeArray_bytes1(Slice self) internal pure returns (bytes1[] output)
#
decodeArray_bytes2
function decodeArray_bytes2(Slice self) internal pure returns (bytes2[] output)
#
decodeArray_bytes3
function decodeArray_bytes3(Slice self) internal pure returns (bytes3[] output)
#
decodeArray_bytes4
function decodeArray_bytes4(Slice self) internal pure returns (bytes4[] output)
#
decodeArray_bytes5
function decodeArray_bytes5(Slice self) internal pure returns (bytes5[] output)
#
decodeArray_bytes6
function decodeArray_bytes6(Slice self) internal pure returns (bytes6[] output)
#
decodeArray_bytes7
function decodeArray_bytes7(Slice self) internal pure returns (bytes7[] output)
#
decodeArray_bytes8
function decodeArray_bytes8(Slice self) internal pure returns (bytes8[] output)
#
decodeArray_bytes9
function decodeArray_bytes9(Slice self) internal pure returns (bytes9[] output)
#
decodeArray_bytes10
function decodeArray_bytes10(Slice self) internal pure returns (bytes10[] output)
#
decodeArray_bytes11
function decodeArray_bytes11(Slice self) internal pure returns (bytes11[] output)
#
decodeArray_bytes12
function decodeArray_bytes12(Slice self) internal pure returns (bytes12[] output)
#
decodeArray_bytes13
function decodeArray_bytes13(Slice self) internal pure returns (bytes13[] output)
#
decodeArray_bytes14
function decodeArray_bytes14(Slice self) internal pure returns (bytes14[] output)
#
decodeArray_bytes15
function decodeArray_bytes15(Slice self) internal pure returns (bytes15[] output)
#
decodeArray_bytes16
function decodeArray_bytes16(Slice self) internal pure returns (bytes16[] output)
#
decodeArray_bytes17
function decodeArray_bytes17(Slice self) internal pure returns (bytes17[] output)
#
decodeArray_bytes18
function decodeArray_bytes18(Slice self) internal pure returns (bytes18[] output)
#
decodeArray_bytes19
function decodeArray_bytes19(Slice self) internal pure returns (bytes19[] output)
#
decodeArray_bytes20
function decodeArray_bytes20(Slice self) internal pure returns (bytes20[] output)
#
decodeArray_bytes21
function decodeArray_bytes21(Slice self) internal pure returns (bytes21[] output)
#
decodeArray_bytes22
function decodeArray_bytes22(Slice self) internal pure returns (bytes22[] output)
#
decodeArray_bytes23
function decodeArray_bytes23(Slice self) internal pure returns (bytes23[] output)
#
decodeArray_bytes24
function decodeArray_bytes24(Slice self) internal pure returns (bytes24[] output)
#
decodeArray_bytes25
function decodeArray_bytes25(Slice self) internal pure returns (bytes25[] output)
#
decodeArray_bytes26
function decodeArray_bytes26(Slice self) internal pure returns (bytes26[] output)
#
decodeArray_bytes27
function decodeArray_bytes27(Slice self) internal pure returns (bytes27[] output)
#
decodeArray_bytes28
function decodeArray_bytes28(Slice self) internal pure returns (bytes28[] output)
#
decodeArray_bytes29
function decodeArray_bytes29(Slice self) internal pure returns (bytes29[] output)
#
decodeArray_bytes30
function decodeArray_bytes30(Slice self) internal pure returns (bytes30[] output)
#
decodeArray_bytes31
function decodeArray_bytes31(Slice self) internal pure returns (bytes31[] output)
#
decodeArray_bytes32
function decodeArray_bytes32(Slice self) internal pure returns (bytes32[] output)
#
decodeArray_address
function decodeArray_address(Slice self) internal pure returns (address[] output)
#
decodeArray_bool
function decodeArray_bool(Slice self) internal pure returns (bool[] output)
#
decodeArray_SchemaType
function decodeArray_SchemaType(Slice self) internal pure returns (enum SchemaType[] output)
#
EncodeArray
#
encode
function encode(uint8[] input) internal pure returns (bytes output)
#
encode
function encode(uint16[] input) internal pure returns (bytes output)
#
encode
function encode(uint24[] input) internal pure returns (bytes output)
#
encode
function encode(uint32[] input) internal pure returns (bytes output)
#
encode
function encode(uint40[] input) internal pure returns (bytes output)
#
encode
function encode(uint48[] input) internal pure returns (bytes output)
#
encode
function encode(uint56[] input) internal pure returns (bytes output)
#
encode
function encode(uint64[] input) internal pure returns (bytes output)
#
encode
function encode(uint72[] input) internal pure returns (bytes output)
#
encode
function encode(uint80[] input) internal pure returns (bytes output)
#
encode
function encode(uint88[] input) internal pure returns (bytes output)
#
encode
function encode(uint96[] input) internal pure returns (bytes output)
#
encode
function encode(uint104[] input) internal pure returns (bytes output)
#
encode
function encode(uint112[] input) internal pure returns (bytes output)
#
encode
function encode(uint120[] input) internal pure returns (bytes output)
#
encode
function encode(uint128[] input) internal pure returns (bytes output)
#
encode
function encode(uint136[] input) internal pure returns (bytes output)
#
encode
function encode(uint144[] input) internal pure returns (bytes output)
#
encode
function encode(uint152[] input) internal pure returns (bytes output)
#
encode
function encode(uint160[] input) internal pure returns (bytes output)
#
encode
function encode(uint168[] input) internal pure returns (bytes output)
#
encode
function encode(uint176[] input) internal pure returns (bytes output)
#
encode
function encode(uint184[] input) internal pure returns (bytes output)
#
encode
function encode(uint192[] input) internal pure returns (bytes output)
#
encode
function encode(uint200[] input) internal pure returns (bytes output)
#
encode
function encode(uint208[] input) internal pure returns (bytes output)
#
encode
function encode(uint216[] input) internal pure returns (bytes output)
#
encode
function encode(uint224[] input) internal pure returns (bytes output)
#
encode
function encode(uint232[] input) internal pure returns (bytes output)
#
encode
function encode(uint240[] input) internal pure returns (bytes output)
#
encode
function encode(uint248[] input) internal pure returns (bytes output)
#
encode
function encode(uint256[] input) internal pure returns (bytes output)
#
encode
function encode(int8[] input) internal pure returns (bytes output)
#
encode
function encode(int16[] input) internal pure returns (bytes output)
#
encode
function encode(int24[] input) internal pure returns (bytes output)
#
encode
function encode(int32[] input) internal pure returns (bytes output)
#
encode
function encode(int40[] input) internal pure returns (bytes output)
#
encode
function encode(int48[] input) internal pure returns (bytes output)
#
encode
function encode(int56[] input) internal pure returns (bytes output)
#
encode
function encode(int64[] input) internal pure returns (bytes output)
#
encode
function encode(int72[] input) internal pure returns (bytes output)
#
encode
function encode(int80[] input) internal pure returns (bytes output)
#
encode
function encode(int88[] input) internal pure returns (bytes output)
#
encode
function encode(int96[] input) internal pure returns (bytes output)
#
encode
function encode(int104[] input) internal pure returns (bytes output)
#
encode
function encode(int112[] input) internal pure returns (bytes output)
#
encode
function encode(int120[] input) internal pure returns (bytes output)
#
encode
function encode(int128[] input) internal pure returns (bytes output)
#
encode
function encode(int136[] input) internal pure returns (bytes output)
#
encode
function encode(int144[] input) internal pure returns (bytes output)
#
encode
function encode(int152[] input) internal pure returns (bytes output)
#
encode
function encode(int160[] input) internal pure returns (bytes output)
#
encode
function encode(int168[] input) internal pure returns (bytes output)
#
encode
function encode(int176[] input) internal pure returns (bytes output)
#
encode
function encode(int184[] input) internal pure returns (bytes output)
#
encode
function encode(int192[] input) internal pure returns (bytes output)
#
encode
function encode(int200[] input) internal pure returns (bytes output)
#
encode
function encode(int208[] input) internal pure returns (bytes output)
#
encode
function encode(int216[] input) internal pure returns (bytes output)
#
encode
function encode(int224[] input) internal pure returns (bytes output)
#
encode
function encode(int232[] input) internal pure returns (bytes output)
#
encode
function encode(int240[] input) internal pure returns (bytes output)
#
encode
function encode(int248[] input) internal pure returns (bytes output)
#
encode
function encode(int256[] input) internal pure returns (bytes output)
#
encode
function encode(bytes1[] input) internal pure returns (bytes output)
#
encode
function encode(bytes2[] input) internal pure returns (bytes output)
#
encode
function encode(bytes3[] input) internal pure returns (bytes output)
#
encode
function encode(bytes4[] input) internal pure returns (bytes output)
#
encode
function encode(bytes5[] input) internal pure returns (bytes output)
#
encode
function encode(bytes6[] input) internal pure returns (bytes output)
#
encode
function encode(bytes7[] input) internal pure returns (bytes output)
#
encode
function encode(bytes8[] input) internal pure returns (bytes output)
#
encode
function encode(bytes9[] input) internal pure returns (bytes output)
#
encode
function encode(bytes10[] input) internal pure returns (bytes output)
#
encode
function encode(bytes11[] input) internal pure returns (bytes output)
#
encode
function encode(bytes12[] input) internal pure returns (bytes output)
#
encode
function encode(bytes13[] input) internal pure returns (bytes output)
#
encode
function encode(bytes14[] input) internal pure returns (bytes output)
#
encode
function encode(bytes15[] input) internal pure returns (bytes output)
#
encode
function encode(bytes16[] input) internal pure returns (bytes output)
#
encode
function encode(bytes17[] input) internal pure returns (bytes output)
#
encode
function encode(bytes18[] input) internal pure returns (bytes output)
#
encode
function encode(bytes19[] input) internal pure returns (bytes output)
#
encode
function encode(bytes20[] input) internal pure returns (bytes output)
#
encode
function encode(bytes21[] input) internal pure returns (bytes output)
#
encode
function encode(bytes22[] input) internal pure returns (bytes output)
#
encode
function encode(bytes23[] input) internal pure returns (bytes output)
#
encode
function encode(bytes24[] input) internal pure returns (bytes output)
#
encode
function encode(bytes25[] input) internal pure returns (bytes output)
#
encode
function encode(bytes26[] input) internal pure returns (bytes output)
#
encode
function encode(bytes27[] input) internal pure returns (bytes output)
#
encode
function encode(bytes28[] input) internal pure returns (bytes output)
#
encode
function encode(bytes29[] input) internal pure returns (bytes output)
#
encode
function encode(bytes30[] input) internal pure returns (bytes output)
#
encode
function encode(bytes31[] input) internal pure returns (bytes output)
#
encode
function encode(bytes32[] input) internal pure returns (bytes output)
#
encode
function encode(address[] input) internal pure returns (bytes output)
#
encode
function encode(bool[] input) internal pure returns (bytes output)
#
encode
function encode(enum SchemaType[] input) internal pure returns (bytes output)
#
encode
function encode(bytes[] input) internal pure returns (bytes output)
Converts a bytes
memory array to a single bytes
memory value.
TODO: optimize gas cost
#
TightCoder
#
_encodeToLocation
function _encodeToLocation(bytes32[] array, Slice packedSlice, uint256 elementSize, bool leftAligned) private pure
_Copies the array to the location of packedSlice
,
tightly packing it using the given size per element (in bytes)
TODO this function is currently not used externally and will be changed in the future (see https://github.com/latticexyz/mud/issues/444)_
#
encode
function encode(bytes32[] array, uint256 elementSize, bool leftAligned) internal pure returns (bytes data)
Copies the array to a new bytes array, tightly packing it using the given size per element (in bytes)
#
decode
function decode(Slice packedSlice, uint256 elementSize, bool leftAligned) internal pure returns (bytes32[] array)
Unpacks the slice to a new memory location and lays it out like a memory array with the given size per element (in bytes)