forked from cerc-io/laconicd-deprecated
genesis functions cleanup, testing (#318)
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"math/big"
|
||||
|
||||
ethcmn "github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
)
|
||||
|
||||
type (
|
||||
@@ -29,7 +30,7 @@ type (
|
||||
GenesisAccount struct {
|
||||
Address ethcmn.Address `json:"address"`
|
||||
Balance *big.Int `json:"balance"`
|
||||
Code []byte `json:"code,omitempty"`
|
||||
Code hexutil.Bytes `json:"code,omitempty"`
|
||||
Storage []GenesisStorage `json:"storage,omitempty"`
|
||||
}
|
||||
)
|
||||
|
||||
@@ -63,6 +63,11 @@ func NewMsgEthermint(
|
||||
}
|
||||
}
|
||||
|
||||
func (msg MsgEthermint) String() string {
|
||||
return fmt.Sprintf("nonce=%d gasPrice=%d gasLimit=%d recipient=%s amount=%d data=0x%x from=%s",
|
||||
msg.AccountNonce, msg.Price, msg.GasLimit, msg.Recipient, msg.Amount, msg.Payload, msg.From)
|
||||
}
|
||||
|
||||
// Route should return the name of the module
|
||||
func (msg MsgEthermint) Route() string { return RouterKey }
|
||||
|
||||
@@ -166,6 +171,10 @@ func newMsgEthereumTx(
|
||||
return MsgEthereumTx{Data: txData}
|
||||
}
|
||||
|
||||
func (msg MsgEthereumTx) String() string {
|
||||
return msg.Data.String()
|
||||
}
|
||||
|
||||
// Route returns the route value of an MsgEthereumTx.
|
||||
func (msg MsgEthereumTx) Route() string { return RouterKey }
|
||||
|
||||
|
||||
@@ -590,7 +590,7 @@ func (csdb *CommitStateDB) UpdateAccounts() {
|
||||
currAcc := csdb.accountKeeper.GetAccount(csdb.ctx, sdk.AccAddress(addr.Bytes()))
|
||||
emintAcc, ok := currAcc.(*emint.EthAccount)
|
||||
if !ok {
|
||||
return
|
||||
continue
|
||||
}
|
||||
|
||||
balance := csdb.bankKeeper.GetBalance(csdb.ctx, emintAcc.GetAddress(), emint.DenomDefault)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math/big"
|
||||
|
||||
"github.com/cosmos/ethermint/utils"
|
||||
@@ -46,6 +47,16 @@ type encodableTxData struct {
|
||||
Hash *ethcmn.Hash `json:"hash" rlp:"-"`
|
||||
}
|
||||
|
||||
func (td TxData) String() string {
|
||||
if td.Recipient != nil {
|
||||
return fmt.Sprintf("nonce=%d price=%s gasLimit=%d recipient=%s amount=%s data=0x%x v=%s r=%s s=%s",
|
||||
td.AccountNonce, td.Price, td.GasLimit, td.Recipient.Hex(), td.Amount, td.Payload, td.V, td.R, td.S)
|
||||
}
|
||||
|
||||
return fmt.Sprintf("nonce=%d price=%s gasLimit=%d recipient=nil amount=%s data=0x%x v=%s r=%s s=%s",
|
||||
td.AccountNonce, td.Price, td.GasLimit, td.Amount, td.Payload, td.V, td.R, td.S)
|
||||
}
|
||||
|
||||
// MarshalAmino defines custom encoding scheme for TxData
|
||||
func (td TxData) MarshalAmino() ([]byte, error) {
|
||||
gasPrice, err := utils.MarshalBigInt(td.Price)
|
||||
|
||||
Reference in New Issue
Block a user