Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
d6e7cabc
Unverified
Commit
d6e7cabc
authored
Jul 30, 2021
by
David Disu
Committed by
GitHub
Jul 30, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1397 from ethereum/remove-unused-files
Remove unused files
parents
3bc9d9e1
04d471ab
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
0 additions
and
377 deletions
+0
-377
file-explorer.js
apps/remix-ide/src/app/files/file-explorer.js
+0
-0
compile-tab.js
apps/remix-ide/src/app/tabs/compile-tab.js
+0
-1
compileTab.js
apps/remix-ide/src/app/tabs/compileTab/compileTab.js
+0
-135
compilerContainer.js
apps/remix-ide/src/app/tabs/compileTab/compilerContainer.js
+0
-0
contractParser.js
apps/remix-ide/src/app/tabs/compileTab/contractParser.js
+0
-122
compiler-abstract.ts
...x-ui/solidity-compiler/src/lib/logic/compiler-abstract.ts
+0
-51
compiler-helpers.ts
...ix-ui/solidity-compiler/src/lib/logic/compiler-helpers.ts
+0
-19
compiler-utils.ts
...emix-ui/solidity-compiler/src/lib/logic/compiler-utils.ts
+0
-46
index.ts
libs/remix-ui/solidity-compiler/src/lib/logic/index.ts
+0
-3
No files found.
apps/remix-ide/src/app/files/file-explorer.js
deleted
100644 → 0
View file @
3bc9d9e1
This diff is collapsed.
Click to expand it.
apps/remix-ide/src/app/tabs/compile-tab.js
View file @
d6e7cabc
...
@@ -24,7 +24,6 @@ const profile = {
...
@@ -24,7 +24,6 @@ const profile = {
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'
]
}
}
// EditorApi:
// EditorApi:
...
...
apps/remix-ide/src/app/tabs/compileTab/compileTab.js
deleted
100644 → 0
View file @
3bc9d9e1
import
*
as
packageJson
from
'../../../../../../package.json'
import
{
Plugin
}
from
'@remixproject/engine'
const
EventEmitter
=
require
(
'events'
)
var
Compiler
=
require
(
'@remix-project/remix-solidity'
).
Compiler
const
profile
=
{
name
:
'solidity-logic'
,
displayName
:
'Solidity compiler logic'
,
description
:
'Compile solidity contracts - Logic'
,
methods
:
[
'getCompilerState'
],
version
:
packageJson
.
version
}
class
CompileTab
extends
Plugin
{
constructor
(
queryParams
,
fileManager
,
editor
,
config
,
fileProvider
,
contentImport
)
{
super
(
profile
)
this
.
event
=
new
EventEmitter
()
this
.
queryParams
=
queryParams
this
.
compilerImport
=
contentImport
this
.
compiler
=
new
Compiler
((
url
,
cb
)
=>
this
.
compilerImport
.
resolveAndSave
(
url
).
then
((
result
)
=>
cb
(
null
,
result
)).
catch
((
error
)
=>
cb
(
error
.
message
)))
this
.
fileManager
=
fileManager
this
.
editor
=
editor
this
.
config
=
config
this
.
fileProvider
=
fileProvider
}
init
()
{
this
.
optimize
=
this
.
queryParams
.
get
().
optimize
this
.
optimize
=
this
.
optimize
===
'true'
this
.
queryParams
.
update
({
optimize
:
this
.
optimize
})
this
.
compiler
.
set
(
'optimize'
,
this
.
optimize
)
this
.
runs
=
this
.
queryParams
.
get
().
runs
this
.
runs
=
this
.
runs
||
200
this
.
queryParams
.
update
({
runs
:
this
.
runs
})
this
.
compiler
.
set
(
'runs'
,
this
.
runs
)
this
.
evmVersion
=
this
.
queryParams
.
get
().
evmVersion
if
(
this
.
evmVersion
===
'undefined'
||
this
.
evmVersion
===
'null'
||
!
this
.
evmVersion
)
{
this
.
evmVersion
=
null
}
this
.
queryParams
.
update
({
evmVersion
:
this
.
evmVersion
})
this
.
compiler
.
set
(
'evmVersion'
,
this
.
evmVersion
)
}
setOptimize
(
newOptimizeValue
)
{
this
.
optimize
=
newOptimizeValue
this
.
queryParams
.
update
({
optimize
:
this
.
optimize
})
this
.
compiler
.
set
(
'optimize'
,
this
.
optimize
)
}
setRuns
(
runs
)
{
this
.
runs
=
runs
this
.
queryParams
.
update
({
runs
:
this
.
runs
})
this
.
compiler
.
set
(
'runs'
,
this
.
runs
)
}
setEvmVersion
(
newEvmVersion
)
{
this
.
evmVersion
=
newEvmVersion
this
.
queryParams
.
update
({
evmVersion
:
this
.
evmVersion
})
this
.
compiler
.
set
(
'evmVersion'
,
this
.
evmVersion
)
}
/**
* Set the compiler to using Solidity or Yul (default to Solidity)
* @params lang {'Solidity' | 'Yul'} ...
*/
setLanguage
(
lang
)
{
this
.
compiler
.
set
(
'language'
,
lang
)
}
getCompilerState
()
{
return
this
.
compiler
.
state
}
/**
* Compile a specific file of the file manager
* @param {string} target the path to the file to compile
*/
compileFile
(
target
)
{
if
(
!
target
)
throw
new
Error
(
'No target provided for compiliation'
)
const
provider
=
this
.
fileManager
.
fileProviderOf
(
target
)
if
(
!
provider
)
throw
new
Error
(
`cannot compile
${
target
}
. Does not belong to any explorer`
)
return
new
Promise
((
resolve
,
reject
)
=>
{
provider
.
get
(
target
,
(
error
,
content
)
=>
{
if
(
error
)
return
reject
(
error
)
const
sources
=
{
[
target
]:
{
content
}
}
this
.
event
.
emit
(
'startingCompilation'
)
// setTimeout fix the animation on chrome... (animation triggered by 'staringCompilation')
setTimeout
(()
=>
{
this
.
compiler
.
compile
(
sources
,
target
);
resolve
()
},
100
)
})
})
}
async
isHardhatProject
()
{
if
(
this
.
fileManager
.
mode
===
'localhost'
)
{
return
await
this
.
fileManager
.
exists
(
'hardhat.config.js'
)
}
else
return
false
}
runCompiler
(
hhCompilation
)
{
try
{
if
(
this
.
fileManager
.
mode
===
'localhost'
&&
hhCompilation
)
{
const
{
currentVersion
,
optimize
,
runs
}
=
this
.
compiler
.
state
if
(
currentVersion
)
{
const
fileContent
=
`module.exports = {
solidity: '
${
currentVersion
.
substring
(
0
,
currentVersion
.
indexOf
(
'+commit'
))}
',
settings: {
optimizer: {
enabled:
${
optimize
}
,
runs:
${
runs
}
}
}
}
`
const
configFilePath
=
'remix-compiler.config.js'
this
.
fileManager
.
setFileContent
(
configFilePath
,
fileContent
)
this
.
call
(
'hardhat'
,
'compile'
,
configFilePath
).
then
((
result
)
=>
{
this
.
call
(
'terminal'
,
'log'
,
{
type
:
'info'
,
value
:
result
})
}).
catch
((
error
)
=>
{
this
.
call
(
'terminal'
,
'log'
,
{
type
:
'error'
,
value
:
error
})
})
}
}
this
.
fileManager
.
saveCurrentFile
()
this
.
event
.
emit
(
'removeAnnotations'
)
var
currentFile
=
this
.
config
.
get
(
'currentFile'
)
return
this
.
compileFile
(
currentFile
)
}
catch
(
err
)
{
console
.
error
(
err
)
}
}
}
module
.
exports
=
CompileTab
apps/remix-ide/src/app/tabs/compileTab/compilerContainer.js
deleted
100644 → 0
View file @
3bc9d9e1
This diff is collapsed.
Click to expand it.
apps/remix-ide/src/app/tabs/compileTab/contractParser.js
deleted
100644 → 0
View file @
3bc9d9e1
'use strict'
var
solcTranslate
=
require
(
'solc/translate'
)
var
remixLib
=
require
(
'@remix-project/remix-lib'
)
var
txHelper
=
remixLib
.
execution
.
txHelper
module
.
exports
=
(
contractName
,
contract
,
compiledSource
)
=>
{
return
getDetails
(
contractName
,
contract
,
compiledSource
)
}
var
getDetails
=
function
(
contractName
,
contract
,
source
)
{
var
detail
=
{}
detail
.
name
=
contractName
detail
.
metadata
=
contract
.
metadata
if
(
contract
.
evm
.
bytecode
.
object
)
{
detail
.
bytecode
=
contract
.
evm
.
bytecode
.
object
}
detail
.
abi
=
contract
.
abi
if
(
contract
.
evm
.
bytecode
.
object
)
{
detail
.
bytecode
=
contract
.
evm
.
bytecode
detail
.
web3Deploy
=
gethDeploy
(
contractName
.
toLowerCase
(),
contract
.
abi
,
contract
.
evm
.
bytecode
.
object
)
detail
.
metadataHash
=
retrieveMetadataHash
(
contract
.
evm
.
bytecode
.
object
)
if
(
detail
.
metadataHash
)
{
detail
.
swarmLocation
=
'bzzr://'
+
detail
.
metadataHash
}
}
detail
.
functionHashes
=
{}
for
(
var
fun
in
contract
.
evm
.
methodIdentifiers
)
{
detail
.
functionHashes
[
contract
.
evm
.
methodIdentifiers
[
fun
]]
=
fun
}
detail
.
gasEstimates
=
formatGasEstimates
(
contract
.
evm
.
gasEstimates
)
detail
.
devdoc
=
contract
.
devdoc
detail
.
userdoc
=
contract
.
userdoc
if
(
contract
.
evm
.
deployedBytecode
&&
contract
.
evm
.
deployedBytecode
.
object
.
length
>
0
)
{
detail
[
'Runtime Bytecode'
]
=
contract
.
evm
.
deployedBytecode
}
if
(
source
&&
contract
.
assembly
!==
null
)
{
detail
.
Assembly
=
solcTranslate
.
prettyPrintLegacyAssemblyJSON
(
contract
.
evm
.
legacyAssembly
,
source
.
content
)
}
return
detail
}
var
retrieveMetadataHash
=
function
(
bytecode
)
{
var
match
=
/a165627a7a72305820
([
0-9a-f
]{64})
0029$/
.
exec
(
bytecode
)
if
(
!
match
)
{
match
=
/a265627a7a72305820
([
0-9a-f
]{64})
6c6578706572696d656e74616cf50037$/
.
exec
(
bytecode
)
}
if
(
match
)
{
return
match
[
1
]
}
}
var
gethDeploy
=
function
(
contractName
,
jsonInterface
,
bytecode
)
{
var
code
=
''
var
funABI
=
txHelper
.
getConstructorInterface
(
jsonInterface
)
funABI
.
inputs
.
forEach
(
function
(
inp
)
{
code
+=
'var '
+
inp
.
name
+
' = /* var of type '
+
inp
.
type
+
' here */ ;
\
n'
})
contractName
=
contractName
.
replace
(
/
[
:.
/]
/g
,
'_'
)
code
+=
'var '
+
contractName
+
'Contract = new web3.eth.Contract('
+
JSON
.
stringify
(
jsonInterface
).
replace
(
'
\
n'
,
''
)
+
');'
+
'
\
nvar '
+
contractName
+
' = '
+
contractName
+
'Contract.deploy({'
+
"
\
n data: '0x"
+
bytecode
+
"', "
+
'
\
n arguments: ['
funABI
.
inputs
.
forEach
(
function
(
inp
)
{
code
+=
'
\
n '
+
inp
.
name
+
','
})
code
+=
'
\
n ]'
+
'
\
n}).send({'
+
'
\
n from: web3.eth.accounts[0], '
+
"
\
n gas: '4700000'"
+
'
\
n }, function (e, contract){'
+
'
\
n console.log(e, contract);'
+
"
\
n if (typeof contract.address !== 'undefined') {"
+
"
\
n console.log('Contract mined! address: ' + contract.address + ' transactionHash: ' + contract.transactionHash);"
+
'
\
n }'
+
'
\
n })'
return
code
}
var
formatGasEstimates
=
function
(
data
)
{
if
(
!
data
)
return
{}
if
(
data
.
creation
===
undefined
&&
data
.
external
===
undefined
&&
data
.
internal
===
undefined
)
return
{}
var
gasToText
=
function
(
g
)
{
return
g
===
null
?
'unknown'
:
g
}
var
ret
=
{}
var
fun
if
(
'creation'
in
data
)
{
ret
.
Creation
=
data
.
creation
}
if
(
'external'
in
data
)
{
ret
.
External
=
{}
for
(
fun
in
data
.
external
)
{
ret
.
External
[
fun
]
=
gasToText
(
data
.
external
[
fun
])
}
}
if
(
'internal'
in
data
)
{
ret
.
Internal
=
{}
for
(
fun
in
data
.
internal
)
{
ret
.
Internal
[
fun
]
=
gasToText
(
data
.
internal
[
fun
])
}
}
return
ret
}
libs/remix-ui/solidity-compiler/src/lib/logic/compiler-abstract.ts
deleted
100644 → 0
View file @
3bc9d9e1
'use strict'
import
*
as
remixLib
from
'@remix-project/remix-lib'
const
txHelper
=
remixLib
.
execution
.
txHelper
export
class
CompilerAbstract
{
public
languageversion
:
string
public
data
:
Record
<
string
,
any
>
public
source
:
Record
<
string
,
any
>
constructor
(
languageversion
,
data
,
source
)
{
this
.
languageversion
=
languageversion
this
.
data
=
data
this
.
source
=
source
// source code
}
getContracts
()
{
return
this
.
data
.
contracts
}
getContract
(
name
)
{
return
txHelper
.
getContract
(
name
,
this
.
data
.
contracts
)
}
visitContracts
(
calllback
)
{
return
txHelper
.
visitContracts
(
this
.
data
.
contracts
,
calllback
)
}
getData
()
{
return
this
.
data
}
getAsts
()
{
return
this
.
data
.
sources
// ast
}
getSourceName
(
fileIndex
)
{
if
(
this
.
data
&&
this
.
data
.
sources
)
{
return
Object
.
keys
(
this
.
data
.
sources
)[
fileIndex
]
}
else
if
(
Object
.
keys
(
this
.
source
.
sources
).
length
===
1
)
{
// if we don't have ast, we return the only one filename present.
const
sourcesArray
=
Object
.
keys
(
this
.
source
.
sources
)
return
sourcesArray
[
0
]
}
return
null
}
getSourceCode
()
{
return
this
.
source
}
}
libs/remix-ui/solidity-compiler/src/lib/logic/compiler-helpers.ts
deleted
100644 → 0
View file @
3bc9d9e1
'use strict'
import
{
canUseWorker
,
urlFromVersion
}
from
'./compiler-utils'
import
{
Compiler
}
from
'@remix-project/remix-solidity'
import
{
CompilerAbstract
}
from
'./compiler-abstract'
export
const
compile
=
async
(
compilationTargets
,
settings
,
contentResolverCallback
)
=>
{
return
new
Promise
((
resolve
)
=>
{
const
compiler
=
new
Compiler
(
contentResolverCallback
)
compiler
.
set
(
'evmVersion'
,
settings
.
evmVersion
)
compiler
.
set
(
'optimize'
,
settings
.
optimize
)
compiler
.
set
(
'language'
,
settings
.
language
)
compiler
.
set
(
'runs'
,
settings
.
runs
)
compiler
.
loadVersion
(
canUseWorker
(
settings
.
version
),
urlFromVersion
(
settings
.
version
))
compiler
.
event
.
register
(
'compilationFinished'
,
(
success
,
compilationData
,
source
)
=>
{
resolve
(
new
CompilerAbstract
(
settings
.
version
,
compilationData
,
source
))
})
compiler
.
event
.
register
(
'compilerLoaded'
,
()
=>
compiler
.
compile
(
compilationTargets
,
''
))
})
}
libs/remix-ui/solidity-compiler/src/lib/logic/compiler-utils.ts
deleted
100644 → 0
View file @
3bc9d9e1
const
semver
=
require
(
'semver'
)
const
minixhr
=
require
(
'minixhr'
)
/* global Worker */
export
const
baseURLBin
=
'https://binaries.soliditylang.org/bin'
export
const
baseURLWasm
=
'https://binaries.soliditylang.org/wasm'
export
const
pathToURL
=
{}
/**
* Retrieves the URL of the given compiler version
* @param version is the version of compiler with or without 'soljson-v' prefix and .js postfix
*/
export
function
urlFromVersion
(
version
)
{
if
(
!
version
.
startsWith
(
'soljson-v'
))
version
=
'soljson-v'
+
version
if
(
!
version
.
endsWith
(
'.js'
))
version
=
version
+
'.js'
return
`
${
pathToURL
[
version
]}
/
${
version
}
`
}
/**
* Checks if the worker can be used to load a compiler.
* checks a compiler whitelist, browser support and OS.
*/
export
function
canUseWorker
(
selectedVersion
)
{
const
version
=
semver
.
coerce
(
selectedVersion
)
const
isNightly
=
selectedVersion
.
includes
(
'nightly'
)
return
browserSupportWorker
()
&&
(
// All compiler versions (including nightlies) after 0.6.3 are wasm compiled
semver
.
gt
(
version
,
'0.6.3'
)
||
// Only releases are wasm compiled starting with 0.3.6
(
semver
.
gte
(
version
,
'0.3.6'
)
&&
!
isNightly
)
)
}
function
browserSupportWorker
()
{
return
document
.
location
.
protocol
!==
'file:'
&&
Worker
!==
undefined
}
// returns a promise for minixhr
export
function
promisedMiniXhr
(
url
)
{
return
new
Promise
((
resolve
)
=>
{
minixhr
(
url
,
(
json
,
event
)
=>
{
resolve
({
json
,
event
})
})
})
}
libs/remix-ui/solidity-compiler/src/lib/logic/index.ts
View file @
d6e7cabc
export
*
from
'./compileTabLogic'
export
*
from
'./compileTabLogic'
export
*
from
'./compiler-abstract'
export
*
from
'./compiler-helpers'
export
*
from
'./compiler-utils'
export
*
from
'./contract-parser'
export
*
from
'./contract-parser'
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment