How to use the @truffle/codec.Utils.EVM 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 / helpers / index.js View on Github external
export function keccak256(...args) {
  return Utils.Conversion.toHexString(Utils.EVM.keccak256(...args));
}
github trufflesuite / truffle / packages / debugger / lib / evm / reducers.js View on Github external
[action.storageAddress]: {
            storage: {},
            code: "0x",
            context: null
            //there will be more here in the future!
          }
        }
      };
      return newState;

    case actions.STORE: {
      debug("store action");
      //on a store, the relevant page should already exist, so we can just
      //add or update the needed slot
      const { address, slot, value } = action;
      if (address === CodecUtils.EVM.ZERO_ADDRESS) {
        //as always, we do not maintain a zero page
        return state;
      }
      newState = state.slice(); //clone the state
      topCodex = newState[newState.length - 1];
      newState[newState.length - 1] = updateFrameStorage(
        topCodex,
        address,
        slot,
        value
      );
      return newState;
    }

    case actions.LOAD: {
      debug("load action");
github trufflesuite / truffle / packages / debugger / lib / trace / sagas / index.js View on Github external
address =>
            address !== undefined && address !== CodecUtils.EVM.ZERO_ADDRESS
        )
github trufflesuite / truffle / packages / debugger / lib / evm / reducers.js View on Github external
/*
     * Default case
     */
    default:
      return state;
  }
}

const info = combineReducers({
  contexts
});

const DEFAULT_TX = {
  gasprice: new BN(0),
  origin: CodecUtils.EVM.ZERO_ADDRESS
};

function tx(state = DEFAULT_TX, action) {
  switch (action.type) {
    case actions.SAVE_GLOBALS:
      let { gasprice, origin } = action;
      return { gasprice, origin };
    case actions.UNLOAD_TRANSACTION:
      return DEFAULT_TX;
    default:
      return state;
  }
}

const DEFAULT_BLOCK = {
  coinbase: CodecUtils.EVM.ZERO_ADDRESS,