-
Notifications
You must be signed in to change notification settings - Fork 15
/
coin.go
38 lines (32 loc) · 1.52 KB
/
coin.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package types
import (
sdk "github.com/okx/okbchain/libs/cosmos-sdk/types"
)
const (
// NativeToken defines the default coin denomination used in OKBChain 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 OKBChain.
NativeToken string = sdk.DefaultBondDenom
// BaseDenomUnit defines the base denomination unit for Photons.
// 1 photon = 1x10^{BaseDenomUnit} aphoton
BaseDenomUnit = 18
)
// NewPhotonCoin is a utility function that returns an "aphoton" coin with the given sdk.Int amount.
// The function will panic if the provided amount is negative.
func NewPhotonCoin(amount sdk.Int) sdk.Coin {
return sdk.NewCoin(NativeToken, amount)
}
// NewPhotonDecCoin is a utility function that returns an "aphoton" decimal coin with the given sdk.Int amount.
// The function will panic if the provided amount is negative.
func NewPhotonDecCoin(amount sdk.Int) sdk.SysCoin {
return sdk.NewDecCoin(NativeToken, 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(NativeToken, amount)
}