mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-04-22 07:57:57 +00:00
add optimizer options:
This commit is contained in:
+17
-4
@@ -93,13 +93,26 @@ export function version(): string {
|
||||
|
||||
export async function compile(
|
||||
sources: SolcInput,
|
||||
option: { bin?: string } = {}
|
||||
option: {
|
||||
optimizer?: Record<string, unknown>
|
||||
bin?: string
|
||||
} = {}
|
||||
): Promise<SolcOutput> {
|
||||
const {
|
||||
optimizer = {
|
||||
mode: 'z',
|
||||
fallback_to_optimizing_for_size: true,
|
||||
enabled: true,
|
||||
runs: 200,
|
||||
},
|
||||
bin,
|
||||
} = option
|
||||
|
||||
const input = JSON.stringify({
|
||||
language: 'Solidity',
|
||||
sources: resolveInputs(sources),
|
||||
settings: {
|
||||
optimizer: { enabled: true, runs: 200 },
|
||||
optimizer,
|
||||
outputSelection: {
|
||||
'*': {
|
||||
'*': ['abi'],
|
||||
@@ -108,8 +121,8 @@ export async function compile(
|
||||
},
|
||||
})
|
||||
|
||||
if (option.bin) {
|
||||
return compileWithBin(input, option.bin)
|
||||
if (bin) {
|
||||
return compileWithBin(input, bin)
|
||||
}
|
||||
|
||||
return resolc(input)
|
||||
|
||||
Reference in New Issue
Block a user