remix-project mirror
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
remix-project/remix-debug/test/decoder/mockStorageResolver.js

40 lines
719 B

8 years ago
'use strict'
7 years ago
var remixLib = require('remix-lib')
var util = remixLib.util
8 years ago
class MockStorageResolver {
constructor (_storage) {
this.storage = {}
for (var k in _storage) {
var hashed = util.sha3_256(k)
8 years ago
this.storage[hashed] = {
hashed: hashed,
key: k,
value: _storage[k]
}
}
}
storageRange (callback) {
callback(null, this.storage)
}
storageSlot (slot, callback) {
var hashed = util.sha3_256(slot)
8 years ago
callback(null, this.storage[hashed])
}
isComplete (address) {
return true
}
fromCache (address, slotKey) {
return this.storage[slotKey]
}
toCache (address, storage, complete) {
}
}
module.exports = MockStorageResolver