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