-
Notifications
You must be signed in to change notification settings - Fork 289
/
abci.go
46 lines (34 loc) · 1.19 KB
/
abci.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
41
42
43
44
45
46
package treasury
import (
"github.com/terra-project/core/x/treasury/internal/types"
sdk "github.com/cosmos/cosmos-sdk/types"
core "github.com/terra-project/core/types"
)
// EndBlocker is called at the end of every block
func EndBlocker(ctx sdk.Context, k Keeper) {
// Check epoch last block
if !core.IsPeriodLastBlock(ctx, core.BlocksPerWeek) {
return
}
// Update luna issuance after finish all works
defer k.RecordEpochInitialIssuance(ctx)
// Compute & Update internal indicators for the current epoch
k.UpdateIndicators(ctx)
// Check probation period
if ctx.BlockHeight() < (core.BlocksPerWeek * k.WindowProbation(ctx)) {
return
}
// Settle seiniorage to oracle & distribution(community-pool) module-account
k.SettleSeigniorage(ctx)
// Update tax-rate and reward-weight of next epoch
taxRate := k.UpdateTaxPolicy(ctx)
rewardWeight := k.UpdateRewardPolicy(ctx)
taxCap := k.UpdateTaxCap(ctx)
ctx.EventManager().EmitEvent(
sdk.NewEvent(types.EventTypePolicyUpdate,
sdk.NewAttribute(types.AttributeKeyTaxRate, taxRate.String()),
sdk.NewAttribute(types.AttributeKeyRewardWeight, rewardWeight.String()),
sdk.NewAttribute(types.AttributeKeyTaxCap, taxCap.String()),
),
)
}