@0x/sol-compiler
: Strip receive
functions from 0.6 ABI output
This commit is contained in:
parent
1017707475
commit
3e9309c003
@ -5,6 +5,10 @@
|
|||||||
{
|
{
|
||||||
"note": "Refactor + add solidity 0.6 support",
|
"note": "Refactor + add solidity 0.6 support",
|
||||||
"pr": 2532
|
"pr": 2532
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"note": "Filter `receive` functions from 0.6 ABIs",
|
||||||
|
"pr": 2540
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -32,18 +32,6 @@ export const DEFAULT_COMPILER_SETTINGS: solc.CompilerSettings = {
|
|||||||
export class SolcWrapperV05 extends SolcWrapper {
|
export class SolcWrapperV05 extends SolcWrapper {
|
||||||
protected readonly _compilerSettings: solc.CompilerSettings;
|
protected readonly _compilerSettings: solc.CompilerSettings;
|
||||||
|
|
||||||
public static normalizeOutput(output: StandardOutput): StandardOutput {
|
|
||||||
const _output = _.cloneDeep(output);
|
|
||||||
// tslint:disable-next-line forin
|
|
||||||
for (const contractPath in _output.contracts) {
|
|
||||||
// tslint:disable-next-line forin
|
|
||||||
for (const contract of Object.values(_output.contracts[contractPath])) {
|
|
||||||
addHexPrefixToContractBytecode(contract);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return _output;
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(protected readonly _solcVersion: string, protected readonly _opts: CompilerOptions) {
|
constructor(protected readonly _solcVersion: string, protected readonly _opts: CompilerOptions) {
|
||||||
super();
|
super();
|
||||||
this._compilerSettings = {
|
this._compilerSettings = {
|
||||||
@ -88,7 +76,7 @@ export class SolcWrapperV05 extends SolcWrapper {
|
|||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
input,
|
input,
|
||||||
output: SolcWrapperV05.normalizeOutput(output),
|
output: this._normalizeOutput(output),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,4 +87,17 @@ export class SolcWrapperV05 extends SolcWrapper {
|
|||||||
const solcInstance = await getSolcJSAsync(this.solidityVersion, !!this._opts.isOfflineMode);
|
const solcInstance = await getSolcJSAsync(this.solidityVersion, !!this._opts.isOfflineMode);
|
||||||
return compileSolcJSAsync(solcInstance, input);
|
return compileSolcJSAsync(solcInstance, input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// tslint:disable-next-line: prefer-function-over-method
|
||||||
|
protected _normalizeOutput(output: StandardOutput): StandardOutput {
|
||||||
|
const _output = _.cloneDeep(output);
|
||||||
|
// tslint:disable-next-line forin
|
||||||
|
for (const contractPath in _output.contracts) {
|
||||||
|
// tslint:disable-next-line forin
|
||||||
|
for (const contract of Object.values(_output.contracts[contractPath])) {
|
||||||
|
addHexPrefixToContractBytecode(contract);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _output;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,4 +22,15 @@ export class SolcWrapperV06 extends SolcWrapperV05 {
|
|||||||
solcInstance.compileStandardWrapper = solcInstance.compile;
|
solcInstance.compileStandardWrapper = solcInstance.compile;
|
||||||
return compileSolcJSAsync(solcInstance, input);
|
return compileSolcJSAsync(solcInstance, input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected _normalizeOutput(output: StandardOutput): StandardOutput {
|
||||||
|
const _output = super._normalizeOutput(output);
|
||||||
|
// Filter out 'receive' ABI item types until ethers supports it.
|
||||||
|
for (const contracts of Object.values(_output.contracts)) {
|
||||||
|
for (const contract of Object.values(contracts)) {
|
||||||
|
contract.abi = contract.abi.filter(v => v.type !== 'receive');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _output;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user