github.com/InjectiveLabs/sdk-go@v1.53.0/chain/types/coin.go (about)

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