/
params.go
35 lines (30 loc) · 976 Bytes
/
params.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
package types
import (
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/furyanprotocol/v4-chain/protocol/lib"
)
// DefaultParams returns a default set of parameters
func DefaultParams() Params {
return Params{
// Corresponds to module account address: furya16wrau2x4tsg033xfrrdpae6kxfn9kyuerr5jjp
TreasuryAccount: TreasuryAccountName,
Denom: lib.DefaultBaseDenom,
DenomExponent: lib.BaseDenomExponent,
MarketId: 1,
FeeMultiplierPpm: 990_000, // 0.99
}
}
// Validate validates the set of params
func (p Params) Validate() error {
if p.TreasuryAccount == "" {
return errorsmod.Wrap(ErrInvalidTreasuryAccount, "treasury account cannot have empty name")
}
if p.FeeMultiplierPpm > lib.OneMillion {
return errorsmod.Wrap(ErrInvalidFeeMultiplierPpm, "FeeMultiplierPpm cannot be greater than 1_000_000 (100%)")
}
if err := sdk.ValidateDenom(p.Denom); err != nil {
return err
}
return nil
}