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
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
7 additions
and
12 deletions
+7
-12
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
+1
-3
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 {
...
@@ -110,9 +110,7 @@ func (pack *TokenMintPack) checkBalance(txInfo map[string]interface{}) bool {
accCurrent
:=
parseInt64
(
logAccBurn
[
"current"
]
.
(
map
[
string
]
interface
{})[
"balance"
])
accCurrent
:=
parseInt64
(
logAccBurn
[
"current"
]
.
(
map
[
string
]
interface
{})[
"balance"
])
accPrev
:=
parseInt64
(
logAccBurn
[
"prev"
]
.
(
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
// TokenBurnCase token mint case
...
@@ -162,9 +160,7 @@ func (pack *TokenBurnPack) checkBalance(txInfo map[string]interface{}) bool {
...
@@ -162,9 +160,7 @@ func (pack *TokenBurnPack) checkBalance(txInfo map[string]interface{}) bool {
accCurrent
:=
parseInt64
(
logAccBurn
[
"current"
]
.
(
map
[
string
]
interface
{})[
"balance"
])
accCurrent
:=
parseInt64
(
logAccBurn
[
"current"
]
.
(
map
[
string
]
interface
{})[
"balance"
])
accPrev
:=
parseInt64
(
logAccBurn
[
"prev"
]
.
(
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
{
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) {
...
@@ -539,7 +539,6 @@ func tokenBurn(cmd *cobra.Command, args []string) {
ctx
.
RunWithoutMarshal
()
ctx
.
RunWithoutMarshal
()
}
}
// GetTokenLogsCmd get logs of token
// GetTokenLogsCmd get logs of token
func
GetTokenLogsCmd
()
*
cobra
.
Command
{
func
GetTokenLogsCmd
()
*
cobra
.
Command
{
cmd
:=
&
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
...
@@ -244,7 +244,7 @@ func (t *token) ExecLocal_TokenMint(payload *tokenty.TokenMint, tx *types.Transa
table
:=
NewLogsTable
(
t
.
GetLocalDB
())
table
:=
NewLogsTable
(
t
.
GetLocalDB
())
txIndex
:=
dapp
.
HeightIndexStr
(
t
.
GetHeight
(),
int64
(
index
))
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
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
@@ -269,7 +269,7 @@ func (t *token) ExecLocal_TokenBurn(payload *tokenty.TokenBurn, tx *types.Transa
...
@@ -269,7 +269,7 @@ func (t *token) ExecLocal_TokenBurn(payload *tokenty.TokenBurn, tx *types.Transa
table
:=
NewLogsTable
(
t
.
GetLocalDB
())
table
:=
NewLogsTable
(
t
.
GetLocalDB
())
txIndex
:=
dapp
.
HeightIndexStr
(
t
.
GetHeight
(),
int64
(
index
))
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
{
if
err
!=
nil
{
return
nil
,
err
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
...
@@ -101,7 +101,6 @@ func (t *tokenDB) burn(db dbm.KV, amount int64) ([]*types.KeyValue, []*types.Rec
return
kvs
,
logs
,
nil
return
kvs
,
logs
,
nil
}
}
func
getTokenFromDB
(
db
dbm
.
KV
,
symbol
string
,
owner
string
)
(
*
pty
.
Token
,
error
)
{
func
getTokenFromDB
(
db
dbm
.
KV
,
symbol
string
,
owner
string
)
(
*
pty
.
Token
,
error
)
{
key
:=
calcTokenAddrKeyS
(
symbol
,
owner
)
key
:=
calcTokenAddrKeyS
(
symbol
,
owner
)
value
,
err
:=
db
.
Get
(
key
)
value
,
err
:=
db
.
Get
(
key
)
...
@@ -594,4 +593,4 @@ func (action *tokenAction) burn(burn *pty.TokenBurn) (*types.Receipt, error) {
...
@@ -594,4 +593,4 @@ func (action *tokenAction) burn(burn *pty.TokenBurn) (*types.Receipt, error) {
kvs
=
append
(
kvs
,
receipt
.
KV
...
)
kvs
=
append
(
kvs
,
receipt
.
KV
...
)
return
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
,
KV
:
kvs
,
Logs
:
logs
},
nil
return
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
,
KV
:
kvs
,
Logs
:
logs
},
nil
}
}
\ No newline at end of file
plugin/dapp/token/types/const.go
View file @
ec2b7e0d
...
@@ -21,6 +21,7 @@ const (
...
@@ -21,6 +21,7 @@ const (
TokenActionTransferToExec
=
11
TokenActionTransferToExec
=
11
// TokenActionMint for token mint
// TokenActionMint for token mint
TokenActionMint
=
12
TokenActionMint
=
12
// TokenActionBurn for token burn
TokenActionBurn
=
13
TokenActionBurn
=
13
)
)
...
@@ -77,6 +78,7 @@ const (
...
@@ -77,6 +78,7 @@ const (
TyLogTokenGenesisDeposit
=
322
TyLogTokenGenesisDeposit
=
322
// TyLogTokenMint log for token mint
// TyLogTokenMint log for token mint
TyLogTokenMint
=
323
TyLogTokenMint
=
323
// TyLogTokenBurn log for token burn
TyLogTokenBurn
=
324
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