|
|
|
@ -28,26 +28,26 @@ class Injector { |
|
|
|
|
|
|
|
|
|
_getHash(id) { |
|
|
|
|
this.hashCounter++; |
|
|
|
|
return web3Utils.keccak256(`${id}:${this.hashCounter}`); |
|
|
|
|
return web3Utils.keccak256(`${id}:${this.hashCounter}`).slice(0,18); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Method returns void
|
|
|
|
|
_getDefaultMethodIdentifier(id){ |
|
|
|
|
return `c_${web3Utils.keccak256(id).slice(0,10)}` |
|
|
|
|
return `c_${web3Utils.keccak256(id).slice(2,10)}` |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Method returns boolean: true
|
|
|
|
|
_getTrueMethodIdentifier(id){ |
|
|
|
|
return `c_true${web3Utils.keccak256(id).slice(0,10)}` |
|
|
|
|
return `c_true${web3Utils.keccak256(id).slice(2,10)}` |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Method returns boolean: false
|
|
|
|
|
_getFalseMethodIdentifier(id){ |
|
|
|
|
return `c_false${web3Utils.keccak256(id).slice(0,10)}` |
|
|
|
|
return `c_false${web3Utils.keccak256(id).slice(2,10)}` |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_getModifierIdentifier(id){ |
|
|
|
|
return `c_mod${web3Utils.keccak256(id).slice(0,10)}` |
|
|
|
|
return `c_mod${web3Utils.keccak256(id).slice(2,10)}` |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_getInjectionComponents(contract, injectionPoint, id, type){ |
|
|
|
@ -70,9 +70,9 @@ class Injector { |
|
|
|
|
* @return {String} |
|
|
|
|
*/ |
|
|
|
|
_getDefaultMethodDefinition(id){ |
|
|
|
|
const hash = web3Utils.keccak256(id).slice(0,10); |
|
|
|
|
const hash = web3Utils.keccak256(id).slice(2,10); |
|
|
|
|
const method = this._getMethodIdentifier(id); |
|
|
|
|
return `\nfunction ${method}(bytes32 c__${hash}) internal pure {}\n`; |
|
|
|
|
return `\nfunction ${method}(bytes8 c__${hash}) internal pure {}\n`; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -82,9 +82,9 @@ class Injector { |
|
|
|
|
* @return {String} |
|
|
|
|
*/ |
|
|
|
|
_getFileScopedHashMethodDefinition(id, contract){ |
|
|
|
|
const hash = web3Utils.keccak256(id).slice(0,10); |
|
|
|
|
const hash = web3Utils.keccak256(id).slice(2,10); |
|
|
|
|
const method = this._getDefaultMethodIdentifier(id); |
|
|
|
|
return `\nfunction ${method}(bytes32 c__${hash}) public pure {}\n`; |
|
|
|
|
return `\nfunction ${method}(bytes8 c__${hash}) public pure {}\n`; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -94,9 +94,9 @@ class Injector { |
|
|
|
|
* @return {String} ex: bytes32[1] memory _sc_82e0891 |
|
|
|
|
*/ |
|
|
|
|
_getTrueMethodDefinition(id){ |
|
|
|
|
const hash = web3Utils.keccak256(id).slice(0,10); |
|
|
|
|
const hash = web3Utils.keccak256(id).slice(2,10); |
|
|
|
|
const method = this._getTrueMethodIdentifier(id); |
|
|
|
|
return `function ${method}(bytes32 c__${hash}) public pure returns (bool){ return true; }\n`; |
|
|
|
|
return `function ${method}(bytes8 c__${hash}) public pure returns (bool){ return true; }\n`; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -106,9 +106,9 @@ class Injector { |
|
|
|
|
* @return {String} ex: bytes32[1] memory _sc_82e0891 |
|
|
|
|
*/ |
|
|
|
|
_getFalseMethodDefinition(id){ |
|
|
|
|
const hash = web3Utils.keccak256(id).slice(0,10); |
|
|
|
|
const hash = web3Utils.keccak256(id).slice(2,10); |
|
|
|
|
const method = this._getFalseMethodIdentifier(id); |
|
|
|
|
return `function ${method}(bytes32 c__${hash}) public pure returns (bool){ return false; }\n`; |
|
|
|
|
return `function ${method}(bytes8 c__${hash}) public pure returns (bool){ return false; }\n`; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_getModifierDefinitions(contractId, instrumentation){ |
|
|
|
|