Commit 422b042e authored by yann300's avatar yann300

es6 class function

parent 31ad4d06
...@@ -6,24 +6,24 @@ class Bool extends ValueType { ...@@ -6,24 +6,24 @@ class Bool extends ValueType {
constructor () { constructor () {
super(1, 1, 'bool') super(1, 1, 'bool')
} }
}
Bool.prototype.decodeFromStorage = function (location, storageContent) { decodeFromStorage (location, storageContent) {
var value = util.extractHexValue(location, storageContent, this.storageBytes) var value = util.extractHexValue(location, storageContent, this.storageBytes)
return value !== '00' return value !== '00'
} }
Bool.prototype.decodeFromStack = function (stackDepth, stack, memory) { decodeFromStack (stackDepth, stack, memory) {
if (stack.length - 1 < stackDepth) { if (stack.length - 1 < stackDepth) {
return false return false
} else { } else {
return util.extractHexByteSlice(stack[stack.length - 1 - stackDepth], this.storageBytes, 0) !== '00' return util.extractHexByteSlice(stack[stack.length - 1 - stackDepth], this.storageBytes, 0) !== '00'
}
} }
}
Bool.prototype.decodeFromMemory = function (offset, memory) { decodeFromMemory (offset, memory) {
var value = memory.substr(offset, 64) var value = memory.substr(offset, 64)
return util.extractHexByteSlice(value, this.storageBytes, 0) !== '00' return util.extractHexByteSlice(value, this.storageBytes, 0) !== '00'
}
} }
module.exports = Bool module.exports = Bool
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