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