|
|
|
@ -4,11 +4,13 @@ import { update } from 'solc/abi' |
|
|
|
|
import * as webworkify from 'webworkify-webpack' |
|
|
|
|
import compilerInput from './compiler-input' |
|
|
|
|
import EventManager from '../lib/eventManager' |
|
|
|
|
import { default as txHelper } from './txHelper'; |
|
|
|
|
import { Source, SourceWithTarget, MessageFromWorker, CompilerState, CompilationResult,
|
|
|
|
|
import txHelper from './txHelper' |
|
|
|
|
import { |
|
|
|
|
Source, SourceWithTarget, MessageFromWorker, CompilerState, CompilationResult, |
|
|
|
|
visitContractsCallbackParam, visitContractsCallbackInterface, CompilationError, |
|
|
|
|
gatherImportsCallbackInterface, |
|
|
|
|
isFunctionDescription } from './types' |
|
|
|
|
isFunctionDescription |
|
|
|
|
} from './types' |
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
trigger compilationFinished, compilerLoaded, compilationStarted, compilationDuration |
|
|
|
@ -68,9 +70,8 @@ export class Compiler { |
|
|
|
|
this.gatherImports(files, missingInputs, (error, input) => { |
|
|
|
|
if (error) { |
|
|
|
|
this.state.lastCompilationResult = null |
|
|
|
|
this.event.trigger('compilationFinished', [false, {'error': { formattedMessage: error, severity: 'error' }}, files]) |
|
|
|
|
} else if(this.state.compileJSON && input) |
|
|
|
|
this.state.compileJSON(input) |
|
|
|
|
this.event.trigger('compilationFinished', [false, { error: { formattedMessage: error, severity: 'error' } }, files]) |
|
|
|
|
} else if (this.state.compileJSON && input) { this.state.compileJSON(input) } |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -151,9 +152,8 @@ export class Compiler { |
|
|
|
|
this.internalCompile(source.sources, missingInputs) |
|
|
|
|
} else { |
|
|
|
|
data = this.updateInterface(data) |
|
|
|
|
if(source) |
|
|
|
|
{ |
|
|
|
|
source.target = this.state.target; |
|
|
|
|
if (source) { |
|
|
|
|
source.target = this.state.target |
|
|
|
|
this.state.lastCompilationResult = { |
|
|
|
|
data: data, |
|
|
|
|
source: source |
|
|
|
@ -340,8 +340,7 @@ export class Compiler { |
|
|
|
|
} |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
if(cb) |
|
|
|
|
cb(null, { 'sources': files }) |
|
|
|
|
if (cb) { cb(null, { sources: files }) } |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -366,9 +365,9 @@ export class Compiler { |
|
|
|
|
// yul compiler does not return any abi,
|
|
|
|
|
// we default to accept the fallback function (which expect raw data as argument).
|
|
|
|
|
contract.object.abi.push({ |
|
|
|
|
'payable': true, |
|
|
|
|
'stateMutability': 'payable', |
|
|
|
|
'type': 'fallback' |
|
|
|
|
payable: true, |
|
|
|
|
stateMutability: 'payable', |
|
|
|
|
type: 'fallback' |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
if (data && data.contracts && this.state.currentVersion) { |
|
|
|
@ -379,7 +378,7 @@ export class Compiler { |
|
|
|
|
for (const item of data.contracts[contract.file][contract.name].abi) { |
|
|
|
|
if (isFunctionDescription(item) && item.constant) { |
|
|
|
|
item.payable = false |
|
|
|
|
item.stateMutability = 'view'; |
|
|
|
|
item.stateMutability = 'view' |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -457,4 +456,3 @@ export class Compiler { |
|
|
|
|
return null |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|