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
1e7608cd
Commit
1e7608cd
authored
Jan 27, 2020
by
aniket-engg
Committed by
Aniket
Jan 28, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
suggested changes
parent
f5e12c63
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
9 deletions
+8
-9
deployer.ts
remix-tests/src/deployer.ts
+8
-9
No files found.
remix-tests/src/deployer.ts
View file @
1e7608cd
import
async
from
'async'
const
remixLib
=
require
(
'remix-lib'
)
import
Web3
from
'web3'
;
import
{
compilationInterface
}
from
'types'
;
import
{
execution
}
from
'remix-lib'
import
Web3
from
'web3'
import
{
compilationInterface
}
from
'types'
/**
* @dev Deploy all contracts from compilation result
* @param compileResult compilation result
* @param web3 web3 object
* @param
isAgain
If true, try deployment with gas double of estimation (used for Out-of-gas error only)
* @param
withDoubleGas
If true, try deployment with gas double of estimation (used for Out-of-gas error only)
* @param callback Callback
*/
export
function
deployAll
(
compileResult
:
compilationInterface
,
web3
:
Web3
,
isAgain
:
boolean
,
callback
)
{
export
function
deployAll
(
compileResult
:
compilationInterface
,
web3
:
Web3
,
withDoubleGas
:
boolean
,
callback
)
{
let
compiledObject
=
{}
let
contracts
=
{}
let
accounts
:
string
[]
=
[]
...
...
@@ -65,9 +65,8 @@ export function deployAll(compileResult: compilationInterface, web3: Web3, isAga
function
deployContracts
(
contractsToDeploy
:
string
[],
next
:
Function
)
{
const
deployRunner
=
(
deployObject
,
contractObject
,
contractName
,
filename
,
callback
)
=>
{
deployObject
.
estimateGas
().
then
((
gasValue
)
=>
{
let
gas
=
Math
.
ceil
(
gasValue
*
1.2
)
if
(
isAgain
)
gas
=
gas
*
2
const
gasBase
=
Math
.
ceil
(
gasValue
*
1.2
)
const
gas
=
withDoubleGas
?
gasBase
*
2
:
gasBase
deployObject
.
send
({
from
:
accounts
[
0
],
gas
:
gas
...
...
@@ -113,7 +112,7 @@ export function deployAll(compileResult: compilationInterface, web3: Web3, isAga
let
funAbi
=
null
// no need to set the abi for encoding the constructor
let
params
=
''
// we suppose that the test contract does not have any param in the constructor
remixLib
.
execution
.
txFormat
.
encodeConstructorCallAndDeployLibraries
(
contractName
,
contract
.
raw
,
compileResult
,
params
,
funAbi
,
encodeDataFinalCallback
,
encodeDataStepCallback
,
encodeDataDeployLibraryCallback
)
execution
.
txFormat
.
encodeConstructorCallAndDeployLibraries
(
contractName
,
contract
.
raw
,
compileResult
,
params
,
funAbi
,
encodeDataFinalCallback
,
encodeDataStepCallback
,
encodeDataDeployLibraryCallback
)
},
function
(
err
)
{
if
(
err
)
next
(
err
)
next
(
null
,
contracts
)
...
...
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