2018-10-05 03:41:38 -07:00
|
|
|
package types
|
|
|
|
|
|
|
|
import (
|
2018-12-06 16:22:24 -08:00
|
|
|
"fmt"
|
|
|
|
|
2018-10-05 03:41:38 -07:00
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
|
|
)
|
|
|
|
|
|
|
|
// global fee pool for distribution
|
|
|
|
type FeePool struct {
|
2019-01-16 13:38:05 -08:00
|
|
|
CommunityPool sdk.DecCoins `json:"community_pool"` // pool for community funds yet to be spent
|
2018-10-26 04:42:53 -07:00
|
|
|
}
|
|
|
|
|
2018-10-05 03:41:38 -07:00
|
|
|
// zero fee pool
|
|
|
|
func InitialFeePool() FeePool {
|
|
|
|
return FeePool{
|
2019-01-16 13:38:05 -08:00
|
|
|
CommunityPool: sdk.DecCoins{},
|
2018-10-05 03:41:38 -07:00
|
|
|
}
|
|
|
|
}
|
2018-12-06 16:22:24 -08:00
|
|
|
|
|
|
|
// ValidateGenesis validates the fee pool for a genesis state
|
|
|
|
func (f FeePool) ValidateGenesis() error {
|
|
|
|
if f.CommunityPool.HasNegative() {
|
|
|
|
return fmt.Errorf("negative CommunityPool in distribution fee pool, is %v",
|
|
|
|
f.CommunityPool)
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
2019-01-16 13:38:05 -08:00
|
|
|
|
|
|
|
// outstanding (un-withdrawn) rewards for everyone
|
|
|
|
// excludes the community pool
|
|
|
|
// inexpensive to track, allows simple sanity checks
|
|
|
|
type OutstandingRewards = sdk.DecCoins
|