/*
 * Example - Running code on an ethereum-vm
 *
 *
 * To run this example in the browser, bundle this file
 * with browserify using `browserify index.js -o bundle.js`
 * and then load this folder onto a HTTP WebServer (e.g.
 * using node-static or `python -mSimpleHTTPServer`).
 */
const BN = require('bn.js')
const VM = require('../../dist').default

// Create a new VM instance
// For explicity setting the HF use e.g. `new VM({ hardfork: 'petersburg' })`
const vm = new VM()

const STOP = '00'
const ADD = '01'
const PUSH1 = '60'

// Note that numbers added are hex values, so '20' would be '32' as decimal e.g.
const code = [PUSH1, '03', PUSH1, '05', ADD, STOP]

vm.on('step', function (data) {
  console.log(`Opcode: ${data.opcode.name}\tStack: ${data.stack}`)
})

vm.runCode({
  code: Buffer.from(code.join(''), 'hex'),
  gasLimit: new BN(0xffff),
})
  .then((results) => {
    console.log('Returned : ' + results.returnValue.toString('hex'))
    console.log('gasUsed  : ' + results.gasUsed.toString())
  })
  .catch(console.error)

@@ -382,11 +382,10 @@
 %0A// 
-For
+To
  exp
@@ -398,65 +398,122 @@
  set
-ting
  the 
-HF use e.g. %60new VM(%7B hardfork: 'p
+chain or hardfork use %5BCommon%5D(https://github.com/
 et
+h
 er
-sburg' %7D)%60
+eumjs/ethereumjs-vm/tree/master/packages/common#usage)
 %0Acon

update hf example