forked from cerc-io/laconicd-deprecated
29d3abcf09
* Reuse cosmos-sdk client library to create keyring Extracted from https://github.com/evmos/ethermint/pull/1168 Cleanup cmd code for easier to migration to cosmos-sdk 0.46 * Update cosmos-sdk v0.46 prepare for implementing cosmos-sdk feemarket and tx prioritization changelog refactor cmd use sdkmath fix lint fix unit tests fix unit test genesis fix unit tests fix unit test env setup fix unit tests fix unit tests register PrivKey impl fix extension options fix lint fix unit tests make HandlerOption.Validate private gofumpt fix msg response decoding fix sim test bump cosmos-sdk version fix sim test sdk 46 fix unit test fix unit tests update ibc-go
49 lines
1.8 KiB
Go
49 lines
1.8 KiB
Go
package types
|
|
|
|
import (
|
|
"math/big"
|
|
|
|
sdkmath "cosmossdk.io/math"
|
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
)
|
|
|
|
const (
|
|
// AttoPhoton defines the default coin denomination used in Ethermint in:
|
|
//
|
|
// - Staking parameters: denomination used as stake in the dPoS chain
|
|
// - Mint parameters: denomination minted due to fee distribution rewards
|
|
// - Governance parameters: denomination used for spam prevention in proposal deposits
|
|
// - Crisis parameters: constant fee denomination used for spam prevention to check broken invariant
|
|
// - EVM parameters: denomination used for running EVM state transitions in Ethermint.
|
|
AttoPhoton string = "aphoton"
|
|
|
|
// BaseDenomUnit defines the base denomination unit for Photons.
|
|
// 1 photon = 1x10^{BaseDenomUnit} aphoton
|
|
BaseDenomUnit = 18
|
|
|
|
// DefaultGasPrice is default gas price for evm transactions
|
|
DefaultGasPrice = 20
|
|
)
|
|
|
|
// PowerReduction defines the default power reduction value for staking
|
|
var PowerReduction = sdkmath.NewIntFromBigInt(new(big.Int).Exp(big.NewInt(10), big.NewInt(BaseDenomUnit), nil))
|
|
|
|
// NewPhotonCoin is a utility function that returns an "aphoton" coin with the given sdkmath.Int amount.
|
|
// The function will panic if the provided amount is negative.
|
|
func NewPhotonCoin(amount sdkmath.Int) sdk.Coin {
|
|
return sdk.NewCoin(AttoPhoton, amount)
|
|
}
|
|
|
|
// NewPhotonDecCoin is a utility function that returns an "aphoton" decimal coin with the given sdkmath.Int amount.
|
|
// The function will panic if the provided amount is negative.
|
|
func NewPhotonDecCoin(amount sdkmath.Int) sdk.DecCoin {
|
|
return sdk.NewDecCoin(AttoPhoton, amount)
|
|
}
|
|
|
|
// NewPhotonCoinInt64 is a utility function that returns an "aphoton" coin with the given int64 amount.
|
|
// The function will panic if the provided amount is negative.
|
|
func NewPhotonCoinInt64(amount int64) sdk.Coin {
|
|
return sdk.NewInt64Coin(AttoPhoton, amount)
|
|
}
|