types

package
v0.0.0-...-7718fd7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AttoBit defines the default coin denomination used in BitNetwork 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
	AttoBit = "abit"

	// DisplayDenom defines the denomination displayed to users in client applications.
	DisplayDenom = "bit"
	// BaseDenom defines to the default denomination used in BitNetwork (staking, EVN, governance, etc)
	BaseDenom = AttoBit

	// BaseDenomUnit defines the base denomination unit for Bits.
	// 1 bit = 1x10^{BaseDenomUnit} abit
	BaseDenomUnit = 18
)

Variables

View Source
var PowerReduction = sdk.NewIntFromBigInt(new(big.Int).Exp(big.NewInt(10), big.NewInt(BaseDenomUnit+2), nil))

PowerReduction defines the default power reduction value for staking (BaseDenomUnit - 2) indicates that staking tokens:power = 1:100, which means we consider 0.01 BaseDenom as 1 power

Functions

func GetAddressFromBech32

func GetAddressFromBech32(address string) (sdk.AccAddress, error)

GetAddressFromBech32 returns the sdk.Account address of given address, while also changing bech32 human readable prefix (HRP) to the value set on the global sdk.Config (eg: `bitnetwork`). The function fails if the provided bech32 address is invalid.

func IsSupportedKey

func IsSupportedKey(pubkey cryptotypes.PubKey) bool

IsSupportedKey returns true if the pubkey type is supported by the chain (i.e eth_secp256k1, amino multisig, ed25519). NOTE: Nested multisigs are not supported.

func NewBitCoin

func NewBitCoin(amount sdk.Int) sdk.Coin

NewBitCoin is a utility function that returns an "abit" coin with the given sdk.Int amount. The function will panic if the provided amount is negative.

func NewBitCoinInt64

func NewBitCoinInt64(amount int64) sdk.Coin

NewBitCoinInt64 is a utility function that returns an "abit" coin with the given int64 amount. The function will panic if the provided amount is negative.

func NewBitDecCoin

func NewBitDecCoin(amount sdk.Int) sdk.DecCoin

NewBitDecCoin is a utility function that returns an "abit" decimal coin with the given sdk.Int amount. The function will panic if the provided amount is negative.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL