aboutsummaryrefslogtreecommitdiff
path: root/core/gen_genesis_account.go
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2020-06-30 17:05:50 -0400
committerDeterminant <[email protected]>2020-06-30 17:05:50 -0400
commit7feec02902d52a3abf722613eb9e218e015b723c (patch)
tree3ca683e866cdaba9c06480f825682677826557f3 /core/gen_genesis_account.go
parent3a872747058e9fd32810d0864e19a197529b7d79 (diff)
make mc tx work
Diffstat (limited to 'core/gen_genesis_account.go')
-rw-r--r--core/gen_genesis_account.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/gen_genesis_account.go b/core/gen_genesis_account.go
index a7ef4a6..b90b658 100644
--- a/core/gen_genesis_account.go
+++ b/core/gen_genesis_account.go
@@ -14,11 +14,13 @@ import (
var _ = (*genesisAccountMarshaling)(nil)
+// MarshalJSON marshals as JSON.
func (g GenesisAccount) MarshalJSON() ([]byte, error) {
type GenesisAccount struct {
Code hexutil.Bytes `json:"code,omitempty"`
Storage map[storageJSON]storageJSON `json:"storage,omitempty"`
Balance *math.HexOrDecimal256 `json:"balance" gencodec:"required"`
+ MCBalance GenesisMultiCoinBalance `json:"mcbalance,omitempty"`
Nonce math.HexOrDecimal64 `json:"nonce,omitempty"`
PrivateKey hexutil.Bytes `json:"secretKey,omitempty"`
}
@@ -31,16 +33,19 @@ func (g GenesisAccount) MarshalJSON() ([]byte, error) {
}
}
enc.Balance = (*math.HexOrDecimal256)(g.Balance)
+ enc.MCBalance = g.MCBalance
enc.Nonce = math.HexOrDecimal64(g.Nonce)
enc.PrivateKey = g.PrivateKey
return json.Marshal(&enc)
}
+// UnmarshalJSON unmarshals from JSON.
func (g *GenesisAccount) UnmarshalJSON(input []byte) error {
type GenesisAccount struct {
Code *hexutil.Bytes `json:"code,omitempty"`
Storage map[storageJSON]storageJSON `json:"storage,omitempty"`
Balance *math.HexOrDecimal256 `json:"balance" gencodec:"required"`
+ MCBalance *GenesisMultiCoinBalance `json:"mcbalance,omitempty"`
Nonce *math.HexOrDecimal64 `json:"nonce,omitempty"`
PrivateKey *hexutil.Bytes `json:"secretKey,omitempty"`
}
@@ -61,6 +66,9 @@ func (g *GenesisAccount) UnmarshalJSON(input []byte) error {
return errors.New("missing required field 'balance' for GenesisAccount")
}
g.Balance = (*big.Int)(dec.Balance)
+ if dec.MCBalance != nil {
+ g.MCBalance = *dec.MCBalance
+ }
if dec.Nonce != nil {
g.Nonce = uint64(*dec.Nonce)
}