You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As part of the Factories PR (#749), I need to generically pass around table keys as an array of bytes32. This is difficult because the logic for serialising keys is inlined in table contracts:
/** Get the full data (using the specified store) */
function get(...) internal view returns (StaticsData memory _table) {
bytes32[] memory _primaryKeys = new bytes32[](7);
_primaryKeys[0] = bytes32(uint256((k1)));
_primaryKeys[1] = bytes32(uint256(uint32((k2))));
_primaryKeys[2] = bytes32((k3));
_primaryKeys[3] = bytes32(bytes20((k4)));
_primaryKeys[4] = _boolToBytes32((k5));
_primaryKeys[5] = bytes32(uint256(uint8(k6)));
_primaryKeys[6] = bytes32(uint256(uint8(k7)));
bytes memory _blob = _store.getRecord(_tableId, _primaryKeys, getSchema());
return decode(_blob);
}
Like the encode() method for data, this logic should be moved to a encodeKey() method like:
I agree, the rendering logic is already encapsulated in _primaryKeysDefinition, I haven't made a separate method only because it hasn't been needed yet
As part of the Factories PR (#749), I need to generically pass around table keys as an array of
bytes32
. This is difficult because the logic for serialising keys is inlined in table contracts:Like the
encode()
method for data, this logic should be moved to aencodeKey()
method like:I experimentally added this functionality here but it should be moved to a separate PR.
The text was updated successfully, but these errors were encountered: