Commit e1172643 authored by linj's avatar linj Committed by vipwzw

create support token.category

parent cf3c0a5c
...@@ -20,7 +20,7 @@ type tokenDB struct { ...@@ -20,7 +20,7 @@ type tokenDB struct {
token pty.Token token pty.Token
} }
func newTokenDB(preCreate *pty.TokenPreCreate, creator string) *tokenDB { func newTokenDB(preCreate *pty.TokenPreCreate, creator string, height int64) *tokenDB {
t := &tokenDB{} t := &tokenDB{}
t.token.Name = preCreate.GetName() t.token.Name = preCreate.GetName()
t.token.Symbol = preCreate.GetSymbol() t.token.Symbol = preCreate.GetSymbol()
...@@ -31,6 +31,9 @@ func newTokenDB(preCreate *pty.TokenPreCreate, creator string) *tokenDB { ...@@ -31,6 +31,9 @@ func newTokenDB(preCreate *pty.TokenPreCreate, creator string) *tokenDB {
t.token.Owner = preCreate.GetOwner() t.token.Owner = preCreate.GetOwner()
t.token.Creator = creator t.token.Creator = creator
t.token.Status = pty.TokenStatusPreCreated t.token.Status = pty.TokenStatusPreCreated
if types.IsDappFork(height, pty.TokenX, pty.ForkTokenSymbolWithNumberX) {
t.token.Category = preCreate.Category
}
return t return t
} }
...@@ -108,6 +111,11 @@ func (action *tokenAction) preCreate(token *pty.TokenPreCreate) (*types.Receipt, ...@@ -108,6 +111,11 @@ func (action *tokenAction) preCreate(token *pty.TokenPreCreate) (*types.Receipt,
} else if token.GetTotal() > types.MaxTokenBalance || token.GetTotal() <= 0 { } else if token.GetTotal() > types.MaxTokenBalance || token.GetTotal() <= 0 {
return nil, pty.ErrTokenTotalOverflow return nil, pty.ErrTokenTotalOverflow
} }
if !types.IsDappFork(action.height, pty.TokenX, pty.ForkTokenSymbolWithNumberX) {
if token.Category != 0 {
return nil, types.ErrNotSupport
}
}
if !validSymbolWithHeight([]byte(token.GetSymbol()), action.height) { if !validSymbolWithHeight([]byte(token.GetSymbol()), action.height) {
tokenlog.Error("token precreate ", "symbol need be upper", token.GetSymbol()) tokenlog.Error("token precreate ", "symbol need be upper", token.GetSymbol())
...@@ -147,7 +155,7 @@ func (action *tokenAction) preCreate(token *pty.TokenPreCreate) (*types.Receipt, ...@@ -147,7 +155,7 @@ func (action *tokenAction) preCreate(token *pty.TokenPreCreate) (*types.Receipt,
kv = append(kv, receipt.KV...) kv = append(kv, receipt.KV...)
} }
tokendb := newTokenDB(token, action.fromaddr) tokendb := newTokenDB(token, action.fromaddr, action.height)
var statuskey []byte var statuskey []byte
var key []byte var key []byte
if types.IsFork(action.height, "ForkExecKey") { if types.IsFork(action.height, "ForkExecKey") {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment