Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
createValue: createLeaf(["./isCreate", state], (isCreate, { stack }) => {
if (!isCreate) {
return null;
}
//creates have the value as the first argument
let value = stack[stack.length - 1];
return Codec.Conversion.toBN(value);
}),
function* decodeMappingKeySaga(indexDefinition, keyDefinition) {
//something of a HACK -- cleans any out-of-range booleans
//resulting from the main mapping key decoding loop
let indexValue = yield* decodeMappingKeyCore(indexDefinition, keyDefinition);
return indexValue ? Codec.Conversion.cleanBool(indexValue) : indexValue;
}
//table here are supposed to preserve path information, we'll be
//replacing a fairly bare-bones Slot object with one with a full path.
//we do NOT want to distinguish between types with and without "_ptr" on
//the end here! (or _slice)
debug("typeIdentifier %s", typeIdentifier);
typeIdentifier = Codec.Ast.Utils.regularizeTypeIdentifier(typeIdentifier);
parentType = Codec.Ast.Utils.regularizeTypeIdentifier(parentType);
debug("slot %o", slot);
let hexSlotAddress = Codec.Conversion.toHexString(
Codec.Storage.Utils.slotAddress(slot),
Codec.Evm.Utils.WORD_SIZE
);
let parentAddress = slot.path
? Codec.Conversion.toHexString(
Codec.Storage.Utils.slotAddress(slot.path),
Codec.Evm.Utils.WORD_SIZE
)
: undefined;
//this is going to be messy and procedural, sorry. but let's start with
//the easy stuff: create the new address if needed, clone if not
let newState = {
...state,
byAddress: {
...state.byAddress,
[address]: {
byType: {
...(state.byAddress[address] || { byType: {} }).byType
}
}
baseNode,
mappedPaths,
currentAssignments,
currentDepth
) {
let fullId = stableKeccak256({
astId: baseNode.id,
stackframe: currentDepth
});
debug("astId: %d", baseNode.id);
debug("stackframe: %d", currentDepth);
debug("fullId: %s", fullId);
debug("currentAssignments: %O", currentAssignments);
//base expression is an expression, and so has a literal assigned to
//it
let offset = Codec.Conversion.toBN(
currentAssignments.byId[fullId].ref.literal
);
return { offset };
}
//found as the slotAddress of the slot's path object, if it exists -- if
//it doesn't then we conclude that no the parent does not have a spot in
//the table). If the parent has a slot in the table already, then we
//alter the child slot by replacing its path with the parent slot. This
//will keep the slotAddress the same, but since the versions kept in the
//table here are supposed to preserve path information, we'll be
//replacing a fairly bare-bones Slot object with one with a full path.
//we do NOT want to distinguish between types with and without "_ptr" on
//the end here! (or _slice)
debug("typeIdentifier %s", typeIdentifier);
typeIdentifier = Codec.Ast.Utils.regularizeTypeIdentifier(typeIdentifier);
parentType = Codec.Ast.Utils.regularizeTypeIdentifier(parentType);
debug("slot %o", slot);
let hexSlotAddress = Codec.Conversion.toHexString(
Codec.Storage.Utils.slotAddress(slot),
Codec.Evm.Utils.WORD_SIZE
);
let parentAddress = slot.path
? Codec.Conversion.toHexString(
Codec.Storage.Utils.slotAddress(slot.path),
Codec.Evm.Utils.WORD_SIZE
)
: undefined;
//this is going to be messy and procedural, sorry. but let's start with
//the easy stuff: create the new address if needed, clone if not
let newState = {
...state,
byAddress: {
...state.byAddress,