0g-chain/chaincfg/denoms.go

38 lines
686 B
Go
Raw Normal View History

2024-05-09 11:35:16 +00:00
package chaincfg
import (
sdk "github.com/cosmos/cosmos-sdk/types"
)
const (
StandardDenom = "a0gi"
2024-05-10 06:31:49 +00:00
GasDenom = "ua0gi"
2024-05-09 11:35:16 +00:00
2024-05-10 06:31:49 +00:00
EvmDenom = "neuron"
2024-05-09 11:35:16 +00:00
2024-05-10 06:31:49 +00:00
BondDenom = EvmDenom
2024-05-09 11:35:16 +00:00
2024-05-10 06:31:49 +00:00
GasDenomUnit = 6
2024-05-09 11:35:16 +00:00
2024-05-10 06:31:49 +00:00
EvmDenomUnit = 18
2024-05-09 11:35:16 +00:00
2024-05-10 06:31:49 +00:00
GasDenomConversionMultiplier = 1e12
EvmDenomConversionMultiplier = 1e18
2024-05-09 11:35:16 +00:00
)
2024-05-10 06:31:49 +00:00
// RegisterDenoms registers the base and gas denominations to the SDK.
2024-05-09 11:35:16 +00:00
func RegisterDenoms() {
if err := sdk.RegisterDenom(StandardDenom, sdk.OneDec()); err != nil {
panic(err)
}
2024-05-10 06:31:49 +00:00
if err := sdk.RegisterDenom(GasDenom, sdk.NewDecWithPrec(1, GasDenomUnit)); err != nil {
2024-05-09 11:35:16 +00:00
panic(err)
}
2024-05-10 06:31:49 +00:00
if err := sdk.RegisterDenom(EvmDenom, sdk.NewDecWithPrec(1, EvmDenomUnit)); err != nil {
2024-05-09 11:35:16 +00:00
panic(err)
}
}