• R/O
  • HTTP
  • SSH
  • HTTPS

vapor: Commit

Golang implemented sidechain for Bytom


Commit MetaInfo

Revisionf05c2421db923b2881f53ff80091a7bd4be55269 (tree)
Time2019-06-26 17:14:54
AuthorHAOYUatHZ <haoyu@prot...>
CommiterHAOYUatHZ

Log Message

add asset

Change Summary

Incremental Difference

--- a/federation/database/orm/cross_transaction_req.go
+++ b/federation/database/orm/cross_transaction_req.go
@@ -1,19 +1,33 @@
11 package orm
22
33 import (
4+ "encoding/json"
5+
46 "github.com/vapor/federation/types"
57 )
68
79 type CrossTransactionReq struct {
8- ID uint64 `gorm:"primary_key" json:"-"`
9- CrossTransactionID uint64 `json:"-"`
10- SourcePos uint64 `json:"-"`
11- AssetID uint64 `json:"-"`
12- AssetAmount uint64 `json:"amount"`
13- Script string `json:"-"`
14- CreatedAt types.Timestamp `json:"-"`
15- UpdatedAt types.Timestamp `json:"-"`
10+ ID uint64 `gorm:"primary_key"`
11+ CrossTransactionID uint64
12+ SourcePos uint64
13+ AssetID uint64
14+ AssetAmount uint64
15+ Script string
16+ CreatedAt types.Timestamp
17+ UpdatedAt types.Timestamp
18+
19+ CrossTransaction *CrossTransaction `gorm:"foreignkey:CrossTransactionID"`
20+ Asset *Asset `gorm:"foreignkey:ID"`
21+}
1622
17- CrossTransaction *CrossTransaction `gorm:"foreignkey:CrossTransactionID" json:"-"`
18- Asset *Asset `gorm:"foreignkey:ID" json:"asset"`
23+func (c *CrossTransactionReq) MarshalJSON() ([]byte, error) {
24+ return json.Marshal(&struct {
25+ AssetID string `json:"asset_id"`
26+ Amount uint64 `json:"amount"`
27+ ToAddress string `json:"to_address"`
28+ }{
29+ Amount: c.AssetAmount,
30+ ToAddress: ",",
31+ AssetID: c.Asset.AssetID,
32+ })
1933 }
Show on old repository browser