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
375c604e
Commit
375c604e
authored
Sep 20, 2017
by
yann300
Committed by
GitHub
Sep 20, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #804 from ethereum/fixLib
Fix library
parents
08e13f1f
f6fdab08
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
15 deletions
+38
-15
eventsDecoder.js
src/app/execution/eventsDecoder.js
+21
-4
txFormat.js
src/app/execution/txFormat.js
+12
-10
txHelper.js
src/app/execution/txHelper.js
+1
-1
run-tab.js
src/app/tabs/run-tab.js
+2
-0
universal-dapp.js
src/universal-dapp.js
+2
-0
No files found.
src/app/execution/eventsDecoder.js
View file @
375c604e
...
@@ -35,8 +35,8 @@ class EventsDecoder {
...
@@ -35,8 +35,8 @@ class EventsDecoder {
this
.
_decodeEvents
(
tx
,
receipt
.
logs
,
contract
,
contracts
,
cb
)
this
.
_decodeEvents
(
tx
,
receipt
.
logs
,
contract
,
contracts
,
cb
)
}
}
_eventABI
(
contract
Name
,
compiledContracts
)
{
_eventABI
(
contract
abi
)
{
var
contractabi
=
JSON
.
parse
(
compiledContracts
[
contractName
]
.
interface
)
contractabi
=
JSON
.
parse
(
contractabi
.
interface
)
var
eventABI
=
{}
var
eventABI
=
{}
contractabi
.
forEach
(
function
(
funABI
,
i
)
{
contractabi
.
forEach
(
function
(
funABI
,
i
)
{
if
(
funABI
.
type
!==
'event'
)
{
if
(
funABI
.
type
!==
'event'
)
{
...
@@ -48,13 +48,30 @@ class EventsDecoder {
...
@@ -48,13 +48,30 @@ class EventsDecoder {
return
eventABI
return
eventABI
}
}
_eventsABI
(
compiledContracts
)
{
var
eventsABI
=
{}
for
(
var
contract
in
compiledContracts
)
{
eventsABI
[
contract
]
=
this
.
_eventABI
(
compiledContracts
[
contract
])
}
return
eventsABI
}
_event
(
hash
,
eventsABI
)
{
for
(
var
k
in
eventsABI
)
{
if
(
eventsABI
[
k
][
hash
])
{
return
eventsABI
[
k
][
hash
]
}
}
return
null
}
_decodeEvents
(
tx
,
logs
,
contractName
,
compiledContracts
,
cb
)
{
_decodeEvents
(
tx
,
logs
,
contractName
,
compiledContracts
,
cb
)
{
var
event
ABI
=
this
.
_eventABI
(
contractName
,
compiledContracts
)
var
event
sABI
=
this
.
_eventsABI
(
compiledContracts
)
var
events
=
[]
var
events
=
[]
for
(
var
i
in
logs
)
{
for
(
var
i
in
logs
)
{
// [address, topics, mem]
// [address, topics, mem]
var
log
=
logs
[
i
]
var
log
=
logs
[
i
]
var
abi
=
eventABI
[
log
.
topics
[
0
].
replace
(
'0x'
,
''
)]
var
abi
=
this
.
_event
(
log
.
topics
[
0
].
replace
(
'0x'
,
''
),
eventsABI
)
if
(
abi
)
{
if
(
abi
)
{
var
event
var
event
try
{
try
{
...
...
src/app/execution/txFormat.js
View file @
375c604e
...
@@ -18,8 +18,9 @@ module.exports = {
...
@@ -18,8 +18,9 @@ module.exports = {
* @param {Object} params - input paramater of the function to call
* @param {Object} params - input paramater of the function to call
* @param {Object} udapp - udapp
* @param {Object} udapp - udapp
* @param {Function} callback - callback
* @param {Function} callback - callback
* @param {Function} callbackStep - callbackStep
*/
*/
buildData
:
function
(
contract
,
contracts
,
isConstructor
,
funAbi
,
params
,
udapp
,
callback
)
{
buildData
:
function
(
contract
,
contracts
,
isConstructor
,
funAbi
,
params
,
udapp
,
callback
,
callbackStep
)
{
var
funArgs
=
''
var
funArgs
=
''
try
{
try
{
funArgs
=
$
.
parseJSON
(
'['
+
params
+
']'
)
funArgs
=
$
.
parseJSON
(
'['
+
params
+
']'
)
...
@@ -54,7 +55,7 @@ module.exports = {
...
@@ -54,7 +55,7 @@ module.exports = {
bytecodeToDeploy
=
bytecode
+
dataHex
bytecodeToDeploy
=
bytecode
+
dataHex
return
callback
(
null
,
bytecodeToDeploy
)
return
callback
(
null
,
bytecodeToDeploy
)
}
}
})
}
,
callbackStep
)
return
return
}
else
{
}
else
{
dataHex
=
bytecodeToDeploy
+
dataHex
dataHex
=
bytecodeToDeploy
+
dataHex
...
@@ -67,7 +68,7 @@ module.exports = {
...
@@ -67,7 +68,7 @@ module.exports = {
atAddress
:
function
()
{},
atAddress
:
function
()
{},
linkBytecode
:
function
(
contract
,
contracts
,
udapp
,
callback
)
{
linkBytecode
:
function
(
contract
,
contracts
,
udapp
,
callback
,
callbackStep
)
{
var
bytecode
=
contract
.
bytecode
var
bytecode
=
contract
.
bytecode
if
(
bytecode
.
indexOf
(
'_'
)
<
0
)
{
if
(
bytecode
.
indexOf
(
'_'
)
<
0
)
{
return
callback
(
null
,
bytecode
)
return
callback
(
null
,
bytecode
)
...
@@ -81,7 +82,7 @@ module.exports = {
...
@@ -81,7 +82,7 @@ module.exports = {
if
(
!
libraryabi
)
{
if
(
!
libraryabi
)
{
return
callback
(
'Library '
+
libraryName
+
' not found.'
)
return
callback
(
'Library '
+
libraryName
+
' not found.'
)
}
}
this
.
deployLibrary
(
libraryabi
,
udapp
,
(
err
,
address
)
=>
{
this
.
deployLibrary
(
library
Name
,
library
abi
,
udapp
,
(
err
,
address
)
=>
{
if
(
err
)
{
if
(
err
)
{
return
callback
(
err
)
return
callback
(
err
)
}
}
...
@@ -95,22 +96,23 @@ module.exports = {
...
@@ -95,22 +96,23 @@ module.exports = {
bytecode
=
bytecode
.
replace
(
libLabel
,
hexAddress
)
bytecode
=
bytecode
.
replace
(
libLabel
,
hexAddress
)
}
}
contract
.
bytecode
=
bytecode
contract
.
bytecode
=
bytecode
this
.
linkBytecode
(
contract
,
contracts
,
udapp
,
callback
)
this
.
linkBytecode
(
contract
,
contracts
,
udapp
,
callback
,
callbackStep
)
})
}
,
callbackStep
)
},
},
deployLibrary
:
function
(
libraryName
,
library
,
udapp
,
callback
)
{
deployLibrary
:
function
(
libraryName
,
library
,
udapp
,
callback
,
callbackStep
)
{
var
address
=
library
.
address
var
address
=
library
.
address
if
(
address
)
{
if
(
address
)
{
return
callback
(
null
,
address
)
return
callback
(
null
,
address
)
}
}
var
bytecode
=
library
.
bytecode
var
bytecode
=
library
.
bytecode
if
(
bytecode
.
indexOf
(
'_'
)
>=
0
)
{
if
(
bytecode
.
indexOf
(
'_'
)
>=
0
)
{
this
.
linkBytecode
(
libraryName
,
(
err
,
bytecode
)
=>
{
this
.
linkBytecode
(
libraryName
,
library
,
udapp
,
(
err
,
bytecode
)
=>
{
if
(
err
)
callback
(
err
)
if
(
err
)
callback
(
err
)
else
this
.
deployLibrary
(
libraryName
,
callback
)
else
this
.
deployLibrary
(
libraryName
,
library
,
udapp
,
callback
,
callbackStep
)
})
}
,
callbackStep
)
}
else
{
}
else
{
callbackStep
(
`creation of library
${
libraryName
}
pending...`
)
udapp
.
runTx
({
data
:
bytecode
,
useCall
:
false
},
(
err
,
txResult
)
=>
{
udapp
.
runTx
({
data
:
bytecode
,
useCall
:
false
},
(
err
,
txResult
)
=>
{
if
(
err
)
{
if
(
err
)
{
return
callback
(
err
)
return
callback
(
err
)
...
...
src/app/execution/txHelper.js
View file @
375c604e
...
@@ -91,7 +91,7 @@ module.exports = {
...
@@ -91,7 +91,7 @@ module.exports = {
getContractByName
:
function
(
contractName
,
contracts
)
{
getContractByName
:
function
(
contractName
,
contracts
)
{
for
(
var
c
in
contracts
)
{
for
(
var
c
in
contracts
)
{
if
(
c
ontracts
[
c
].
name
===
contractName
)
{
if
(
c
===
contractName
)
{
return
contracts
[
c
]
return
contracts
[
c
]
}
}
}
}
...
...
src/app/tabs/run-tab.js
View file @
375c604e
...
@@ -323,6 +323,8 @@ function contractDropdown (appAPI, appEvents, instanceContainer) {
...
@@ -323,6 +323,8 @@ function contractDropdown (appAPI, appEvents, instanceContainer) {
}
else
{
}
else
{
appAPI
.
logMessage
(
`creation of
${
contractName
}
errored: `
+
error
)
appAPI
.
logMessage
(
`creation of
${
contractName
}
errored: `
+
error
)
}
}
},
(
msg
)
=>
{
appAPI
.
logMessage
(
msg
)
})
})
}
}
...
...
src/universal-dapp.js
View file @
375c604e
...
@@ -417,6 +417,8 @@ UniversalDApp.prototype.getCallButton = function (args) {
...
@@ -417,6 +417,8 @@ UniversalDApp.prototype.getCallButton = function (args) {
}
else
{
}
else
{
self
.
_api
.
logMessage
(
`
${
logMsg
}
errored:
${
error
}
`
)
self
.
_api
.
logMessage
(
`
${
logMsg
}
errored:
${
error
}
`
)
}
}
},
(
msg
)
=>
{
self
.
_api
.
logMessage
(
msg
)
})
})
}
}
...
...
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