-
Notifications
You must be signed in to change notification settings - Fork 198
/
minter.go
40 lines (33 loc) · 1023 Bytes
/
minter.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
39
40
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
)
// NewMinter returns a new Minter object with the given epoch
// provisions values.
func NewMinter(epochProvisions sdk.Dec) Minter {
return Minter{
EpochProvisions: epochProvisions,
}
}
// InitialMinter returns an initial Minter object.
func InitialMinter() Minter {
return NewMinter(sdk.NewDec(0))
}
// DefaultInitialMinter returns a default initial Minter object for a new chain.
func DefaultInitialMinter() Minter {
return InitialMinter()
}
// validate minter.
func ValidateMinter(minter Minter) error {
return nil
}
// NextEpochProvisions returns the epoch provisions.
func (m Minter) NextEpochProvisions(params Params) sdk.Dec {
return m.EpochProvisions.Mul(params.ReductionFactor)
}
// EpochProvision returns the provisions for a block based on the epoch
// provisions rate.
func (m Minter) EpochProvision(params Params) sdk.Coin {
provisionAmt := m.EpochProvisions
return sdk.NewCoin(params.MintDenom, provisionAmt.TruncateInt())
}