|
|
|
@ -72,7 +72,7 @@ class Injector { |
|
|
|
|
*/ |
|
|
|
|
_getDefaultMethodDefinition(id){ |
|
|
|
|
const hash = web3Utils.keccak256(id).slice(2,10); |
|
|
|
|
const method = this._getMethodIdentifier(id); |
|
|
|
|
const method = this._getDefaultMethodIdentifier(id); |
|
|
|
|
return `\nfunction ${method}(bytes8 c__${hash}) internal pure {}\n`; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -97,7 +97,7 @@ class Injector { |
|
|
|
|
_getTrueMethodDefinition(id){ |
|
|
|
|
const hash = web3Utils.keccak256(id).slice(2,10); |
|
|
|
|
const method = this._getTrueMethodIdentifier(id); |
|
|
|
|
return `function ${method}(bytes8 c__${hash}) public pure returns (bool){ return true; }\n`; |
|
|
|
|
return `function ${method}(bytes8 c__${hash}) internal pure returns (bool){ return true; }\n`; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -109,7 +109,7 @@ class Injector { |
|
|
|
|
_getFalseMethodDefinition(id){ |
|
|
|
|
const hash = web3Utils.keccak256(id).slice(2,10); |
|
|
|
|
const method = this._getFalseMethodIdentifier(id); |
|
|
|
|
return `function ${method}(bytes8 c__${hash}) public pure returns (bool){ return false; }\n`; |
|
|
|
|
return `function ${method}(bytes8 c__${hash}) internal pure returns (bool){ return false; }\n`; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_getModifierDefinitions(contractId, instrumentation){ |
|
|
|
@ -308,12 +308,12 @@ class Injector { |
|
|
|
|
const end = contract.instrumented.slice(injectionPoint); |
|
|
|
|
const id = `${fileName}:${injection.contractName}`; |
|
|
|
|
|
|
|
|
|
const defaultMethodDefinition = (injection.isFileScoped) |
|
|
|
|
const methodDefinition = (injection.isFileScoped) |
|
|
|
|
? this._getFileScopedHashMethodDefinition(id) |
|
|
|
|
: this._getHashMethodDefinition(id); |
|
|
|
|
: this._getDefaultMethodDefinition(id); |
|
|
|
|
|
|
|
|
|
contract.instrumented = `${start}` + |
|
|
|
|
`${defaultMethodDefinition}` + |
|
|
|
|
`${methodDefinition}` + |
|
|
|
|
`${this._getTrueMethodDefinition(id)}` + |
|
|
|
|
`${this._getFalseMethodDefinition(id)}` + |
|
|
|
|
`${this._getModifierDefinitions(id, instrumentation)}` + |
|
|
|
|