Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
plugin
Commits
ec2b7e0d
Commit
ec2b7e0d
authored
Mar 11, 2019
by
linj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fmt & linter
parent
c47322b3
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
6 additions
and
10 deletions
+6
-10
tokenCase.go
plugin/dapp/token/autotest/tokenCase.go
+2
-6
token.go
plugin/dapp/token/commands/token.go
+0
-1
exec_local.go
plugin/dapp/token/executor/exec_local.go
+2
-2
tokendb.go
plugin/dapp/token/executor/tokendb.go
+0
-1
const.go
plugin/dapp/token/types/const.go
+2
-0
No files found.
plugin/dapp/token/autotest/tokenCase.go
View file @
ec2b7e0d
...
...
@@ -110,9 +110,7 @@ func (pack *TokenMintPack) checkBalance(txInfo map[string]interface{}) bool {
accCurrent
:=
parseInt64
(
logAccBurn
[
"current"
]
.
(
map
[
string
]
interface
{})[
"balance"
])
accPrev
:=
parseInt64
(
logAccBurn
[
"prev"
]
.
(
map
[
string
]
interface
{})[
"balance"
])
return
totalCurrent
-
amount
==
totalPrev
&&
accCurrent
-
amount
==
accPrev
return
totalCurrent
-
amount
==
totalPrev
&&
accCurrent
-
amount
==
accPrev
}
// TokenBurnCase token mint case
...
...
@@ -162,9 +160,7 @@ func (pack *TokenBurnPack) checkBalance(txInfo map[string]interface{}) bool {
accCurrent
:=
parseInt64
(
logAccBurn
[
"current"
]
.
(
map
[
string
]
interface
{})[
"balance"
])
accPrev
:=
parseInt64
(
logAccBurn
[
"prev"
]
.
(
map
[
string
]
interface
{})[
"balance"
])
return
totalCurrent
+
amount
==
totalPrev
&&
accCurrent
+
amount
==
accPrev
return
totalCurrent
+
amount
==
totalPrev
&&
accCurrent
+
amount
==
accPrev
}
func
parseInt64
(
s
interface
{})
int64
{
...
...
plugin/dapp/token/commands/token.go
View file @
ec2b7e0d
...
...
@@ -539,7 +539,6 @@ func tokenBurn(cmd *cobra.Command, args []string) {
ctx
.
RunWithoutMarshal
()
}
// GetTokenLogsCmd get logs of token
func
GetTokenLogsCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
...
...
plugin/dapp/token/executor/exec_local.go
View file @
ec2b7e0d
...
...
@@ -244,7 +244,7 @@ func (t *token) ExecLocal_TokenMint(payload *tokenty.TokenMint, tx *types.Transa
table
:=
NewLogsTable
(
t
.
GetLocalDB
())
txIndex
:=
dapp
.
HeightIndexStr
(
t
.
GetHeight
(),
int64
(
index
))
err
=
table
.
Add
(
&
tokenty
.
LocalLogs
{
Symbol
:
payload
.
Symbol
,
TxIndex
:
txIndex
,
ActionType
:
tokenty
.
TokenActionMint
,
TxHash
:
"0x"
+
hex
.
EncodeToString
(
tx
.
Hash
())})
err
=
table
.
Add
(
&
tokenty
.
LocalLogs
{
Symbol
:
payload
.
Symbol
,
TxIndex
:
txIndex
,
ActionType
:
tokenty
.
TokenActionMint
,
TxHash
:
"0x"
+
hex
.
EncodeToString
(
tx
.
Hash
())})
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -269,7 +269,7 @@ func (t *token) ExecLocal_TokenBurn(payload *tokenty.TokenBurn, tx *types.Transa
table
:=
NewLogsTable
(
t
.
GetLocalDB
())
txIndex
:=
dapp
.
HeightIndexStr
(
t
.
GetHeight
(),
int64
(
index
))
err
=
table
.
Add
(
&
tokenty
.
LocalLogs
{
Symbol
:
payload
.
Symbol
,
TxIndex
:
txIndex
,
ActionType
:
tokenty
.
TokenActionBurn
,
TxHash
:
"0x"
+
hex
.
EncodeToString
(
tx
.
Hash
())})
err
=
table
.
Add
(
&
tokenty
.
LocalLogs
{
Symbol
:
payload
.
Symbol
,
TxIndex
:
txIndex
,
ActionType
:
tokenty
.
TokenActionBurn
,
TxHash
:
"0x"
+
hex
.
EncodeToString
(
tx
.
Hash
())})
if
err
!=
nil
{
return
nil
,
err
}
...
...
plugin/dapp/token/executor/tokendb.go
View file @
ec2b7e0d
...
...
@@ -101,7 +101,6 @@ func (t *tokenDB) burn(db dbm.KV, amount int64) ([]*types.KeyValue, []*types.Rec
return
kvs
,
logs
,
nil
}
func
getTokenFromDB
(
db
dbm
.
KV
,
symbol
string
,
owner
string
)
(
*
pty
.
Token
,
error
)
{
key
:=
calcTokenAddrKeyS
(
symbol
,
owner
)
value
,
err
:=
db
.
Get
(
key
)
...
...
plugin/dapp/token/types/const.go
View file @
ec2b7e0d
...
...
@@ -21,6 +21,7 @@ const (
TokenActionTransferToExec
=
11
// TokenActionMint for token mint
TokenActionMint
=
12
// TokenActionBurn for token burn
TokenActionBurn
=
13
)
...
...
@@ -77,6 +78,7 @@ const (
TyLogTokenGenesisDeposit
=
322
// TyLogTokenMint log for token mint
TyLogTokenMint
=
323
// TyLogTokenBurn log for token burn
TyLogTokenBurn
=
324
)
...
...
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