Skip to content

Commit

Permalink
fix: SolcJS compiler version label (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tair Asim authored Dec 24, 2021
1 parent 7b1e463 commit a41de7f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
9 changes: 3 additions & 6 deletions components/Editor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import SCEditor from 'react-simple-code-editor'
import { EthereumContext } from 'context/ethereumContext'
import { SettingsContext, Setting } from 'context/settingsContext'

import { getTargetEvmVersion } from 'util/compiler'
import { getTargetEvmVersion, compilerSemVer } from 'util/compiler'
import { codeHighlight, isEmpty, isHex } from 'util/string'

import examples from 'components/Editor/examples'
Expand All @@ -39,9 +39,6 @@ type SCEditorRef = {
const editorHeight = 350
const consoleHeight = 350

// FIXME: Handle compiler detection
const compilerVersion = 'v0.8.9'

const Editor = ({ readOnly = false }: Props) => {
const { settingsLoaded, getSetting, setSetting } = useContext(SettingsContext)

Expand All @@ -61,7 +58,7 @@ const Editor = ({ readOnly = false }: Props) => {
const [output, setOutput] = useState<IConsoleOutput[]>([
{
type: 'info',
message: `Loading Solidity compiler ${compilerVersion}...`,
message: `Loading Solidity compiler ${compilerSemVer}...`,
},
])
const solcWorkerRef = useRef<null | Worker>(null)
Expand Down Expand Up @@ -262,7 +259,7 @@ const Editor = ({ readOnly = false }: Props) => {
</div>

<div className="rounded-b-lg py-2 px-4 border-t bg-gray-800 dark:bg-black-700 border-black-900 border-opacity-25 text-gray-400 dark:text-gray-600 text-xs">
Solidity Compiler {compilerVersion}
Solidity Compiler {compilerSemVer}
</div>
</div>
)
Expand Down
8 changes: 4 additions & 4 deletions lib/solcWorker.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
importScripts(
'https://solc-bin.ethereum.org/bin/soljson-v0.8.10+commit.fc410830.js',
)
import { compilerVersion } from 'util/compiler'

// Code extracted from https://github.com/ethereum/solc-js/blob/v0.8.9/wrapper.js
importScripts(`https://solc-bin.ethereum.org/bin/${compilerVersion}.js`)

// Code extracted from https://github.com/ethereum/solc-js/blob/{compilerVersion}/wrapper.js
const alloc = cwrap('solidity_alloc', 'number', ['number'])
const copyFromCString = UTF8ToString
const reset = cwrap('solidity_reset', null, [])
Expand Down
3 changes: 3 additions & 0 deletions util/compiler.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
export const compilerSemVer = 'v0.8.10'
export const compilerVersion = `soljson-${compilerSemVer}+commit.fc410830`

/**
* Gets target EVM version from a hardfork name
*
Expand Down

1 comment on commit a41de7f

@vercel
Copy link

@vercel vercel bot commented on a41de7f Dec 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.