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([ engine.register([
compileTab, compileTab,
compileTab.compileTabLogic,
run, run,
debug, debug,
analysis, analysis,

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

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

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

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

@ -23,6 +23,5 @@ export interface ICompilerApi {
writeFile: (file: string, content: string) => Promise<void> writeFile: (file: string, content: string) => Promise<void>
readFile: (file: string) => Promise<string> readFile: (file: string) => Promise<string>
open: (file: string) => void open: (file: string) => void
addExternalFile: (file: string, content: string) => void
onCurrentFileChanged: (listener: onCurrentFileChanged) => 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 Compiler = require('@remix-project/remix-solidity').Compiler
const EventEmitter = require('events') 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 { declare global {
interface Window { interface Window {
@ -18,7 +8,7 @@ declare global {
} }
const _paq = window._paq = window._paq || [] //eslint-disable-line const _paq = window._paq = window._paq || [] //eslint-disable-line
export class CompileTab extends Plugin { export class CompileTab {
public compiler public compiler
public optimize public optimize
public runs public runs
@ -27,7 +17,6 @@ export class CompileTab extends Plugin {
public event public event
constructor (public api, public contentImport) { constructor (public api, public contentImport) {
super(profile)
this.event = new EventEmitter() this.event = new EventEmitter()
this.compiler = new Compiler((url, cb) => api.resolveContentAndSave(url).then((result) => cb(null, result)).catch((error) => cb(error.message))) 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 // Slither Analysis
if (slitherEnabled) { if (slitherEnabled) {
props.analysisModule.call('solidity-logic', 'getCompilerState').then(async (compilerState) => { props.analysisModule.call('solidity', 'getCompilerState').then((compilerState) => {
const { currentVersion, optimize, evmVersion } = compilerState const { currentVersion, optimize, evmVersion } = compilerState
props.analysisModule.call('terminal', 'log', { type: 'info', value: '[Slither Analysis]: Running...' }) props.analysisModule.call('terminal', 'log', { type: 'info', value: '[Slither Analysis]: Running...' })
_paq.push(['trackEvent', 'solidityStaticAnalyzer', 'analyzeWithSlither']) _paq.push(['trackEvent', 'solidityStaticAnalyzer', 'analyzeWithSlither'])

Loading…
Cancel
Save