git ssb

0+

wanderer🌟 / js-primea-hypervisor



Commit cf401213145158aadf470ff99c38962a1d0e7d12

Utils: include deployed contract address calculation

Alex Beregszaszi committed on 8/23/2016, 12:27:46 AM
Parent: 04af14cd7056250c22a08f3950f10cfa2dcbb8c8

Files changed

utils.jschanged
utils.jsView
@@ -1,7 +1,14 @@
1+const ethUtils = require('ethereumjs-util')
2+const Address = require('./address.js')
3+
14 var Utils = {}
25
36 Utils.isWASMCode = function (code) {
47 return code.slice(0, 4).toString() === new Uint8Array([0, 0x61, 0x73, 0x6d]).toString()
58 }
69
10+Utils.newAccountAddress = function (sender, data) {
11+ return new Address('0x' + ethUtils.sha3(Buffer.concat([ sender.toBuffer(), Buffer.from(data) ])).slice(0, 20).toString('hex'))
12+}
13+
714 module.exports = Utils

Built with git-ssb-web