Move default denomination to account type (for now)

This commit is contained in:
Aleksandr Bezobchuk 2018-10-24 09:46:26 -04:00
parent ad97634c24
commit 7537453c83

View File

@ -5,13 +5,18 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/ethermint/x/bank"
ethcmn "github.com/ethereum/go-ethereum/common" ethcmn "github.com/ethereum/go-ethereum/common"
) )
var _ auth.Account = (*Account)(nil) var _ auth.Account = (*Account)(nil)
const (
// DenomDefault defines the single coin type/denomination supported in
// Ethermint.
DenomDefault = "Photon"
)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Main Ethermint account // Main Ethermint account
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@ -37,12 +42,12 @@ func ProtoBaseAccount() auth.Account {
// Balance returns the balance of an account. // Balance returns the balance of an account.
func (acc Account) Balance() sdk.Int { func (acc Account) Balance() sdk.Int {
return acc.GetCoins().AmountOf(bank.DenomEthereum) return acc.GetCoins().AmountOf(DenomDefault)
} }
// SetBalance sets an account's balance. // SetBalance sets an account's balance.
func (acc Account) SetBalance(amt sdk.Int) { func (acc Account) SetBalance(amt sdk.Int) {
acc.SetCoins(sdk.Coins{sdk.NewCoin(bank.DenomEthereum, amt)}) acc.SetCoins(sdk.Coins{sdk.NewCoin(DenomDefault, amt)})
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------