Commit 60ce2bbb authored by yann300's avatar yann300

es6 class function

parent f591e916
...@@ -6,23 +6,23 @@ class Uint extends ValueType { ...@@ -6,23 +6,23 @@ class Uint extends ValueType {
constructor (storageBytes) { constructor (storageBytes) {
super(1, storageBytes, 'uint') super(1, storageBytes, 'uint')
} }
}
Uint.prototype.decodeFromStorage = function (location, storageContent) { decodeFromStorage (location, storageContent) {
return util.decodeInt(location, storageContent, this.storageBytes, false) return util.decodeInt(location, storageContent, this.storageBytes, false)
} }
Uint.prototype.decodeFromStack = function (stackDepth, stack, memory) { decodeFromStack (stackDepth, stack, memory) {
if (stackDepth >= stack.length) { if (stackDepth >= stack.length) {
return '0' return '0'
} else { } else {
return util.decodeIntFromHex(stack[stack.length - 1 - stackDepth].replace('0x', ''), this.storageBytes, false) return util.decodeIntFromHex(stack[stack.length - 1 - stackDepth].replace('0x', ''), this.storageBytes, false)
}
} }
}
Uint.prototype.decodeFromMemory = function (offset, memory) { decodeFromMemory (offset, memory) {
var value = memory.substr(offset, 64) var value = memory.substr(offset, 64)
return util.decodeIntFromHex(value, this.storageBytes, false) return util.decodeIntFromHex(value, this.storageBytes, false)
}
} }
module.exports = Uint module.exports = Uint
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment