fix usage of solidity logic

pull/1342/head
yann300 3 years ago committed by davidzagi93@gmail.com
parent e1af015bf0
commit 76d87196ad
  1. 1
      apps/remix-ide/src/app.js
  2. 2
      apps/remix-ide/src/app/tabs/compile-tab.js
  3. 9
      apps/solidity-compiler/src/app/compiler-api.ts
  4. 2
      apps/solidity-compiler/src/app/compiler.ts
  5. 4
      libs/remix-ui/publish-to-storage/src/lib/publish-to-storage.tsx
  6. 1
      libs/remix-ui/solidity-compiler/src/lib/icompiler-api.ts
  7. 13
      libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts
  8. 2
      libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx

@ -454,7 +454,6 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
engine.register([
compileTab,
compileTab.compileTabLogic,
run,
debug,
analysis,

@ -25,7 +25,7 @@ const profile = {
location: 'sidePanel',
documentation: 'https://remix-ide.readthedocs.io/en/latest/solidity_editor.html',
version: packageJson.version,
methods: ['getCompilationResult', 'compile', 'compileWithParameters', 'setCompilerConfig', 'compileFile']
methods: ['getCompilationResult', 'compile', 'compileWithParameters', 'setCompilerConfig', 'compileFile', 'getCompilerState']
}
// EditorApi:

@ -30,13 +30,10 @@ export const CompilerApiMixin = (Base) => class extends Base {
}
onActivation () {
this.call('manager', 'activatePlugin', 'solidity-logic')
this.listenToEvents()
}
onDeactivation () {
this.call('manager', 'deactivatePlugin', 'solidity-logic')
}
onDeactivation () {}
resolveContentAndSave (url) {
return this.call('contentImport', 'resolveAndSave', url)
@ -62,8 +59,8 @@ export const CompilerApiMixin = (Base) => class extends Base {
return this.compileTabLogic.compiler.state.lastCompilationResult
}
addExternalFile (fileName, content) {
this.fileProvider.addExternal(fileName, content)
getCompilerState () {
return this.compileTabLogic.getCompilerState()
}
/**

@ -12,7 +12,7 @@ const profile = {
location: 'sidePanel',
documentation: 'https://remix-ide.readthedocs.io/en/latest/solidity_editor.html',
version: '0.0.1',
methods: ['getCompilationResult', 'compile', 'compileWithParameters', 'setCompilerConfig', 'compileFile']
methods: ['getCompilationResult', 'compile', 'compileWithParameters', 'setCompilerConfig', 'compileFile' ,'getCompilerState']
}
export interface ConfigurationSettings {

@ -29,7 +29,7 @@ export const PublishToStorage = (props: RemixUiPublishToStorageProps) => {
modal(`Published ${contract.name}'s Metadata`, publishMessage(result.uploaded))
// triggered each time there's a new verified publish (means hash correspond)
api.addExternalFile('swarm/' + result.item.hash, result.item.content)
api.writeFile('swarm/' + result.item.hash, result.item.content)
} catch (err) {
let parseError = err
try {
@ -43,7 +43,7 @@ export const PublishToStorage = (props: RemixUiPublishToStorageProps) => {
modal(`Published ${contract.name}'s Metadata`, publishMessage(result.uploaded))
// triggered each time there's a new verified publish (means hash correspond)
api.addExternalFile('ipfs/' + result.item.hash, result.item.content)
api.writeFile('ipfs/' + result.item.hash, result.item.content)
} catch (err) {
modal('IPFS Publish Failed', publishMessageFailed(storage, err))
}

@ -23,6 +23,5 @@ export interface ICompilerApi {
writeFile: (file: string, content: string) => Promise<void>
readFile: (file: string) => Promise<string>
open: (file: string) => void
addExternalFile: (file: string, content: string) => void
onCurrentFileChanged: (listener: onCurrentFileChanged) => void
}

@ -1,15 +1,5 @@
import { Plugin } from '@remixproject/engine'
const packageJson = require('../../../../../../package.json')
const Compiler = require('@remix-project/remix-solidity').Compiler
const EventEmitter = require('events')
const profile = {
name: 'solidity-logic',
displayName: 'Solidity compiler logic',
description: 'Compile solidity contracts - Logic',
methods: ['getCompilerState'],
version: packageJson.version
}
declare global {
interface Window {
@ -18,7 +8,7 @@ declare global {
}
const _paq = window._paq = window._paq || [] //eslint-disable-line
export class CompileTab extends Plugin {
export class CompileTab {
public compiler
public optimize
public runs
@ -27,7 +17,6 @@ export class CompileTab extends Plugin {
public event
constructor (public api, public contentImport) {
super(profile)
this.event = new EventEmitter()
this.compiler = new Compiler((url, cb) => api.resolveContentAndSave(url).then((result) => cb(null, result)).catch((error) => cb(error.message)))
}

@ -217,7 +217,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
})
// Slither Analysis
if (slitherEnabled) {
props.analysisModule.call('solidity-logic', 'getCompilerState').then(async (compilerState) => {
props.analysisModule.call('solidity', 'getCompilerState').then((compilerState) => {
const { currentVersion, optimize, evmVersion } = compilerState
props.analysisModule.call('terminal', 'log', { type: 'info', value: '[Slither Analysis]: Running...' })
_paq.push(['trackEvent', 'solidityStaticAnalyzer', 'analyzeWithSlither'])

Loading…
Cancel
Save