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
65ba0be8
Unverified
Commit
65ba0be8
authored
Mar 13, 2019
by
vipwzw
Committed by
GitHub
Mar 13, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #343 from linj-disanbo/token-mintage
Token mintage
parents
1d82de89
4f20a53d
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
1444 additions
and
77 deletions
+1444
-77
token.go
plugin/dapp/token/autotest/token.go
+2
-0
token.toml
plugin/dapp/token/autotest/token.toml
+14
-1
tokenCase.go
plugin/dapp/token/autotest/tokenCase.go
+108
-0
token.go
plugin/dapp/token/commands/token.go
+118
-0
exec.go
plugin/dapp/token/executor/exec.go
+10
-0
exec_del_local.go
plugin/dapp/token/executor/exec_del_local.go
+64
-0
exec_local.go
plugin/dapp/token/executor/exec_local.go
+86
-0
logs.go
plugin/dapp/token/executor/logs.go
+100
-0
query.go
plugin/dapp/token/executor/query.go
+22
-0
token_new_test.go
plugin/dapp/token/executor/token_new_test.go
+73
-0
token_test.go
plugin/dapp/token/executor/token_test.go
+243
-0
tokendb.go
plugin/dapp/token/executor/tokendb.go
+130
-1
transwithdraw.go
plugin/dapp/token/executor/transwithdraw.go
+4
-1
token.proto
plugin/dapp/token/proto/token.proto
+28
-0
rpc.go
plugin/dapp/token/rpc/rpc.go
+26
-0
const.go
plugin/dapp/token/types/const.go
+13
-0
token.pb.go
plugin/dapp/token/types/token.pb.go
+398
-74
types.go
plugin/dapp/token/types/types.go
+4
-0
account_test.go
vendor/github.com/33cn/chain33/account/account_test.go
+1
-0
account.proto
vendor/github.com/33cn/chain33/types/proto/account.proto
+0
-0
No files found.
plugin/dapp/token/autotest/token.go
View file @
65ba0be8
...
...
@@ -18,6 +18,8 @@ type tokenAutoTest struct {
TransferCaseArr
[]
autotest
.
TransferCase
`toml:"TransferCase,omitempty"`
WithdrawCaseArr
[]
autotest
.
WithdrawCase
`toml:"WithdrawCase,omitempty"`
TokenRevokeCaseArr
[]
TokenRevokeCase
`toml:"TokenRevokeCase,omitempty"`
TokenMintCaseArr
[]
TokenMintCase
`toml:"TokenMintCase,omitempty"`
TokenBurnCaseArr
[]
TokenBurnCase
`toml:"TokenBurnCase,omitempty"`
}
func
init
()
{
...
...
plugin/dapp/token/autotest/token.toml
View file @
65ba0be8
...
...
@@ -7,7 +7,7 @@ command = "account import_key -k 0xc21d38be90493512a5c2417d565269a8b23ce8152010e
[[TokenPreCreateCase]]
id
=
"tokenPre"
command
=
"send token precreate -f 0.01 -i testToken -n testToken -s TC -a 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv -t 100000 -p 1 -k 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv"
command
=
"send token precreate -
c 1 -
f 0.01 -i testToken -n testToken -s TC -a 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv -t 100000 -p 1 -k 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv"
dep
=
[
"transForPrecreate"
,
"import1"
]
[[TokenPreCreateCase]]
...
...
@@ -21,6 +21,19 @@ id = "tokenFinish"
command
=
"send token finish -a 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv -f 0.01 -s TC -k 0xc34b5d9d44ac7b754806f761d3d4d2c4fe5214f6b074c19f069c4f5c2a29c8cc"
dep
=
["tokenPre"]
[[TokenMintCase]]
id
=
"tokenMint"
command
=
"send token mint -a 100 -s TC -k 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv"
dep
=
["tokenFinish"]
amount
=
"100"
checkItem
=
["balance"]
[[TokenBurnCase]]
id
=
"tokenBurn"
command
=
"send token burn -a 50 -s TC -k 12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv"
dep
=
["tokenMint"]
amount
=
"50"
checkItem
=
["balance"]
#send to token for precreate
[[TransferCase]]
...
...
plugin/dapp/token/autotest/tokenCase.go
View file @
65ba0be8
...
...
@@ -6,6 +6,8 @@ package autotest
import
(
"github.com/33cn/chain33/cmd/autotest/types"
"strconv"
)
// TokenPreCreateCase token precreatecase command
...
...
@@ -59,3 +61,109 @@ func (testCase *TokenFinishCreateCase) SendCommand(packID string) (types.PackFun
return
types
.
DefaultSend
(
testCase
,
&
TokenFinishCreatePack
{},
packID
)
}
// TokenMintCase token mint case
type
TokenMintCase
struct
{
types
.
BaseCase
Amount
string
`toml:"amount"`
}
// TokenMintPack token mint pack command
type
TokenMintPack
struct
{
types
.
BaseCasePack
}
// SendCommand send command function of tokenfinishcreatecase
func
(
testCase
*
TokenMintCase
)
SendCommand
(
packID
string
)
(
types
.
PackFunc
,
error
)
{
return
types
.
DefaultSend
(
testCase
,
&
TokenMintPack
{},
packID
)
}
// GetCheckHandlerMap get check handle for map
func
(
pack
*
TokenMintPack
)
GetCheckHandlerMap
()
interface
{}
{
funcMap
:=
make
(
types
.
CheckHandlerMapDiscard
,
2
)
funcMap
[
"balance"
]
=
pack
.
checkBalance
return
funcMap
}
func
(
pack
*
TokenMintPack
)
checkBalance
(
txInfo
map
[
string
]
interface
{})
bool
{
logArr
:=
txInfo
[
"receipt"
]
.
(
map
[
string
]
interface
{})[
"logs"
]
.
([]
interface
{})
logTokenBurn
:=
logArr
[
1
]
.
(
map
[
string
]
interface
{})[
"log"
]
.
(
map
[
string
]
interface
{})
logAccBurn
:=
logArr
[
2
]
.
(
map
[
string
]
interface
{})[
"log"
]
.
(
map
[
string
]
interface
{})
interCase
:=
pack
.
TCase
.
(
*
TokenMintCase
)
amount1
,
_
:=
strconv
.
ParseInt
(
interCase
.
Amount
,
10
,
64
)
amount
:=
amount1
*
1e8
pack
.
FLog
.
Info
(
"MintDetails"
,
"TestID"
,
pack
.
PackID
,
"TokenPrev"
,
logTokenBurn
[
"prev"
]
.
(
map
[
string
]
interface
{})[
"total"
]
.
(
string
),
"TokenCurr"
,
logTokenBurn
[
"current"
]
.
(
map
[
string
]
interface
{})[
"total"
]
.
(
string
),
"AccPrev"
,
logAccBurn
[
"prev"
]
.
(
map
[
string
]
interface
{})[
"balance"
]
.
(
string
),
"AccCurr"
,
logAccBurn
[
"current"
]
.
(
map
[
string
]
interface
{})[
"balance"
]
.
(
string
),
"amount"
,
amount1
)
totalCurrent
:=
parseInt64
(
logTokenBurn
[
"current"
]
.
(
map
[
string
]
interface
{})[
"total"
])
totalPrev
:=
parseInt64
(
logTokenBurn
[
"prev"
]
.
(
map
[
string
]
interface
{})[
"total"
])
accCurrent
:=
parseInt64
(
logAccBurn
[
"current"
]
.
(
map
[
string
]
interface
{})[
"balance"
])
accPrev
:=
parseInt64
(
logAccBurn
[
"prev"
]
.
(
map
[
string
]
interface
{})[
"balance"
])
return
totalCurrent
-
amount
==
totalPrev
&&
accCurrent
-
amount
==
accPrev
}
// TokenBurnCase token mint case
type
TokenBurnCase
struct
{
types
.
BaseCase
Amount
string
`toml:"amount"`
}
// TokenBurnPack token mint pack command
type
TokenBurnPack
struct
{
types
.
BaseCasePack
}
// SendCommand send command function
func
(
testCase
*
TokenBurnCase
)
SendCommand
(
packID
string
)
(
types
.
PackFunc
,
error
)
{
return
types
.
DefaultSend
(
testCase
,
&
TokenBurnPack
{},
packID
)
}
// GetCheckHandlerMap get check handle for map
func
(
pack
*
TokenBurnPack
)
GetCheckHandlerMap
()
interface
{}
{
funcMap
:=
make
(
types
.
CheckHandlerMapDiscard
,
2
)
funcMap
[
"balance"
]
=
pack
.
checkBalance
return
funcMap
}
func
(
pack
*
TokenBurnPack
)
checkBalance
(
txInfo
map
[
string
]
interface
{})
bool
{
logArr
:=
txInfo
[
"receipt"
]
.
(
map
[
string
]
interface
{})[
"logs"
]
.
([]
interface
{})
logTokenBurn
:=
logArr
[
1
]
.
(
map
[
string
]
interface
{})[
"log"
]
.
(
map
[
string
]
interface
{})
logAccBurn
:=
logArr
[
2
]
.
(
map
[
string
]
interface
{})[
"log"
]
.
(
map
[
string
]
interface
{})
interCase
:=
pack
.
TCase
.
(
*
TokenBurnCase
)
amount1
,
_
:=
strconv
.
ParseInt
(
interCase
.
Amount
,
10
,
64
)
amount
:=
amount1
*
1e8
pack
.
FLog
.
Info
(
"BurnDetails"
,
"TestID"
,
pack
.
PackID
,
"TokenPrev"
,
logTokenBurn
[
"prev"
]
.
(
map
[
string
]
interface
{})[
"total"
]
.
(
string
),
"TokenCurr"
,
logTokenBurn
[
"current"
]
.
(
map
[
string
]
interface
{})[
"total"
]
.
(
string
),
"AccPrev"
,
logAccBurn
[
"prev"
]
.
(
map
[
string
]
interface
{})[
"balance"
]
.
(
string
),
"AccCurr"
,
logAccBurn
[
"current"
]
.
(
map
[
string
]
interface
{})[
"balance"
]
.
(
string
),
"amount"
,
amount1
)
totalCurrent
:=
parseInt64
(
logTokenBurn
[
"current"
]
.
(
map
[
string
]
interface
{})[
"total"
])
totalPrev
:=
parseInt64
(
logTokenBurn
[
"prev"
]
.
(
map
[
string
]
interface
{})[
"total"
])
accCurrent
:=
parseInt64
(
logAccBurn
[
"current"
]
.
(
map
[
string
]
interface
{})[
"balance"
])
accPrev
:=
parseInt64
(
logAccBurn
[
"prev"
]
.
(
map
[
string
]
interface
{})[
"balance"
])
return
totalCurrent
+
amount
==
totalPrev
&&
accCurrent
+
amount
==
accPrev
}
func
parseInt64
(
s
interface
{})
int64
{
i
,
_
:=
strconv
.
ParseInt
(
s
.
(
string
),
10
,
64
)
return
i
}
plugin/dapp/token/commands/token.go
View file @
65ba0be8
...
...
@@ -42,6 +42,9 @@ func TokenCmd() *cobra.Command {
CreateRawTokenFinishTxCmd
(),
CreateRawTokenRevokeTxCmd
(),
CreateTokenTransferExecCmd
(),
CreateRawTokenMintTxCmd
(),
CreateRawTokenBurnTxCmd
(),
GetTokenLogsCmd
(),
)
return
cmd
...
...
@@ -465,3 +468,118 @@ func tokenRevoke(cmd *cobra.Command, args []string) {
ctx
:=
jsonclient
.
NewRPCCtx
(
rpcLaddr
,
"token.CreateRawTokenRevokeTx"
,
params
,
nil
)
ctx
.
RunWithoutMarshal
()
}
// CreateRawTokenMintTxCmd create raw token mintage transaction
func
CreateRawTokenMintTxCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"mint"
,
Short
:
"Create a mint token transaction"
,
Run
:
tokenMint
,
}
addTokenMintFlags
(
cmd
)
return
cmd
}
func
addTokenMintFlags
(
cmd
*
cobra
.
Command
)
{
cmd
.
Flags
()
.
StringP
(
"symbol"
,
"s"
,
""
,
"token symbol"
)
cmd
.
MarkFlagRequired
(
"symbol"
)
cmd
.
Flags
()
.
Float64P
(
"amount"
,
"a"
,
0
,
"amount of mintage"
)
cmd
.
MarkFlagRequired
(
"amount"
)
cmd
.
Flags
()
.
Float64P
(
"fee"
,
"f"
,
0
,
"token transaction fee"
)
}
func
tokenMint
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
symbol
,
_
:=
cmd
.
Flags
()
.
GetString
(
"symbol"
)
amount
,
_
:=
cmd
.
Flags
()
.
GetFloat64
(
"amount"
)
params
:=
&
tokenty
.
TokenMint
{
Symbol
:
symbol
,
Amount
:
int64
((
amount
+
0.000001
)
*
1e4
)
*
1e4
,
}
ctx
:=
jsonclient
.
NewRPCCtx
(
rpcLaddr
,
"token.CreateRawTokenMintTx"
,
params
,
nil
)
ctx
.
RunWithoutMarshal
()
}
// CreateRawTokenBurnTxCmd create raw token burn transaction
func
CreateRawTokenBurnTxCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"burn"
,
Short
:
"Create a burn token transaction"
,
Run
:
tokenBurn
,
}
addTokenBurnFlags
(
cmd
)
return
cmd
}
func
addTokenBurnFlags
(
cmd
*
cobra
.
Command
)
{
cmd
.
Flags
()
.
StringP
(
"symbol"
,
"s"
,
""
,
"token symbol"
)
cmd
.
MarkFlagRequired
(
"symbol"
)
cmd
.
Flags
()
.
Float64P
(
"amount"
,
"a"
,
0
,
"amount of burn"
)
cmd
.
MarkFlagRequired
(
"amount"
)
cmd
.
Flags
()
.
Float64P
(
"fee"
,
"f"
,
0
,
"token transaction fee"
)
}
func
tokenBurn
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
symbol
,
_
:=
cmd
.
Flags
()
.
GetString
(
"symbol"
)
amount
,
_
:=
cmd
.
Flags
()
.
GetFloat64
(
"amount"
)
params
:=
&
tokenty
.
TokenBurn
{
Symbol
:
symbol
,
Amount
:
int64
((
amount
+
0.000001
)
*
1e4
)
*
1e4
,
}
ctx
:=
jsonclient
.
NewRPCCtx
(
rpcLaddr
,
"token.CreateRawTokenBurnTx"
,
params
,
nil
)
ctx
.
RunWithoutMarshal
()
}
// GetTokenLogsCmd get logs of token
func
GetTokenLogsCmd
()
*
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"get_token_logs"
,
Short
:
"Get logs of token"
,
Run
:
getTokenLogs
,
}
getTokenLogsFlags
(
cmd
)
return
cmd
}
func
getTokenLogs
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
paraName
,
_
:=
cmd
.
Flags
()
.
GetString
(
"paraName"
)
symbol
,
_
:=
cmd
.
Flags
()
.
GetString
(
"symbol"
)
var
params
rpctypes
.
Query4Jrpc
params
.
Execer
=
getRealExecName
(
paraName
,
"token"
)
params
.
FuncName
=
"GetTokenHistory"
params
.
Payload
=
types
.
MustPBToJSON
(
&
types
.
ReqString
{
Data
:
symbol
})
rpc
,
err
:=
jsonclient
.
NewJSONClient
(
rpcLaddr
)
if
err
!=
nil
{
fmt
.
Fprintln
(
os
.
Stderr
,
err
)
return
}
var
res
tokenty
.
ReplyTokenLogs
err
=
rpc
.
Call
(
"Chain33.Query"
,
params
,
&
res
)
if
err
!=
nil
{
fmt
.
Fprintln
(
os
.
Stderr
,
err
)
return
}
data
,
err
:=
json
.
MarshalIndent
(
res
,
""
,
" "
)
if
err
!=
nil
{
fmt
.
Fprintln
(
os
.
Stderr
,
err
)
return
}
fmt
.
Println
(
string
(
data
))
}
func
getTokenLogsFlags
(
cmd
*
cobra
.
Command
)
{
cmd
.
Flags
()
.
StringP
(
"symbol"
,
"s"
,
""
,
"token symbol"
)
cmd
.
MarkFlagRequired
(
"symbol"
)
}
plugin/dapp/token/executor/exec.go
View file @
65ba0be8
...
...
@@ -69,3 +69,13 @@ func (t *token) Exec_TransferToExec(payload *types.AssetsTransferToExec, tx *typ
}
return
t
.
ExecTransWithdraw
(
db
,
tx
,
&
tokenAction
,
index
)
}
func
(
t
*
token
)
Exec_TokenMint
(
payload
*
tokenty
.
TokenMint
,
tx
*
types
.
Transaction
,
index
int
)
(
*
types
.
Receipt
,
error
)
{
action
:=
newTokenAction
(
t
,
""
,
tx
)
return
action
.
mint
(
payload
)
}
func
(
t
*
token
)
Exec_TokenBurn
(
payload
*
tokenty
.
TokenBurn
,
tx
*
types
.
Transaction
,
index
int
)
(
*
types
.
Receipt
,
error
)
{
action
:=
newTokenAction
(
t
,
""
,
tx
)
return
action
.
burn
(
payload
)
}
plugin/dapp/token/executor/exec_del_local.go
View file @
65ba0be8
...
...
@@ -5,6 +5,7 @@
package
executor
import
(
"github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types"
tokenty
"github.com/33cn/plugin/plugin/dapp/token/types"
)
...
...
@@ -107,6 +108,19 @@ func (t *token) ExecDelLocal_TokenFinishCreate(payload *tokenty.TokenFinishCreat
var
set
[]
*
types
.
KeyValue
set
=
append
(
set
,
&
types
.
KeyValue
{
Key
:
prepareKey
,
Value
:
types
.
Encode
(
localToken
)})
set
=
append
(
set
,
&
types
.
KeyValue
{
Key
:
key
,
Value
:
nil
})
table
:=
NewLogsTable
(
t
.
GetLocalDB
())
txIndex
:=
dapp
.
HeightIndexStr
(
t
.
GetHeight
(),
int64
(
index
))
err
=
table
.
Del
([]
byte
(
txIndex
))
if
err
!=
nil
{
return
nil
,
err
}
kv
,
err
:=
table
.
Save
()
if
err
!=
nil
{
return
nil
,
err
}
set
=
append
(
set
,
kv
...
)
return
&
types
.
LocalDBSet
{
KV
:
set
},
nil
}
...
...
@@ -123,3 +137,53 @@ func (t *token) ExecDelLocal_TokenRevokeCreate(payload *tokenty.TokenRevokeCreat
set
=
append
(
set
,
&
types
.
KeyValue
{
Key
:
prepareKey
,
Value
:
types
.
Encode
(
localToken
)})
return
&
types
.
LocalDBSet
{
KV
:
set
},
nil
}
func
(
t
*
token
)
ExecDelLocal_TokenMint
(
payload
*
tokenty
.
TokenMint
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
localToken
,
err
:=
loadLocalToken
(
payload
.
Symbol
,
tx
.
From
(),
tokenty
.
TokenStatusCreated
,
t
.
GetLocalDB
())
if
err
!=
nil
{
return
nil
,
err
}
localToken
=
resetMint
(
localToken
,
t
.
GetHeight
(),
t
.
GetBlockTime
(),
payload
.
Amount
)
key
:=
calcTokenStatusKeyLocal
(
payload
.
Symbol
,
tx
.
From
(),
tokenty
.
TokenStatusCreated
)
var
set
[]
*
types
.
KeyValue
set
=
append
(
set
,
&
types
.
KeyValue
{
Key
:
key
,
Value
:
types
.
Encode
(
localToken
)})
table
:=
NewLogsTable
(
t
.
GetLocalDB
())
txIndex
:=
dapp
.
HeightIndexStr
(
t
.
GetHeight
(),
int64
(
index
))
err
=
table
.
Del
([]
byte
(
txIndex
))
if
err
!=
nil
{
return
nil
,
err
}
kv
,
err
:=
table
.
Save
()
if
err
!=
nil
{
return
nil
,
err
}
set
=
append
(
set
,
kv
...
)
return
&
types
.
LocalDBSet
{
KV
:
set
},
nil
}
func
(
t
*
token
)
ExecDelLocal_TokenBurn
(
payload
*
tokenty
.
TokenBurn
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
localToken
,
err
:=
loadLocalToken
(
payload
.
Symbol
,
tx
.
From
(),
tokenty
.
TokenStatusCreated
,
t
.
GetLocalDB
())
if
err
!=
nil
{
return
nil
,
err
}
localToken
=
resetBurn
(
localToken
,
t
.
GetHeight
(),
t
.
GetBlockTime
(),
payload
.
Amount
)
key
:=
calcTokenStatusKeyLocal
(
payload
.
Symbol
,
tx
.
From
(),
tokenty
.
TokenStatusCreated
)
var
set
[]
*
types
.
KeyValue
set
=
append
(
set
,
&
types
.
KeyValue
{
Key
:
key
,
Value
:
types
.
Encode
(
localToken
)})
table
:=
NewLogsTable
(
t
.
GetLocalDB
())
txIndex
:=
dapp
.
HeightIndexStr
(
t
.
GetHeight
(),
int64
(
index
))
err
=
table
.
Del
([]
byte
(
txIndex
))
if
err
!=
nil
{
return
nil
,
err
}
kv
,
err
:=
table
.
Save
()
if
err
!=
nil
{
return
nil
,
err
}
set
=
append
(
set
,
kv
...
)
return
&
types
.
LocalDBSet
{
KV
:
set
},
nil
}
plugin/dapp/token/executor/exec_local.go
View file @
65ba0be8
...
...
@@ -5,7 +5,10 @@
package
executor
import
(
"encoding/hex"
"github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types"
tokenty
"github.com/33cn/plugin/plugin/dapp/token/types"
)
...
...
@@ -107,6 +110,19 @@ func (t *token) ExecLocal_TokenFinishCreate(payload *tokenty.TokenFinishCreate,
set
=
append
(
set
,
&
types
.
KeyValue
{
Key
:
key
,
Value
:
types
.
Encode
(
localToken
)})
kv
:=
AddTokenToAssets
(
payload
.
Owner
,
t
.
GetLocalDB
(),
payload
.
Symbol
)
set
=
append
(
set
,
kv
...
)
table
:=
NewLogsTable
(
t
.
GetLocalDB
())
txIndex
:=
dapp
.
HeightIndexStr
(
t
.
GetHeight
(),
int64
(
index
))
err
=
table
.
Add
(
&
tokenty
.
LocalLogs
{
Symbol
:
payload
.
Symbol
,
TxIndex
:
txIndex
,
ActionType
:
tokenty
.
TokenActionFinishCreate
,
TxHash
:
hex
.
EncodeToString
(
tx
.
Hash
())})
if
err
!=
nil
{
return
nil
,
err
}
kv
,
err
=
table
.
Save
()
if
err
!=
nil
{
return
nil
,
err
}
set
=
append
(
set
,
kv
...
)
return
&
types
.
LocalDBSet
{
KV
:
set
},
nil
}
...
...
@@ -182,6 +198,16 @@ func setRevoked(t *tokenty.LocalToken, height, time int64) *tokenty.LocalToken {
return
t
}
func
setMint
(
t
*
tokenty
.
LocalToken
,
height
,
time
,
amount
int64
)
*
tokenty
.
LocalToken
{
t
.
Total
=
t
.
Total
+
amount
return
t
}
func
setBurn
(
t
*
tokenty
.
LocalToken
,
height
,
time
,
amount
int64
)
*
tokenty
.
LocalToken
{
t
.
Total
=
t
.
Total
-
amount
return
t
}
func
resetCreated
(
t
*
tokenty
.
LocalToken
)
*
tokenty
.
LocalToken
{
t
.
CreatedTime
=
0
t
.
CreatedHeight
=
0
...
...
@@ -195,3 +221,63 @@ func resetRevoked(t *tokenty.LocalToken) *tokenty.LocalToken {
t
.
Status
=
tokenty
.
TokenStatusPreCreated
return
t
}
func
resetMint
(
t
*
tokenty
.
LocalToken
,
height
,
time
,
amount
int64
)
*
tokenty
.
LocalToken
{
t
.
Total
=
t
.
Total
-
amount
return
t
}
func
resetBurn
(
t
*
tokenty
.
LocalToken
,
height
,
time
,
amount
int64
)
*
tokenty
.
LocalToken
{
t
.
Total
=
t
.
Total
+
amount
return
t
}
func
(
t
*
token
)
ExecLocal_TokenMint
(
payload
*
tokenty
.
TokenMint
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
localToken
,
err
:=
loadLocalToken
(
payload
.
Symbol
,
tx
.
From
(),
tokenty
.
TokenStatusCreated
,
t
.
GetLocalDB
())
if
err
!=
nil
{
return
nil
,
err
}
localToken
=
setMint
(
localToken
,
t
.
GetHeight
(),
t
.
GetBlockTime
(),
payload
.
Amount
)
var
set
[]
*
types
.
KeyValue
key
:=
calcTokenStatusKeyLocal
(
payload
.
Symbol
,
tx
.
From
(),
tokenty
.
TokenStatusCreated
)
set
=
append
(
set
,
&
types
.
KeyValue
{
Key
:
key
,
Value
:
types
.
Encode
(
localToken
)})
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
())})
if
err
!=
nil
{
return
nil
,
err
}
kv
,
err
:=
table
.
Save
()
if
err
!=
nil
{
return
nil
,
err
}
set
=
append
(
set
,
kv
...
)
return
&
types
.
LocalDBSet
{
KV
:
set
},
nil
}
func
(
t
*
token
)
ExecLocal_TokenBurn
(
payload
*
tokenty
.
TokenBurn
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
localToken
,
err
:=
loadLocalToken
(
payload
.
Symbol
,
tx
.
From
(),
tokenty
.
TokenStatusCreated
,
t
.
GetLocalDB
())
if
err
!=
nil
{
return
nil
,
err
}
localToken
=
setBurn
(
localToken
,
t
.
GetHeight
(),
t
.
GetBlockTime
(),
payload
.
Amount
)
var
set
[]
*
types
.
KeyValue
key
:=
calcTokenStatusKeyLocal
(
payload
.
Symbol
,
tx
.
From
(),
tokenty
.
TokenStatusCreated
)
set
=
append
(
set
,
&
types
.
KeyValue
{
Key
:
key
,
Value
:
types
.
Encode
(
localToken
)})
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
())})
if
err
!=
nil
{
return
nil
,
err
}
kv
,
err
:=
table
.
Save
()
if
err
!=
nil
{
return
nil
,
err
}
set
=
append
(
set
,
kv
...
)
return
&
types
.
LocalDBSet
{
KV
:
set
},
nil
}
plugin/dapp/token/executor/logs.go
0 → 100644
View file @
65ba0be8
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
executor
// 记录token 的更改记录,
// 包含创建完成, 铸币, 以后可能包含燃烧等
import
(
dbm
"github.com/33cn/chain33/common/db"
"github.com/33cn/chain33/common/db/table"
"github.com/33cn/chain33/types"
pty
"github.com/33cn/plugin/plugin/dapp/token/types"
)
var
opt_logs_table
=
&
table
.
Option
{
Prefix
:
"LODB-token"
,
Name
:
"logs"
,
Primary
:
"txIndex"
,
Index
:
[]
string
{
"symbol"
,
},
}
// LogsRow row
type
LogsRow
struct
{
*
pty
.
LocalLogs
}
// NewOrderRow create row
func
NewOrderRow
()
*
LogsRow
{
return
&
LogsRow
{
LocalLogs
:
nil
}
}
// CreateRow create row
func
(
r
*
LogsRow
)
CreateRow
()
*
table
.
Row
{
return
&
table
.
Row
{
Data
:
&
pty
.
LocalLogs
{}}
}
// SetPayload set payload
func
(
r
*
LogsRow
)
SetPayload
(
data
types
.
Message
)
error
{
if
d
,
ok
:=
data
.
(
*
pty
.
LocalLogs
);
ok
{
r
.
LocalLogs
=
d
return
nil
}
return
types
.
ErrTypeAsset
}
// Get get index key
func
(
r
*
LogsRow
)
Get
(
key
string
)
([]
byte
,
error
)
{
switch
key
{
case
"txIndex"
:
return
[]
byte
(
r
.
TxIndex
),
nil
case
"symbol"
:
return
[]
byte
(
r
.
Symbol
),
nil
default
:
return
nil
,
types
.
ErrNotFound
}
}
// NewLogsTable create table
func
NewLogsTable
(
kvdb
dbm
.
KV
)
*
table
.
Table
{
rowMeta
:=
NewOrderRow
()
err
:=
rowMeta
.
SetPayload
(
&
pty
.
LocalLogs
{})
if
err
!=
nil
{
panic
(
err
)
}
t
,
err
:=
table
.
NewTable
(
rowMeta
,
kvdb
,
opt_logs_table
)
if
err
!=
nil
{
panic
(
err
)
}
return
t
}
func
list
(
db
dbm
.
KVDB
,
indexName
string
,
data
*
pty
.
LocalLogs
,
count
,
direction
int32
)
([]
*
table
.
Row
,
error
)
{
query
:=
NewLogsTable
(
db
)
.
GetQuery
(
db
)
var
primary
[]
byte
if
len
(
data
.
TxIndex
)
>
0
{
primary
=
[]
byte
(
data
.
TxIndex
)
}
cur
:=
&
LogsRow
{
LocalLogs
:
data
}
index
,
err
:=
cur
.
Get
(
indexName
)
if
err
!=
nil
{
tokenlog
.
Error
(
"query List failed"
,
"key"
,
string
(
primary
),
"param"
,
data
,
"err"
,
err
)
return
nil
,
err
}
tokenlog
.
Debug
(
"query List dbg"
,
"indexName"
,
indexName
,
"index"
,
string
(
index
),
"primary"
,
primary
,
"count"
,
count
,
"direction"
,
direction
)
rows
,
err
:=
query
.
ListIndex
(
indexName
,
index
,
primary
,
count
,
direction
)
if
err
!=
nil
{
tokenlog
.
Error
(
"query List failed"
,
"key"
,
string
(
primary
),
"param"
,
data
,
"err"
,
err
)
return
nil
,
err
}
if
len
(
rows
)
==
0
{
return
nil
,
types
.
ErrNotFound
}
return
rows
,
nil
}
plugin/dapp/token/executor/query.go
View file @
65ba0be8
...
...
@@ -69,3 +69,25 @@ func (t *token) Query_GetTxByToken(in *tokenty.ReqTokenTx) (types.Message, error
}
return
t
.
getTxByToken
(
in
)
}
// Query_GetTokenHistory 获取token 的变更历史
func
(
t
*
token
)
Query_GetTokenHistory
(
in
*
types
.
ReqString
)
(
types
.
Message
,
error
)
{
if
in
==
nil
{
return
nil
,
types
.
ErrInvalidParam
}
rows
,
err
:=
list
(
t
.
GetLocalDB
(),
"symbol"
,
&
tokenty
.
LocalLogs
{
Symbol
:
in
.
Data
},
-
1
,
0
)
if
err
!=
nil
{
tokenlog
.
Error
(
"Query_GetTokenHistory"
,
"err"
,
err
)
return
nil
,
err
}
var
replys
tokenty
.
ReplyTokenLogs
for
_
,
row
:=
range
rows
{
o
,
ok
:=
row
.
Data
.
(
*
tokenty
.
LocalLogs
)
if
!
ok
{
tokenlog
.
Error
(
"Query_GetTokenHistory"
,
"err"
,
"bad row type"
)
return
nil
,
types
.
ErrTypeAsset
}
replys
.
Logs
=
append
(
replys
.
Logs
,
o
)
}
return
&
replys
,
nil
}
plugin/dapp/token/executor/token_new_test.go
View file @
65ba0be8
...
...
@@ -157,6 +157,7 @@ func TestPrecreate(t *testing.T) {
Total
:
tokenAmount
,
Price
:
tokenPrice
,
Owner
:
addr
,
Category
:
pty
.
CategoryMintBurnSupport
,
}
precreate
:=
&
pty
.
TokenAction
{
Ty
:
pty
.
TokenActionPreCreate
,
...
...
@@ -312,6 +313,78 @@ func TestQueryAsset(t *testing.T) {
}
func
TestTokenMint
(
t
*
testing
.
T
)
{
if
!
isMainNetTest
{
return
}
fmt
.
Println
(
"TestTokenMint start"
)
defer
fmt
.
Println
(
"TestTokenMint end"
)
v
:=
&
pty
.
TokenAction_TokenMint
{
TokenMint
:
&
pty
.
TokenMint
{
Symbol
:
tokenSym
,
Amount
:
transAmount
}}
transfer
:=
&
pty
.
TokenAction
{
Value
:
v
,
Ty
:
pty
.
ActionTransfer
}
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
execName
),
Payload
:
types
.
Encode
(
transfer
),
Fee
:
fee
,
To
:
addrexec
}
tx
.
Nonce
=
r
.
Int63
()
tx
.
Sign
(
types
.
SECP256K1
,
privkey
)
reply
,
err
:=
mainClient
.
SendTransaction
(
context
.
Background
(),
tx
)
if
err
!=
nil
{
fmt
.
Println
(
"err"
,
err
)
t
.
Error
(
err
)
return
}
if
!
reply
.
IsOk
{
fmt
.
Println
(
"err = "
,
reply
.
GetMsg
())
t
.
Error
(
ErrTest
)
return
}
if
!
waitTx
(
tx
.
Hash
())
{
t
.
Error
(
ErrTest
)
return
}
}
func
TestQueryTokenLogs
(
t
*
testing
.
T
)
{
if
!
isParaNetTest
{
return
}
fmt
.
Println
(
"TestQueryTokenLogs start"
)
defer
fmt
.
Println
(
"TestQueryTokenLogs end"
)
var
req
types
.
ChainExecutor
req
.
Driver
=
execName
req
.
FuncName
=
"GetTokenHistory"
req
.
Param
=
types
.
Encode
(
&
types
.
ReqString
{
Data
:
tokenSym
})
reply
,
err
:=
paraClient
.
QueryChain
(
context
.
Background
(),
&
req
)
if
err
!=
nil
{
fmt
.
Println
(
err
)
t
.
Error
(
err
)
return
}
if
!
reply
.
IsOk
{
fmt
.
Println
(
"Query reply err"
)
t
.
Error
(
ErrTest
)
return
}
var
res
pty
.
ReplyTokenLogs
err
=
types
.
Decode
(
reply
.
Msg
,
&
res
)
if
err
!=
nil
{
t
.
Error
(
err
)
return
}
assert
.
Equal
(
t
,
2
,
len
(
res
.
Logs
))
for
_
,
l
:=
range
res
.
Logs
{
fmt
.
Println
(
l
.
Symbol
)
fmt
.
Println
(
l
.
TxHash
)
fmt
.
Println
(
l
.
TxIndex
)
fmt
.
Println
(
l
.
ActionType
)
}
}
//***************************************************
//**************common actions for Test**************
//***************************************************
...
...
plugin/dapp/token/executor/token_test.go
0 → 100644
View file @
65ba0be8
package
executor
import
(
"testing"
"github.com/33cn/chain33/account"
"github.com/33cn/chain33/common/address"
"github.com/33cn/chain33/types"
"github.com/33cn/chain33/util"
"github.com/33cn/chain33/common"
"github.com/33cn/chain33/common/crypto"
dbm
"github.com/33cn/chain33/common/db"
pty
"github.com/33cn/plugin/plugin/dapp/token/types"
"github.com/stretchr/testify/assert"
//"github.com/33cn/chain33/types/jsonpb"
)
type
execEnv
struct
{
blockTime
int64
blockHeight
int64
difficulty
uint64
}
var
(
Symbol
=
"TEST"
AssetExecToken
=
"token"
AssetExecPara
=
"paracross"
PrivKeyA
=
"0x6da92a632ab7deb67d38c0f6560bcfed28167998f6496db64c258d5e8393a81b"
// 1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4
PrivKeyB
=
"0x19c069234f9d3e61135fefbeb7791b149cdf6af536f26bebb310d4cd22c3fee4"
// 1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR
PrivKeyC
=
"0x7a80a1f75d7360c6123c32a78ecf978c1ac55636f87892df38d8b85a9aeff115"
// 1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k
PrivKeyD
=
"0xcacb1f5d51700aea07fca2246ab43b0917d70405c65edea9b5063d72eb5c6b71"
// 1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs
Nodes
=
[][]
byte
{
[]
byte
(
"1KSBd17H7ZK8iT37aJztFB22XGwsPTdwE4"
),
[]
byte
(
"1JRNjdEqp4LJ5fqycUBm9ayCKSeeskgMKR"
),
[]
byte
(
"1NLHPEcbTWWxxU3dGUZBhayjrCHD3psX7k"
),
[]
byte
(
"1MCftFynyvG2F4ED5mdHYgziDxx6vDrScs"
),
}
)
func
TestToken
(
t
*
testing
.
T
)
{
types
.
SetTitleOnlyForTest
(
"chain33"
)
tokenTotal
:=
int64
(
10000
*
1e8
)
tokenBurn
:=
int64
(
10
*
1e8
)
tokenMint
:=
int64
(
20
*
1e8
)
total
:=
int64
(
100000
)
accountA
:=
types
.
Account
{
Balance
:
total
,
Frozen
:
0
,
Addr
:
string
(
Nodes
[
0
]),
}
accountB
:=
types
.
Account
{
Balance
:
total
,
Frozen
:
0
,
Addr
:
string
(
Nodes
[
1
]),
}
execAddr
:=
address
.
ExecAddress
(
pty
.
TokenX
)
stateDB
,
_
:=
dbm
.
NewGoMemDB
(
"1"
,
"2"
,
100
)
_
,
_
,
kvdb
:=
util
.
CreateTestDB
()
accA
,
_
:=
account
.
NewAccountDB
(
AssetExecPara
,
Symbol
,
stateDB
)
accA
.
SaveExecAccount
(
execAddr
,
&
accountA
)
accB
,
_
:=
account
.
NewAccountDB
(
AssetExecPara
,
Symbol
,
stateDB
)
accB
.
SaveExecAccount
(
execAddr
,
&
accountB
)
env
:=
execEnv
{
10
,
types
.
GetDappFork
(
pty
.
TokenX
,
pty
.
ForkTokenSymbolWithNumberX
),
1539918074
,
}
// set config key
item
:=
&
types
.
ConfigItem
{
Key
:
"mavl-manage-token-blacklist"
,
Value
:
&
types
.
ConfigItem_Arr
{
Arr
:
&
types
.
ArrayConfig
{
Value
:
[]
string
{
"bty"
}},
},
}
stateDB
.
Set
([]
byte
(
item
.
Key
),
types
.
Encode
(
item
))
item2
:=
&
types
.
ConfigItem
{
Key
:
"mavl-manage-token-finisher"
,
Value
:
&
types
.
ConfigItem_Arr
{
Arr
:
&
types
.
ArrayConfig
{
Value
:
[]
string
{
string
(
Nodes
[
0
])}},
},
}
stateDB
.
Set
([]
byte
(
item2
.
Key
),
types
.
Encode
(
item2
))
// create token
// 创建
//ty := pty.TokenType{}
p1
:=
&
pty
.
TokenPreCreate
{
Name
:
Symbol
,
Symbol
:
Symbol
,
Introduction
:
Symbol
,
Total
:
tokenTotal
,
Price
:
0
,
Owner
:
string
(
Nodes
[
0
]),
Category
:
pty
.
CategoryMintBurnSupport
,
}
//v, _ := types.PBToJSON(p1)
createTx
,
err
:=
types
.
CallCreateTransaction
(
pty
.
TokenX
,
"TokenPreCreate"
,
p1
)
if
err
!=
nil
{
t
.
Error
(
"RPC_Default_Process"
,
"err"
,
err
)
}
createTx
,
err
=
signTx
(
createTx
,
PrivKeyA
)
if
err
!=
nil
{
t
.
Error
(
"RPC_Default_Process sign"
,
"err"
,
err
)
}
exec
:=
newToken
()
exec
.
SetStateDB
(
stateDB
)
exec
.
SetLocalDB
(
kvdb
)
exec
.
SetEnv
(
env
.
blockHeight
,
env
.
blockTime
,
env
.
difficulty
)
receipt
,
err
:=
exec
.
Exec
(
createTx
,
int
(
1
))
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
receipt
)
t
.
Log
(
receipt
)
for
_
,
kv
:=
range
receipt
.
KV
{
stateDB
.
Set
(
kv
.
Key
,
kv
.
Value
)
}
receiptDate
:=
&
types
.
ReceiptData
{
Ty
:
receipt
.
Ty
,
Logs
:
receipt
.
Logs
}
set
,
err
:=
exec
.
ExecLocal
(
createTx
,
receiptDate
,
int
(
1
))
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
p2
:=
&
pty
.
TokenFinishCreate
{
Symbol
:
Symbol
,
Owner
:
string
(
Nodes
[
0
]),
}
//v, _ := types.PBToJSON(p1)
createTx2
,
err
:=
types
.
CallCreateTransaction
(
pty
.
TokenX
,
"TokenFinishCreate"
,
p2
)
if
err
!=
nil
{
t
.
Error
(
"RPC_Default_Process"
,
"err"
,
err
)
}
createTx2
,
err
=
signTx
(
createTx2
,
PrivKeyA
)
if
err
!=
nil
{
t
.
Error
(
"RPC_Default_Process sign"
,
"err"
,
err
)
}
exec
.
SetEnv
(
env
.
blockHeight
+
1
,
env
.
blockTime
+
1
,
env
.
difficulty
)
receipt
,
err
=
exec
.
Exec
(
createTx2
,
int
(
1
))
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
receipt
)
//t.Log(receipt)
for
_
,
kv
:=
range
receipt
.
KV
{
stateDB
.
Set
(
kv
.
Key
,
kv
.
Value
)
}
accDB
,
_
:=
account
.
NewAccountDB
(
pty
.
TokenX
,
Symbol
,
stateDB
)
accChcek
:=
accDB
.
LoadAccount
(
string
(
Nodes
[
0
]))
assert
.
Equal
(
t
,
tokenTotal
,
accChcek
.
Balance
)
receiptDate
=
&
types
.
ReceiptData
{
Ty
:
receipt
.
Ty
,
Logs
:
receipt
.
Logs
}
set
,
err
=
exec
.
ExecLocal
(
createTx2
,
receiptDate
,
int
(
1
))
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
// mint burn
p3
:=
&
pty
.
TokenMint
{
Symbol
:
Symbol
,
Amount
:
tokenMint
,
}
//v, _ := types.PBToJSON(p1)
createTx3
,
err
:=
types
.
CallCreateTransaction
(
pty
.
TokenX
,
"TokenMint"
,
p3
)
if
err
!=
nil
{
t
.
Error
(
"RPC_Default_Process"
,
"err"
,
err
)
}
createTx3
,
err
=
signTx
(
createTx3
,
PrivKeyA
)
if
err
!=
nil
{
t
.
Error
(
"RPC_Default_Process sign"
,
"err"
,
err
)
}
exec
.
SetEnv
(
env
.
blockHeight
+
2
,
env
.
blockTime
+
2
,
env
.
difficulty
)
receipt
,
err
=
exec
.
Exec
(
createTx3
,
int
(
1
))
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
receipt
)
//t.Log(receipt)
for
_
,
kv
:=
range
receipt
.
KV
{
stateDB
.
Set
(
kv
.
Key
,
kv
.
Value
)
}
accChcek
=
accDB
.
LoadAccount
(
string
(
Nodes
[
0
]))
assert
.
Equal
(
t
,
tokenTotal
+
tokenMint
,
accChcek
.
Balance
)
receiptDate
=
&
types
.
ReceiptData
{
Ty
:
receipt
.
Ty
,
Logs
:
receipt
.
Logs
}
set
,
err
=
exec
.
ExecLocal
(
createTx3
,
receiptDate
,
int
(
1
))
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
p4
:=
&
pty
.
TokenBurn
{
Symbol
:
Symbol
,
Amount
:
tokenBurn
,
}
//v, _ := types.PBToJSON(p1)
createTx4
,
err
:=
types
.
CallCreateTransaction
(
pty
.
TokenX
,
"TokenBurn"
,
p4
)
if
err
!=
nil
{
t
.
Error
(
"RPC_Default_Process"
,
"err"
,
err
)
}
createTx4
,
err
=
signTx
(
createTx4
,
PrivKeyA
)
if
err
!=
nil
{
t
.
Error
(
"RPC_Default_Process sign"
,
"err"
,
err
)
}
exec
.
SetEnv
(
env
.
blockHeight
+
1
,
env
.
blockTime
+
1
,
env
.
difficulty
)
receipt
,
err
=
exec
.
Exec
(
createTx4
,
int
(
1
))
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
receipt
)
//t.Log(receipt)
for
_
,
kv
:=
range
receipt
.
KV
{
stateDB
.
Set
(
kv
.
Key
,
kv
.
Value
)
}
accChcek
=
accDB
.
LoadAccount
(
string
(
Nodes
[
0
]))
assert
.
Equal
(
t
,
tokenTotal
+
tokenMint
-
tokenBurn
,
accChcek
.
Balance
)
receiptDate
=
&
types
.
ReceiptData
{
Ty
:
receipt
.
Ty
,
Logs
:
receipt
.
Logs
}
set
,
err
=
exec
.
ExecLocal
(
createTx4
,
receiptDate
,
int
(
1
))
assert
.
Nil
(
t
,
err
)
assert
.
NotNil
(
t
,
set
)
}
func
signTx
(
tx
*
types
.
Transaction
,
hexPrivKey
string
)
(
*
types
.
Transaction
,
error
)
{
signType
:=
types
.
SECP256K1
c
,
err
:=
crypto
.
New
(
types
.
GetSignName
(
pty
.
TokenX
,
signType
))
if
err
!=
nil
{
return
tx
,
err
}
bytes
,
err
:=
common
.
FromHex
(
hexPrivKey
[
:
])
if
err
!=
nil
{
return
tx
,
err
}
privKey
,
err
:=
c
.
PrivKeyFromBytes
(
bytes
)
if
err
!=
nil
{
return
tx
,
err
}
tx
.
Sign
(
int32
(
signType
),
privKey
)
return
tx
,
nil
}
plugin/dapp/token/executor/tokendb.go
View file @
65ba0be8
...
...
@@ -40,7 +40,10 @@ func newTokenDB(preCreate *pty.TokenPreCreate, creator string, height int64) *to
func
(
t
*
tokenDB
)
save
(
db
dbm
.
KV
,
key
[]
byte
)
{
set
:=
t
.
getKVSet
(
key
)
for
i
:=
0
;
i
<
len
(
set
);
i
++
{
db
.
Set
(
set
[
i
]
.
GetKey
(),
set
[
i
]
.
Value
)
err
:=
db
.
Set
(
set
[
i
]
.
GetKey
(),
set
[
i
]
.
Value
)
if
err
!=
nil
{
panic
(
err
)
}
}
}
...
...
@@ -59,6 +62,48 @@ func (t *tokenDB) getKVSet(key []byte) (kvset []*types.KeyValue) {
return
kvset
}
func
loadTokenDB
(
db
dbm
.
KV
,
symbol
string
)
(
*
tokenDB
,
error
)
{
token
,
err
:=
db
.
Get
(
calcTokenKey
(
symbol
))
if
err
!=
nil
{
tokenlog
.
Error
(
"tokendb load "
,
"Can't get token form db for token"
,
symbol
)
return
nil
,
pty
.
ErrTokenNotExist
}
var
t
pty
.
Token
err
=
types
.
Decode
(
token
,
&
t
)
if
err
!=
nil
{
tokenlog
.
Error
(
"tokendb load"
,
"Can't decode token info"
,
symbol
)
return
nil
,
err
}
return
&
tokenDB
{
t
},
nil
}
func
(
t
*
tokenDB
)
mint
(
db
dbm
.
KV
,
addr
string
,
amount
int64
)
([]
*
types
.
KeyValue
,
[]
*
types
.
ReceiptLog
,
error
)
{
if
t
.
token
.
Owner
!=
addr
{
return
nil
,
nil
,
types
.
ErrNotAllow
}
if
t
.
token
.
Total
+
amount
>
types
.
MaxTokenBalance
{
return
nil
,
nil
,
types
.
ErrAmount
}
prevToken
:=
t
.
token
t
.
token
.
Total
+=
amount
kvs
:=
append
(
t
.
getKVSet
(
calcTokenKey
(
t
.
token
.
Symbol
)),
t
.
getKVSet
(
calcTokenAddrNewKeyS
(
t
.
token
.
Symbol
,
t
.
token
.
Owner
))
...
)
logs
:=
[]
*
types
.
ReceiptLog
{{
Ty
:
pty
.
TyLogTokenMint
,
Log
:
types
.
Encode
(
&
pty
.
ReceiptTokenAmount
{
Prev
:
&
prevToken
,
Current
:
&
t
.
token
})}}
return
kvs
,
logs
,
nil
}
func
(
t
*
tokenDB
)
burn
(
db
dbm
.
KV
,
amount
int64
)
([]
*
types
.
KeyValue
,
[]
*
types
.
ReceiptLog
,
error
)
{
if
t
.
token
.
Total
<
amount
{
return
nil
,
nil
,
types
.
ErrNoBalance
}
prevToken
:=
t
.
token
t
.
token
.
Total
-=
amount
kvs
:=
append
(
t
.
getKVSet
(
calcTokenKey
(
t
.
token
.
Symbol
)),
t
.
getKVSet
(
calcTokenAddrNewKeyS
(
t
.
token
.
Symbol
,
t
.
token
.
Owner
))
...
)
logs
:=
[]
*
types
.
ReceiptLog
{{
Ty
:
pty
.
TyLogTokenBurn
,
Log
:
types
.
Encode
(
&
pty
.
ReceiptTokenAmount
{
Prev
:
&
prevToken
,
Current
:
&
t
.
token
})}}
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
)
...
...
@@ -468,3 +513,87 @@ func validSymbolWithHeight(cs []byte, height int64) bool {
}
return
validSymbolOriginal
(
cs
)
}
// 铸币不可控, 也是麻烦。 2选1
// 1. 谁可以发起
// 2. 是否需要审核 这个会增加管理的成本
// 现在实现选择 1
func
(
action
*
tokenAction
)
mint
(
mint
*
pty
.
TokenMint
)
(
*
types
.
Receipt
,
error
)
{
if
mint
==
nil
{
return
nil
,
types
.
ErrInvalidParam
}
if
mint
.
GetAmount
()
<
0
||
mint
.
GetAmount
()
>
types
.
MaxTokenBalance
||
mint
.
GetSymbol
()
==
""
{
return
nil
,
types
.
ErrInvalidParam
}
tokendb
,
err
:=
loadTokenDB
(
action
.
db
,
mint
.
GetSymbol
())
if
err
!=
nil
{
return
nil
,
err
}
if
tokendb
.
token
.
Category
&
pty
.
CategoryMintBurnSupport
==
0
{
tokenlog
.
Error
(
"Can't mint category"
,
"category"
,
tokendb
.
token
.
Category
,
"support"
,
pty
.
CategoryMintBurnSupport
)
return
nil
,
types
.
ErrNotSupport
}
kvs
,
logs
,
err
:=
tokendb
.
mint
(
action
.
db
,
action
.
fromaddr
,
mint
.
Amount
)
if
err
!=
nil
{
tokenlog
.
Error
(
"token mint "
,
"symbol"
,
mint
.
GetSymbol
(),
"error"
,
err
,
"from"
,
action
.
fromaddr
,
"owner"
,
tokendb
.
token
.
Owner
)
return
nil
,
err
}
tokenAccount
,
err
:=
account
.
NewAccountDB
(
"token"
,
mint
.
GetSymbol
(),
action
.
db
)
if
err
!=
nil
{
return
nil
,
err
}
tokenlog
.
Debug
(
"mint"
,
"token.Owner"
,
mint
.
Symbol
,
"token.GetTotal()"
,
mint
.
Amount
)
receipt
,
err
:=
tokenAccount
.
Mint
(
action
.
fromaddr
,
mint
.
Amount
)
if
err
!=
nil
{
return
nil
,
err
}
logs
=
append
(
logs
,
receipt
.
Logs
...
)
kvs
=
append
(
kvs
,
receipt
.
KV
...
)
return
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
,
KV
:
kvs
,
Logs
:
logs
},
nil
}
func
(
action
*
tokenAction
)
burn
(
burn
*
pty
.
TokenBurn
)
(
*
types
.
Receipt
,
error
)
{
if
burn
==
nil
{
return
nil
,
types
.
ErrInvalidParam
}
if
burn
.
GetAmount
()
<
0
||
burn
.
GetAmount
()
>
types
.
MaxTokenBalance
||
burn
.
GetSymbol
()
==
""
{
return
nil
,
types
.
ErrInvalidParam
}
tokendb
,
err
:=
loadTokenDB
(
action
.
db
,
burn
.
GetSymbol
())
if
err
!=
nil
{
return
nil
,
err
}
if
tokendb
.
token
.
Category
&
pty
.
CategoryMintBurnSupport
==
0
{
tokenlog
.
Error
(
"Can't burn category"
,
"category"
,
tokendb
.
token
.
Category
,
"support"
,
pty
.
CategoryMintBurnSupport
)
return
nil
,
types
.
ErrNotSupport
}
kvs
,
logs
,
err
:=
tokendb
.
burn
(
action
.
db
,
burn
.
Amount
)
if
err
!=
nil
{
tokenlog
.
Error
(
"token burn "
,
"symbol"
,
burn
.
GetSymbol
(),
"error"
,
err
,
"from"
,
action
.
fromaddr
,
"owner"
,
tokendb
.
token
.
Owner
)
return
nil
,
err
}
tokenAccount
,
err
:=
account
.
NewAccountDB
(
"token"
,
burn
.
GetSymbol
(),
action
.
db
)
if
err
!=
nil
{
return
nil
,
err
}
tokenlog
.
Debug
(
"burn"
,
"token.Owner"
,
burn
.
Symbol
,
"token.GetTotal()"
,
burn
.
Amount
)
receipt
,
err
:=
tokenAccount
.
Burn
(
action
.
fromaddr
,
burn
.
Amount
)
if
err
!=
nil
{
return
nil
,
err
}
logs
=
append
(
logs
,
receipt
.
Logs
...
)
kvs
=
append
(
kvs
,
receipt
.
KV
...
)
return
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
,
KV
:
kvs
,
Logs
:
logs
},
nil
}
plugin/dapp/token/executor/transwithdraw.go
View file @
65ba0be8
...
...
@@ -172,7 +172,10 @@ func updateAddrReciver(cachedb dbm.KVDB, token string, addr string, amount int64
}
else
{
recv
-=
amount
}
setAddrReciver
(
cachedb
,
token
,
addr
,
recv
)
err
=
setAddrReciver
(
cachedb
,
token
,
addr
,
recv
)
if
err
!=
nil
{
return
nil
,
err
}
//keyvalue
return
getAddrReciverKV
(
token
,
addr
,
recv
),
nil
}
plugin/dapp/token/proto/token.proto
View file @
65ba0be8
...
...
@@ -15,6 +15,8 @@ message TokenAction {
AssetsWithdraw
withdraw
=
5
;
AssetsGenesis
genesis
=
6
;
AssetsTransferToExec
transferToExec
=
8
;
TokenMint
tokenMint
=
9
;
TokenBurn
tokenBurn
=
10
;
}
int32
Ty
=
7
;
}
...
...
@@ -40,6 +42,16 @@ message TokenRevokeCreate {
string
owner
=
2
;
}
message
TokenMint
{
string
symbol
=
1
;
int64
amount
=
2
;
}
message
TokenBurn
{
string
symbol
=
1
;
int64
amount
=
2
;
}
// state db
message
Token
{
string
name
=
1
;
...
...
@@ -60,6 +72,11 @@ message ReceiptToken {
int32
status
=
3
;
}
message
ReceiptTokenAmount
{
Token
prev
=
1
;
Token
current
=
2
;
}
// local
message
LocalToken
{
string
name
=
1
;
...
...
@@ -82,6 +99,13 @@ message LocalToken {
int32
category
=
17
;
}
message
LocalLogs
{
string
symbol
=
1
;
string
txIndex
=
2
;
int32
actionType
=
3
;
string
txHash
=
4
;
}
// query
message
ReqTokens
{
bool
queryAll
=
1
;
...
...
@@ -142,6 +166,10 @@ message ReqTokenTx {
string
addr
=
7
;
}
message
ReplyTokenLogs
{
repeated
LocalLogs
logs
=
1
;
}
service
token
{
// token 对外提供服务的接口
//区块链接口
...
...
plugin/dapp/token/rpc/rpc.go
View file @
65ba0be8
...
...
@@ -121,3 +121,29 @@ func (c *Jrpc) CreateRawTokenRevokeTx(param *tokenty.TokenRevokeCreate, result *
*
result
=
hex
.
EncodeToString
(
data
)
return
nil
}
// CreateRawTokenMintTx 创建未签名的mint Token交易
func
(
c
*
Jrpc
)
CreateRawTokenMintTx
(
param
*
tokenty
.
TokenMint
,
result
*
interface
{})
error
{
if
param
==
nil
||
param
.
Symbol
==
""
||
param
.
Amount
<=
0
{
return
types
.
ErrInvalidParam
}
data
,
err
:=
types
.
CallCreateTx
(
types
.
ExecName
(
tokenty
.
TokenX
),
"TokenMint"
,
param
)
if
err
!=
nil
{
return
err
}
*
result
=
hex
.
EncodeToString
(
data
)
return
nil
}
// CreateRawTokenBurnTx 创建未签名的 burn Token交易
func
(
c
*
Jrpc
)
CreateRawTokenBurnTx
(
param
*
tokenty
.
TokenBurn
,
result
*
interface
{})
error
{
if
param
==
nil
||
param
.
Symbol
==
""
||
param
.
Amount
<=
0
{
return
types
.
ErrInvalidParam
}
data
,
err
:=
types
.
CallCreateTx
(
types
.
ExecName
(
tokenty
.
TokenX
),
"TokenBurn"
,
param
)
if
err
!=
nil
{
return
err
}
*
result
=
hex
.
EncodeToString
(
data
)
return
nil
}
plugin/dapp/token/types/const.go
View file @
65ba0be8
...
...
@@ -19,6 +19,10 @@ const (
TokenActionRevokeCreate
=
9
// TokenActionTransferToExec for token transfer to exec
TokenActionTransferToExec
=
11
// TokenActionMint for token mint
TokenActionMint
=
12
// TokenActionBurn for token burn
TokenActionBurn
=
13
)
// token status
...
...
@@ -72,6 +76,10 @@ const (
TyLogTokenGenesisTransfer
=
321
// TyLogTokenGenesisDeposit log for token genesis deposit
TyLogTokenGenesisDeposit
=
322
// TyLogTokenMint log for token mint
TyLogTokenMint
=
323
// TyLogTokenBurn log for token burn
TyLogTokenBurn
=
324
)
const
(
...
...
@@ -82,3 +90,8 @@ const (
// TokenIntroLenLimit token introduction length limit
TokenIntroLenLimit
=
1024
)
const
(
// CategoryMintBurnSupport support mint & burn
CategoryMintBurnSupport
=
1
<<
iota
)
plugin/dapp/token/types/token.pb.go
View file @
65ba0be8
...
...
@@ -34,6 +34,8 @@ type TokenAction struct {
// *TokenAction_Withdraw
// *TokenAction_Genesis
// *TokenAction_TransferToExec
// *TokenAction_TokenMint
// *TokenAction_TokenBurn
Value
isTokenAction_Value
`protobuf_oneof:"value"`
Ty
int32
`protobuf:"varint,7,opt,name=Ty,proto3" json:"Ty,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
...
...
@@ -98,6 +100,14 @@ type TokenAction_TransferToExec struct {
TransferToExec
*
types
.
AssetsTransferToExec
`protobuf:"bytes,8,opt,name=transferToExec,proto3,oneof"`
}
type
TokenAction_TokenMint
struct
{
TokenMint
*
TokenMint
`protobuf:"bytes,9,opt,name=tokenMint,proto3,oneof"`
}
type
TokenAction_TokenBurn
struct
{
TokenBurn
*
TokenBurn
`protobuf:"bytes,10,opt,name=tokenBurn,proto3,oneof"`
}
func
(
*
TokenAction_TokenPreCreate
)
isTokenAction_Value
()
{}
func
(
*
TokenAction_TokenFinishCreate
)
isTokenAction_Value
()
{}
...
...
@@ -112,6 +122,10 @@ func (*TokenAction_Genesis) isTokenAction_Value() {}
func
(
*
TokenAction_TransferToExec
)
isTokenAction_Value
()
{}
func
(
*
TokenAction_TokenMint
)
isTokenAction_Value
()
{}
func
(
*
TokenAction_TokenBurn
)
isTokenAction_Value
()
{}
func
(
m
*
TokenAction
)
GetValue
()
isTokenAction_Value
{
if
m
!=
nil
{
return
m
.
Value
...
...
@@ -168,6 +182,20 @@ func (m *TokenAction) GetTransferToExec() *types.AssetsTransferToExec {
return
nil
}
func
(
m
*
TokenAction
)
GetTokenMint
()
*
TokenMint
{
if
x
,
ok
:=
m
.
GetValue
()
.
(
*
TokenAction_TokenMint
);
ok
{
return
x
.
TokenMint
}
return
nil
}
func
(
m
*
TokenAction
)
GetTokenBurn
()
*
TokenBurn
{
if
x
,
ok
:=
m
.
GetValue
()
.
(
*
TokenAction_TokenBurn
);
ok
{
return
x
.
TokenBurn
}
return
nil
}
func
(
m
*
TokenAction
)
GetTy
()
int32
{
if
m
!=
nil
{
return
m
.
Ty
...
...
@@ -185,6 +213,8 @@ func (*TokenAction) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) e
(
*
TokenAction_Withdraw
)(
nil
),
(
*
TokenAction_Genesis
)(
nil
),
(
*
TokenAction_TransferToExec
)(
nil
),
(
*
TokenAction_TokenMint
)(
nil
),
(
*
TokenAction_TokenBurn
)(
nil
),
}
}
...
...
@@ -227,6 +257,16 @@ func _TokenAction_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
if
err
:=
b
.
EncodeMessage
(
x
.
TransferToExec
);
err
!=
nil
{
return
err
}
case
*
TokenAction_TokenMint
:
b
.
EncodeVarint
(
9
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
TokenMint
);
err
!=
nil
{
return
err
}
case
*
TokenAction_TokenBurn
:
b
.
EncodeVarint
(
10
<<
3
|
proto
.
WireBytes
)
if
err
:=
b
.
EncodeMessage
(
x
.
TokenBurn
);
err
!=
nil
{
return
err
}
case
nil
:
default
:
return
fmt
.
Errorf
(
"TokenAction.Value has unexpected type %T"
,
x
)
...
...
@@ -293,6 +333,22 @@ func _TokenAction_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Bu
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
TokenAction_TransferToExec
{
msg
}
return
true
,
err
case
9
:
// value.tokenMint
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
msg
:=
new
(
TokenMint
)
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
TokenAction_TokenMint
{
msg
}
return
true
,
err
case
10
:
// value.tokenBurn
if
wire
!=
proto
.
WireBytes
{
return
true
,
proto
.
ErrInternalBadWireType
}
msg
:=
new
(
TokenBurn
)
err
:=
b
.
DecodeMessage
(
msg
)
m
.
Value
=
&
TokenAction_TokenBurn
{
msg
}
return
true
,
err
default
:
return
false
,
nil
}
...
...
@@ -337,6 +393,16 @@ func _TokenAction_OneofSizer(msg proto.Message) (n int) {
n
+=
1
// tag and wire
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
*
TokenAction_TokenMint
:
s
:=
proto
.
Size
(
x
.
TokenMint
)
n
+=
1
// tag and wire
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
*
TokenAction_TokenBurn
:
s
:=
proto
.
Size
(
x
.
TokenBurn
)
n
+=
1
// tag and wire
n
+=
proto
.
SizeVarint
(
uint64
(
s
))
n
+=
s
case
nil
:
default
:
panic
(
fmt
.
Sprintf
(
"proto: unexpected type %T in oneof"
,
x
))
...
...
@@ -526,6 +592,100 @@ func (m *TokenRevokeCreate) GetOwner() string {
return
""
}
type
TokenMint
struct
{
Symbol
string
`protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"`
Amount
int64
`protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
TokenMint
)
Reset
()
{
*
m
=
TokenMint
{}
}
func
(
m
*
TokenMint
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
TokenMint
)
ProtoMessage
()
{}
func
(
*
TokenMint
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_3aff0bcd502840ab
,
[]
int
{
4
}
}
func
(
m
*
TokenMint
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_TokenMint
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
TokenMint
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_TokenMint
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
TokenMint
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_TokenMint
.
Merge
(
m
,
src
)
}
func
(
m
*
TokenMint
)
XXX_Size
()
int
{
return
xxx_messageInfo_TokenMint
.
Size
(
m
)
}
func
(
m
*
TokenMint
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_TokenMint
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_TokenMint
proto
.
InternalMessageInfo
func
(
m
*
TokenMint
)
GetSymbol
()
string
{
if
m
!=
nil
{
return
m
.
Symbol
}
return
""
}
func
(
m
*
TokenMint
)
GetAmount
()
int64
{
if
m
!=
nil
{
return
m
.
Amount
}
return
0
}
type
TokenBurn
struct
{
Symbol
string
`protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"`
Amount
int64
`protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
TokenBurn
)
Reset
()
{
*
m
=
TokenBurn
{}
}
func
(
m
*
TokenBurn
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
TokenBurn
)
ProtoMessage
()
{}
func
(
*
TokenBurn
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_3aff0bcd502840ab
,
[]
int
{
5
}
}
func
(
m
*
TokenBurn
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_TokenBurn
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
TokenBurn
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_TokenBurn
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
TokenBurn
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_TokenBurn
.
Merge
(
m
,
src
)
}
func
(
m
*
TokenBurn
)
XXX_Size
()
int
{
return
xxx_messageInfo_TokenBurn
.
Size
(
m
)
}
func
(
m
*
TokenBurn
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_TokenBurn
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_TokenBurn
proto
.
InternalMessageInfo
func
(
m
*
TokenBurn
)
GetSymbol
()
string
{
if
m
!=
nil
{
return
m
.
Symbol
}
return
""
}
func
(
m
*
TokenBurn
)
GetAmount
()
int64
{
if
m
!=
nil
{
return
m
.
Amount
}
return
0
}
// state db
type
Token
struct
{
Name
string
`protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
...
...
@@ -546,7 +706,7 @@ func (m *Token) Reset() { *m = Token{} }
func
(
m
*
Token
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
Token
)
ProtoMessage
()
{}
func
(
*
Token
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_3aff0bcd502840ab
,
[]
int
{
4
}
return
fileDescriptor_3aff0bcd502840ab
,
[]
int
{
6
}
}
func
(
m
*
Token
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
...
@@ -644,7 +804,7 @@ func (m *ReceiptToken) Reset() { *m = ReceiptToken{} }
func
(
m
*
ReceiptToken
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReceiptToken
)
ProtoMessage
()
{}
func
(
*
ReceiptToken
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_3aff0bcd502840ab
,
[]
int
{
5
}
return
fileDescriptor_3aff0bcd502840ab
,
[]
int
{
7
}
}
func
(
m
*
ReceiptToken
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
...
@@ -686,6 +846,53 @@ func (m *ReceiptToken) GetStatus() int32 {
return
0
}
type
ReceiptTokenAmount
struct
{
Prev
*
Token
`protobuf:"bytes,1,opt,name=prev,proto3" json:"prev,omitempty"`
Current
*
Token
`protobuf:"bytes,2,opt,name=current,proto3" json:"current,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
ReceiptTokenAmount
)
Reset
()
{
*
m
=
ReceiptTokenAmount
{}
}
func
(
m
*
ReceiptTokenAmount
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReceiptTokenAmount
)
ProtoMessage
()
{}
func
(
*
ReceiptTokenAmount
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_3aff0bcd502840ab
,
[]
int
{
8
}
}
func
(
m
*
ReceiptTokenAmount
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_ReceiptTokenAmount
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
ReceiptTokenAmount
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_ReceiptTokenAmount
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
ReceiptTokenAmount
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReceiptTokenAmount
.
Merge
(
m
,
src
)
}
func
(
m
*
ReceiptTokenAmount
)
XXX_Size
()
int
{
return
xxx_messageInfo_ReceiptTokenAmount
.
Size
(
m
)
}
func
(
m
*
ReceiptTokenAmount
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_ReceiptTokenAmount
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_ReceiptTokenAmount
proto
.
InternalMessageInfo
func
(
m
*
ReceiptTokenAmount
)
GetPrev
()
*
Token
{
if
m
!=
nil
{
return
m
.
Prev
}
return
nil
}
func
(
m
*
ReceiptTokenAmount
)
GetCurrent
()
*
Token
{
if
m
!=
nil
{
return
m
.
Current
}
return
nil
}
// local
type
LocalToken
struct
{
Name
string
`protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
...
...
@@ -715,7 +922,7 @@ func (m *LocalToken) Reset() { *m = LocalToken{} }
func
(
m
*
LocalToken
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
LocalToken
)
ProtoMessage
()
{}
func
(
*
LocalToken
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_3aff0bcd502840ab
,
[]
int
{
6
}
return
fileDescriptor_3aff0bcd502840ab
,
[]
int
{
9
}
}
func
(
m
*
LocalToken
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
...
@@ -855,6 +1062,69 @@ func (m *LocalToken) GetCategory() int32 {
return
0
}
type
LocalLogs
struct
{
Symbol
string
`protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"`
TxIndex
string
`protobuf:"bytes,2,opt,name=txIndex,proto3" json:"txIndex,omitempty"`
ActionType
int32
`protobuf:"varint,3,opt,name=actionType,proto3" json:"actionType,omitempty"`
TxHash
string
`protobuf:"bytes,4,opt,name=txHash,proto3" json:"txHash,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
LocalLogs
)
Reset
()
{
*
m
=
LocalLogs
{}
}
func
(
m
*
LocalLogs
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
LocalLogs
)
ProtoMessage
()
{}
func
(
*
LocalLogs
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_3aff0bcd502840ab
,
[]
int
{
10
}
}
func
(
m
*
LocalLogs
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_LocalLogs
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
LocalLogs
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_LocalLogs
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
LocalLogs
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_LocalLogs
.
Merge
(
m
,
src
)
}
func
(
m
*
LocalLogs
)
XXX_Size
()
int
{
return
xxx_messageInfo_LocalLogs
.
Size
(
m
)
}
func
(
m
*
LocalLogs
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_LocalLogs
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_LocalLogs
proto
.
InternalMessageInfo
func
(
m
*
LocalLogs
)
GetSymbol
()
string
{
if
m
!=
nil
{
return
m
.
Symbol
}
return
""
}
func
(
m
*
LocalLogs
)
GetTxIndex
()
string
{
if
m
!=
nil
{
return
m
.
TxIndex
}
return
""
}
func
(
m
*
LocalLogs
)
GetActionType
()
int32
{
if
m
!=
nil
{
return
m
.
ActionType
}
return
0
}
func
(
m
*
LocalLogs
)
GetTxHash
()
string
{
if
m
!=
nil
{
return
m
.
TxHash
}
return
""
}
// query
type
ReqTokens
struct
{
QueryAll
bool
`protobuf:"varint,1,opt,name=queryAll,proto3" json:"queryAll,omitempty"`
...
...
@@ -870,7 +1140,7 @@ func (m *ReqTokens) Reset() { *m = ReqTokens{} }
func
(
m
*
ReqTokens
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReqTokens
)
ProtoMessage
()
{}
func
(
*
ReqTokens
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_3aff0bcd502840ab
,
[]
int
{
7
}
return
fileDescriptor_3aff0bcd502840ab
,
[]
int
{
11
}
}
func
(
m
*
ReqTokens
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
...
@@ -930,7 +1200,7 @@ func (m *ReplyTokens) Reset() { *m = ReplyTokens{} }
func
(
m
*
ReplyTokens
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReplyTokens
)
ProtoMessage
()
{}
func
(
*
ReplyTokens
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_3aff0bcd502840ab
,
[]
int
{
8
}
return
fileDescriptor_3aff0bcd502840ab
,
[]
int
{
12
}
}
func
(
m
*
ReplyTokens
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
...
@@ -970,7 +1240,7 @@ func (m *TokenRecv) Reset() { *m = TokenRecv{} }
func
(
m
*
TokenRecv
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
TokenRecv
)
ProtoMessage
()
{}
func
(
*
TokenRecv
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_3aff0bcd502840ab
,
[]
int
{
9
}
return
fileDescriptor_3aff0bcd502840ab
,
[]
int
{
13
}
}
func
(
m
*
TokenRecv
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
...
@@ -1016,7 +1286,7 @@ func (m *ReplyAddrRecvForTokens) Reset() { *m = ReplyAddrRecvForTokens{}
func
(
m
*
ReplyAddrRecvForTokens
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReplyAddrRecvForTokens
)
ProtoMessage
()
{}
func
(
*
ReplyAddrRecvForTokens
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_3aff0bcd502840ab
,
[]
int
{
1
0
}
return
fileDescriptor_3aff0bcd502840ab
,
[]
int
{
1
4
}
}
func
(
m
*
ReplyAddrRecvForTokens
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
...
@@ -1057,7 +1327,7 @@ func (m *ReqTokenBalance) Reset() { *m = ReqTokenBalance{} }
func
(
m
*
ReqTokenBalance
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReqTokenBalance
)
ProtoMessage
()
{}
func
(
*
ReqTokenBalance
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_3aff0bcd502840ab
,
[]
int
{
1
1
}
return
fileDescriptor_3aff0bcd502840ab
,
[]
int
{
1
5
}
}
func
(
m
*
ReqTokenBalance
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
...
@@ -1111,7 +1381,7 @@ func (m *ReqAccountTokenAssets) Reset() { *m = ReqAccountTokenAssets{} }
func
(
m
*
ReqAccountTokenAssets
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReqAccountTokenAssets
)
ProtoMessage
()
{}
func
(
*
ReqAccountTokenAssets
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_3aff0bcd502840ab
,
[]
int
{
1
2
}
return
fileDescriptor_3aff0bcd502840ab
,
[]
int
{
1
6
}
}
func
(
m
*
ReqAccountTokenAssets
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
...
@@ -1158,7 +1428,7 @@ func (m *TokenAsset) Reset() { *m = TokenAsset{} }
func
(
m
*
TokenAsset
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
TokenAsset
)
ProtoMessage
()
{}
func
(
*
TokenAsset
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_3aff0bcd502840ab
,
[]
int
{
1
3
}
return
fileDescriptor_3aff0bcd502840ab
,
[]
int
{
1
7
}
}
func
(
m
*
TokenAsset
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
...
@@ -1204,7 +1474,7 @@ func (m *ReplyAccountTokenAssets) Reset() { *m = ReplyAccountTokenAssets
func
(
m
*
ReplyAccountTokenAssets
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReplyAccountTokenAssets
)
ProtoMessage
()
{}
func
(
*
ReplyAccountTokenAssets
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_3aff0bcd502840ab
,
[]
int
{
1
4
}
return
fileDescriptor_3aff0bcd502840ab
,
[]
int
{
1
8
}
}
func
(
m
*
ReplyAccountTokenAssets
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
...
@@ -1248,7 +1518,7 @@ func (m *ReqAddrTokens) Reset() { *m = ReqAddrTokens{} }
func
(
m
*
ReqAddrTokens
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReqAddrTokens
)
ProtoMessage
()
{}
func
(
*
ReqAddrTokens
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_3aff0bcd502840ab
,
[]
int
{
1
5
}
return
fileDescriptor_3aff0bcd502840ab
,
[]
int
{
1
9
}
}
func
(
m
*
ReqAddrTokens
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
...
@@ -1329,7 +1599,7 @@ func (m *ReqTokenTx) Reset() { *m = ReqTokenTx{} }
func
(
m
*
ReqTokenTx
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReqTokenTx
)
ProtoMessage
()
{}
func
(
*
ReqTokenTx
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_3aff0bcd502840ab
,
[]
int
{
16
}
return
fileDescriptor_3aff0bcd502840ab
,
[]
int
{
20
}
}
func
(
m
*
ReqTokenTx
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
...
...
@@ -1399,14 +1669,57 @@ func (m *ReqTokenTx) GetAddr() string {
return
""
}
type
ReplyTokenLogs
struct
{
Logs
[]
*
LocalLogs
`protobuf:"bytes,1,rep,name=logs,proto3" json:"logs,omitempty"`
XXX_NoUnkeyedLiteral
struct
{}
`json:"-"`
XXX_unrecognized
[]
byte
`json:"-"`
XXX_sizecache
int32
`json:"-"`
}
func
(
m
*
ReplyTokenLogs
)
Reset
()
{
*
m
=
ReplyTokenLogs
{}
}
func
(
m
*
ReplyTokenLogs
)
String
()
string
{
return
proto
.
CompactTextString
(
m
)
}
func
(
*
ReplyTokenLogs
)
ProtoMessage
()
{}
func
(
*
ReplyTokenLogs
)
Descriptor
()
([]
byte
,
[]
int
)
{
return
fileDescriptor_3aff0bcd502840ab
,
[]
int
{
21
}
}
func
(
m
*
ReplyTokenLogs
)
XXX_Unmarshal
(
b
[]
byte
)
error
{
return
xxx_messageInfo_ReplyTokenLogs
.
Unmarshal
(
m
,
b
)
}
func
(
m
*
ReplyTokenLogs
)
XXX_Marshal
(
b
[]
byte
,
deterministic
bool
)
([]
byte
,
error
)
{
return
xxx_messageInfo_ReplyTokenLogs
.
Marshal
(
b
,
m
,
deterministic
)
}
func
(
m
*
ReplyTokenLogs
)
XXX_Merge
(
src
proto
.
Message
)
{
xxx_messageInfo_ReplyTokenLogs
.
Merge
(
m
,
src
)
}
func
(
m
*
ReplyTokenLogs
)
XXX_Size
()
int
{
return
xxx_messageInfo_ReplyTokenLogs
.
Size
(
m
)
}
func
(
m
*
ReplyTokenLogs
)
XXX_DiscardUnknown
()
{
xxx_messageInfo_ReplyTokenLogs
.
DiscardUnknown
(
m
)
}
var
xxx_messageInfo_ReplyTokenLogs
proto
.
InternalMessageInfo
func
(
m
*
ReplyTokenLogs
)
GetLogs
()
[]
*
LocalLogs
{
if
m
!=
nil
{
return
m
.
Logs
}
return
nil
}
func
init
()
{
proto
.
RegisterType
((
*
TokenAction
)(
nil
),
"types.TokenAction"
)
proto
.
RegisterType
((
*
TokenPreCreate
)(
nil
),
"types.TokenPreCreate"
)
proto
.
RegisterType
((
*
TokenFinishCreate
)(
nil
),
"types.TokenFinishCreate"
)
proto
.
RegisterType
((
*
TokenRevokeCreate
)(
nil
),
"types.TokenRevokeCreate"
)
proto
.
RegisterType
((
*
TokenMint
)(
nil
),
"types.TokenMint"
)
proto
.
RegisterType
((
*
TokenBurn
)(
nil
),
"types.TokenBurn"
)
proto
.
RegisterType
((
*
Token
)(
nil
),
"types.Token"
)
proto
.
RegisterType
((
*
ReceiptToken
)(
nil
),
"types.ReceiptToken"
)
proto
.
RegisterType
((
*
ReceiptTokenAmount
)(
nil
),
"types.ReceiptTokenAmount"
)
proto
.
RegisterType
((
*
LocalToken
)(
nil
),
"types.LocalToken"
)
proto
.
RegisterType
((
*
LocalLogs
)(
nil
),
"types.LocalLogs"
)
proto
.
RegisterType
((
*
ReqTokens
)(
nil
),
"types.ReqTokens"
)
proto
.
RegisterType
((
*
ReplyTokens
)(
nil
),
"types.ReplyTokens"
)
proto
.
RegisterType
((
*
TokenRecv
)(
nil
),
"types.TokenRecv"
)
...
...
@@ -1417,72 +1730,83 @@ func init() {
proto
.
RegisterType
((
*
ReplyAccountTokenAssets
)(
nil
),
"types.ReplyAccountTokenAssets"
)
proto
.
RegisterType
((
*
ReqAddrTokens
)(
nil
),
"types.ReqAddrTokens"
)
proto
.
RegisterType
((
*
ReqTokenTx
)(
nil
),
"types.ReqTokenTx"
)
proto
.
RegisterType
((
*
ReplyTokenLogs
)(
nil
),
"types.ReplyTokenLogs"
)
}
func
init
()
{
proto
.
RegisterFile
(
"token.proto"
,
fileDescriptor_3aff0bcd502840ab
)
}
var
fileDescriptor_3aff0bcd502840ab
=
[]
byte
{
// 960 bytes of a gzipped FileDescriptorProto
0x1f
,
0x8b
,
0x08
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x02
,
0xff
,
0xdc
,
0x56
,
0xdd
,
0x6e
,
0xe3
,
0x44
,
0x14
,
0x4e
,
0xe2
,
0xfc
,
0xf9
,
0x64
,
0x9b
,
0x6e
,
0x86
,
0xdd
,
0x60
,
0x95
,
0x15
,
0xaa
,
0x2c
,
0x2e
,
0x8a
,
0x84
,
0xaa
,
0xaa
,
0x15
,
0x12
,
0x17
,
0x48
,
0x28
,
0x8b
,
0xba
,
0x1b
,
0x7e
,
0xb4
,
0xa0
,
0x21
,
0x12
,
0xd7
,
0x5e
,
0xfb
,
0xb4
,
0xb5
,
0x9a
,
0xd8
,
0xe9
,
0x78
,
0x92
,
0x36
,
0x4f
,
0xc3
,
0x3d
,
0x17
,
0x3c
,
0x02
,
0x8f
,
0xc2
,
0x2d
,
0xaf
,
0x81
,
0xe6
,
0xcc
,
0x8c
,
0x33
,
0x93
,
0xb4
,
0x48
,
0x7b
,
0x87
,
0xb8
,
0xf3
,
0xf9
,
0xfb
,
0xe6
,
0x9c
,
0xef
,
0x7c
,
0x1e
,
0x1b
,
0x06
,
0xb2
,
0xbc
,
0xc5
,
0xe2
,
0x74
,
0x29
,
0x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c7
,
0xcb
,
0x9d
,
0x25
,
0x64
,
0xd0
,
0xbc
,
0x99
,
0x06
,
0x13
,
0x73
,
0x41
,
0xfa
,
0x5e
,
0x1f
,
0xe5
,
0xd8
,
0x47
,
0xfd
,
0xf3
,
0xf5
,
0x8e
,
0xa1
,
0x7d
,
0xab
,
0x17
,
0x8e
,
0x5e
,
0xe6
,
0x46
,
0x52
,
0x58
,
0x31
,
0x2d
,
0x81
,
0xb6
,
0xde
,
0xf1
,
0x24
,
0x94
,
0xc5
,
0xea
,
0xac
,
0x8b
,
0xe5
,
0x7f
,
0x0e
,
0xbd
,
0xf5
,
0x94
,
0xd1
,
0x6a
,
0x79
,
0x05
,
0xcd
,
0x69
,
0x3a
,
0xd9
,
0xa4
,
0x79
,
0xb9
,
0x7a
,
0x38
,
0x59
,
0x2f
,
0xae
,
0x4d
,
0x31
,
0xd9
,
0x57
,
0x70
,
0xf8
,
0x06
,
0x65
,
0x85
,
0xe9
,
0xc7
,
0x26
,
0x66
,
0x63
,
0x02
,
0x4e
,
0x0e
,
0xab
,
0x3c
,
0xc9
,
0xfd
,
0xda
,
0x87
,
0x36
,
0xfd
,
0x5d
,
0xb9
,
0xfc
,
0x3b
,
0x00
,
0x00
,
0xff
,
0xff
,
0xe2
,
0xae
,
0x58
,
0x34
,
0xe6
,
0x0c
,
0x00
,
0x00
,
}
// Reference imports to suppress errors if they are not otherwise used.
...
...
plugin/dapp/token/types/types.go
View file @
65ba0be8
...
...
@@ -57,6 +57,8 @@ func (t *TokenType) GetTypeMap() map[string]int32 {
"TokenFinishCreate"
:
TokenActionFinishCreate
,
"TokenRevokeCreate"
:
TokenActionRevokeCreate
,
"TransferToExec"
:
TokenActionTransferToExec
,
"TokenMint"
:
TokenActionMint
,
"TokenBurn"
:
TokenActionBurn
,
}
}
...
...
@@ -75,6 +77,8 @@ func (t *TokenType) GetLogMap() map[int64]*types.LogInfo {
TyLogPreCreateToken
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptToken
{}),
Name
:
"LogPreCreateToken"
},
TyLogFinishCreateToken
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptToken
{}),
Name
:
"LogFinishCreateToken"
},
TyLogRevokeCreateToken
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptToken
{}),
Name
:
"LogRevokeCreateToken"
},
TyLogTokenMint
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptTokenAmount
{}),
Name
:
"LogMintToken"
},
TyLogTokenBurn
:
{
Ty
:
reflect
.
TypeOf
(
ReceiptTokenAmount
{}),
Name
:
"LogBurnToken"
},
}
}
...
...
vendor/github.com/33cn/chain33/account/account_test.go
View file @
65ba0be8
...
...
@@ -601,3 +601,4 @@ func TestDB_Burn(t *testing.T) {
t
.
Logf
(
"Token mint addr balance [%d]"
,
tokenCoin
.
LoadAccount
(
addr1
)
.
Balance
)
require
.
Equal
(
t
,
int64
(
1000
*
1e8
-
10
*
1e8
),
tokenCoin
.
LoadAccount
(
addr1
)
.
Balance
)
}
vendor/github.com/33cn/chain33/types/proto/account.proto
View file @
65ba0be8
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