Merge branch 'master' into set-file

pull/2075/head
David Disu 3 years ago committed by GitHub
commit a346c7a2e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx
  2. 10
      libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts

@ -74,7 +74,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
const params = api.getCompilerParameters()
const optimize = params.optimize
const runs = params.runs as string
const evmVersion = params.evmVersion
const evmVersion = compileTabLogic.evmVersions.includes(params.evmVersion) ? params.evmVersion : 'default'
const language = getValidLanguage(params.language)
return {
@ -547,16 +547,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
<div className="mb-2">
<label className="remixui_compilerLabel form-check-label" htmlFor="evmVersionSelector">EVM Version</label>
<select value={state.evmVersion} onChange={(e) => handleEvmVersionChange(e.target.value)} className="custom-select" id="evmVersionSelector">
<option data-id={state.evmVersion === 'default' ? 'selected' : ''} value="default">compiler default</option>
<option data-id={state.evmVersion === 'london' ? 'selected' : ''} value="london">london</option>
<option data-id={state.evmVersion === 'berlin' ? 'selected' : ''} value="berlin">berlin</option>
<option data-id={state.evmVersion === 'istanbul' ? 'selected' : ''} value="istanbul">istanbul</option>
<option data-id={state.evmVersion === 'petersburg' ? 'selected' : ''} value="petersburg">petersburg</option>
<option data-id={state.evmVersion === 'constantinople' ? 'selected' : ''} value="constantinople">constantinople</option>
<option data-id={state.evmVersion === 'byzantium' ? 'selected' : ''} value="byzantium">byzantium</option>
<option data-id={state.evmVersion === 'spuriousDragon' ? 'selected' : ''} value="spuriousDragon">spuriousDragon</option>
<option data-id={state.evmVersion === 'tangerineWhistle' ? 'selected' : ''} value="tangerineWhistle">tangerineWhistle</option>
<option data-id={state.evmVersion === 'homestead' ? 'selected' : ''} value="homestead">homestead</option>
{compileTabLogic.evmVersions.map((version) => (<option data-id={state.evmVersion === version ? 'selected' : ''} value={version}>{version}</option>))}
</select>
</div>
<div className="mt-3">

@ -17,10 +17,12 @@ export class CompileTabLogic {
public language: string
public compilerImport
public event
public evmVersions: Array<string>
constructor (public api: ICompilerApi, public contentImport) {
this.event = new EventEmitter()
this.compiler = new Compiler((url, cb) => api.resolveContentAndSave(url).then((result) => cb(null, result)).catch((error) => cb(error.message)))
this.evmVersions = ['default', 'london', 'istanbul', 'petersburg', 'constantinople', 'byzantium', 'spuriousDragon', 'tangerineWhistle', 'homestead']
}
init () {
@ -34,8 +36,12 @@ export class CompileTabLogic {
this.compiler.set('runs', this.runs)
this.evmVersion = this.api.getCompilerParameters().evmVersion
if (this.evmVersion === 'undefined' || this.evmVersion === 'null' || !this.evmVersion) {
this.evmVersion = null
if (
this.evmVersion === 'undefined' ||
this.evmVersion === 'null' ||
!this.evmVersion ||
!this.evmVersions.includes(this.evmVersion)) {
this.evmVersion = null
}
this.api.setCompilerParameters({ evmVersion: this.evmVersion })
this.compiler.set('evmVersion', this.evmVersion)

Loading…
Cancel
Save