parent
20c32ddfad
commit
1a10971792
@ -1,29 +1,20 @@ |
|||||||
'use strict' |
'use strict' |
||||||
var util = require('./util') |
|
||||||
var ValueType = require('./ValueType') |
var ValueType = require('./ValueType') |
||||||
|
var util = require('./util') |
||||||
|
|
||||||
class Bool extends ValueType { |
class Bool extends ValueType { |
||||||
constructor () { |
constructor () { |
||||||
super(1, 1, 'bool') |
super(1, 1, 'bool') |
||||||
} |
} |
||||||
|
|
||||||
decodeFromStorage (location, storageContent) { |
decodeValue (value) { |
||||||
var value = util.extractHexValue(location, storageContent, this.storageBytes) |
if (!value) { |
||||||
return value !== '00' |
|
||||||
} |
|
||||||
|
|
||||||
decodeFromStack (stackDepth, stack, memory) { |
|
||||||
if (stack.length - 1 < stackDepth) { |
|
||||||
return false |
return false |
||||||
} else { |
} else { |
||||||
return util.extractHexByteSlice(stack[stack.length - 1 - stackDepth], this.storageBytes, 0) !== '00' |
value = util.extractHexByteSlice(value, this.storageBytes, 0) |
||||||
|
return value !== '00' |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
decodeFromMemory (offset, memory) { |
|
||||||
var value = memory.substr(offset, 64) |
|
||||||
return util.extractHexByteSlice(value, this.storageBytes, 0) !== '00' |
|
||||||
} |
|
||||||
} |
} |
||||||
|
|
||||||
module.exports = Bool |
module.exports = Bool |
||||||
|
Loading…
Reference in new issue