MaterialMetadata
State Variables
_tableId
ResourceId constant _tableId = ResourceId.wrap(0x746200000000000000000000000000004d6174657269616c4d65746164617461);
_fieldLayout
FieldLayout constant _fieldLayout = FieldLayout.wrap(0x0015020101140000000000000000000000000000000000000000000000000000);
_keySchema
Schema constant _keySchema = Schema.wrap(0x000e01004d000000000000000000000000000000000000000000000000000000);
_valueSchema
Schema constant _valueSchema = Schema.wrap(0x001502010061c500000000000000000000000000000000000000000000000000);
Functions
getKeyNames
Get the table's key field names.
function getKeyNames() internal pure returns (string[] memory keyNames);
Returns
Name | Type | Description |
---|---|---|
keyNames | string[] | An array of strings with the names of key fields. |
getFieldNames
Get the table's value field names.
function getFieldNames() internal pure returns (string[] memory fieldNames);
Returns
Name | Type | Description |
---|---|---|
fieldNames | string[] | An array of strings with the names of value fields. |
register
Register the table with its config.
function register() internal;
_register
Register the table with its config.
function _register() internal;
getDifficulty
Get difficulty.
function getDifficulty(MaterialId materialId) internal view returns (MATERIAL_DIFFICULTY difficulty);
_getDifficulty
Get difficulty.
function _getDifficulty(MaterialId materialId) internal view returns (MATERIAL_DIFFICULTY difficulty);
setDifficulty
Set difficulty.
function setDifficulty(MaterialId materialId, MATERIAL_DIFFICULTY difficulty) internal;
_setDifficulty
Set difficulty.
function _setDifficulty(MaterialId materialId, MATERIAL_DIFFICULTY difficulty) internal;
getTokenAddress
Get tokenAddress.
function getTokenAddress(MaterialId materialId) internal view returns (address tokenAddress);
_getTokenAddress
Get tokenAddress.
function _getTokenAddress(MaterialId materialId) internal view returns (address tokenAddress);
setTokenAddress
Set tokenAddress.
function setTokenAddress(MaterialId materialId, address tokenAddress) internal;
_setTokenAddress
Set tokenAddress.
function _setTokenAddress(MaterialId materialId, address tokenAddress) internal;
getName
Get name.
function getName(MaterialId materialId) internal view returns (string memory name);
_getName
Get name.
function _getName(MaterialId materialId) internal view returns (string memory name);
setName
Set name.
function setName(MaterialId materialId, string memory name) internal;
_setName
Set name.
function _setName(MaterialId materialId, string memory name) internal;
lengthName
Get the length of name.
function lengthName(MaterialId materialId) internal view returns (uint256);
_lengthName
Get the length of name.
function _lengthName(MaterialId materialId) internal view returns (uint256);
getItemName
Get an item of name.
Reverts with Store_IndexOutOfBounds if _index
is out of bounds for the array.
function getItemName(MaterialId materialId, uint256 _index) internal view returns (string memory);
_getItemName
Get an item of name.
Reverts with Store_IndexOutOfBounds if _index
is out of bounds for the array.
function _getItemName(MaterialId materialId, uint256 _index) internal view returns (string memory);
pushName
Push a slice to name.
function pushName(MaterialId materialId, string memory _slice) internal;
_pushName
Push a slice to name.
function _pushName(MaterialId materialId, string memory _slice) internal;
popName
Pop a slice from name.
function popName(MaterialId materialId) internal;
_popName
Pop a slice from name.
function _popName(MaterialId materialId) internal;
updateName
Update a slice of name at _index
.
function updateName(MaterialId materialId, uint256 _index, string memory _slice) internal;
_updateName
Update a slice of name at _index
.
function _updateName(MaterialId materialId, uint256 _index, string memory _slice) internal;
get
Get the full data.
function get(MaterialId materialId) internal view returns (MaterialMetadataData memory _table);
_get
Get the full data.
function _get(MaterialId materialId) internal view returns (MaterialMetadataData memory _table);
set
Set the full data using individual values.
function set(MaterialId materialId, MATERIAL_DIFFICULTY difficulty, address tokenAddress, string memory name)
internal;
_set
Set the full data using individual values.
function _set(MaterialId materialId, MATERIAL_DIFFICULTY difficulty, address tokenAddress, string memory name)
internal;
set
Set the full data using the data struct.
function set(MaterialId materialId, MaterialMetadataData memory _table) internal;
_set
Set the full data using the data struct.
function _set(MaterialId materialId, MaterialMetadataData memory _table) internal;
decodeStatic
Decode the tightly packed blob of static data using this table's field layout.
function decodeStatic(bytes memory _blob)
internal
pure
returns (MATERIAL_DIFFICULTY difficulty, address tokenAddress);
decodeDynamic
Decode the tightly packed blob of dynamic data using the encoded lengths.
function decodeDynamic(EncodedLengths _encodedLengths, bytes memory _blob) internal pure returns (string memory name);
decode
Decode the tightly packed blobs using this table's field layout.
function decode(bytes memory _staticData, EncodedLengths _encodedLengths, bytes memory _dynamicData)
internal
pure
returns (MaterialMetadataData memory _table);
Parameters
Name | Type | Description |
---|---|---|
_staticData | bytes | Tightly packed static fields. |
_encodedLengths | EncodedLengths | Encoded lengths of dynamic fields. |
_dynamicData | bytes | Tightly packed dynamic fields. |
deleteRecord
Delete all data for given keys.
function deleteRecord(MaterialId materialId) internal;
_deleteRecord
Delete all data for given keys.
function _deleteRecord(MaterialId materialId) internal;
encodeStatic
Tightly pack static (fixed length) data using this table's schema.
function encodeStatic(MATERIAL_DIFFICULTY difficulty, address tokenAddress) internal pure returns (bytes memory);
Returns
Name | Type | Description |
---|---|---|
<none> | bytes | The static data, encoded into a sequence of bytes. |
encodeLengths
Tightly pack dynamic data lengths using this table's schema.
function encodeLengths(string memory name) internal pure returns (EncodedLengths _encodedLengths);
Returns
Name | Type | Description |
---|---|---|
_encodedLengths | EncodedLengths | The lengths of the dynamic fields (packed into a single bytes32 value). |
encodeDynamic
Tightly pack dynamic (variable length) data using this table's schema.
function encodeDynamic(string memory name) internal pure returns (bytes memory);
Returns
Name | Type | Description |
---|---|---|
<none> | bytes | The dynamic data, encoded into a sequence of bytes. |
encode
Encode all of a record's fields.
function encode(MATERIAL_DIFFICULTY difficulty, address tokenAddress, string memory name)
internal
pure
returns (bytes memory, EncodedLengths, bytes memory);
Returns
Name | Type | Description |
---|---|---|
<none> | bytes | The static (fixed length) data, encoded into a sequence of bytes. |
<none> | EncodedLengths | The lengths of the dynamic fields (packed into a single bytes32 value). |
<none> | bytes | The dynamic (variable length) data, encoded into a sequence of bytes. |
encodeKeyTuple
Encode keys as a bytes32 array using this table's field layout.
function encodeKeyTuple(MaterialId materialId) internal pure returns (bytes32[] memory);