/
types.go
38 lines (30 loc) · 893 Bytes
/
types.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 (
"math/big"
sdkmath "cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/tx"
"github.com/bnb-chain/greenfield/sdk/keys"
)
const (
Denom = "BNB"
// DecimalBNB defines number of BNB decimal places
DecimalBNB = 18
// DecimalGwei defines number of gweiBNB decimal places
DecimalGwei = 9
)
type TxOption struct {
Mode *tx.BroadcastMode
NoSimulate bool
GasLimit uint64
FeeAmount sdk.Coins
Nonce uint64
FeePayer sdk.AccAddress
FeeGranter sdk.AccAddress
Tip *tx.Tip
Memo string
OverrideKeyManager *keys.KeyManager
}
func NewIntFromInt64WithDecimal(amount int64, decimal int64) sdkmath.Int {
return sdk.NewInt(amount).Mul(sdk.NewIntFromBigInt(new(big.Int).Exp(big.NewInt(10), big.NewInt(decimal), nil)))
}