github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/app/types/coin.go (about)

     1  package types
     2  
     3  import (
     4  	sdk "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/types"
     5  )
     6  
     7  const (
     8  	// NativeToken defines the default coin denomination used in fbchainin:
     9  	//
    10  	// - Staking parameters: denomination used as stake in the dPoS chain
    11  	// - Mint parameters: denomination minted due to fee distribution rewards
    12  	// - Governance parameters: denomination used for spam prevention in proposal deposits
    13  	// - Crisis parameters: constant fee denomination used for spam prevention to check broken invariant
    14  	// - EVM parameters: denomination used for running EVM state transitions in FBChain.
    15  	NativeToken string = sdk.DefaultBondDenom
    16  
    17  	// BaseDenomUnit defines the base denomination unit for Photons.
    18  	// 1 photon = 1x10^{BaseDenomUnit} aphoton
    19  	BaseDenomUnit = 18
    20  )
    21  
    22  // NewPhotonCoin is a utility function that returns an "aphoton" coin with the given sdk.Int amount.
    23  // The function will panic if the provided amount is negative.
    24  func NewPhotonCoin(amount sdk.Int) sdk.Coin {
    25  	return sdk.NewCoin(NativeToken, amount)
    26  }
    27  
    28  // NewPhotonDecCoin is a utility function that returns an "aphoton" decimal coin with the given sdk.Int amount.
    29  // The function will panic if the provided amount is negative.
    30  func NewPhotonDecCoin(amount sdk.Int) sdk.SysCoin {
    31  	return sdk.NewDecCoin(NativeToken, amount)
    32  }
    33  
    34  // NewPhotonCoinInt64 is a utility function that returns an "aphoton" coin with the given int64 amount.
    35  // The function will panic if the provided amount is negative.
    36  func NewPhotonCoinInt64(amount int64) sdk.Coin {
    37  	return sdk.NewInt64Coin(NativeToken, amount)
    38  }