How to use the @truffle/codec.Memory function in @truffle/codec

To help you get started, we’ve selected a few @truffle/codec examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github trufflesuite / truffle / packages / debugger / lib / data / sagas / index.js View on Github external
export function* recordAllocations() {
  const contracts = yield select(
    data.views.userDefinedTypes.contractDefinitions
  );
  debug("contracts %O", contracts);
  const referenceDeclarations = yield select(data.views.referenceDeclarations);
  const userDefinedTypes = yield select(data.views.userDefinedTypes);
  debug("referenceDeclarations %O", referenceDeclarations);
  const storageAllocations = Codec.Storage.Allocate.getStorageAllocations(
    referenceDeclarations,
    contracts
  );
  debug("storageAllocations %O", storageAllocations);
  const memoryAllocations = Codec.Memory.Allocate.getMemoryAllocations(
    referenceDeclarations
  );
  const calldataAllocations = Codec.AbiData.Allocate.getAbiAllocations(
    userDefinedTypes
  );
  yield put(
    actions.allocate(storageAllocations, memoryAllocations, calldataAllocations)
  );
}