-
Notifications
You must be signed in to change notification settings - Fork 589
/
abci.go
30 lines (23 loc) · 1.07 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
package lockup
import (
abci "github.com/cometbft/cometbft/abci/types"
"github.com/osmosis-labs/osmosis/v25/x/lockup/keeper"
sdk "github.com/cosmos/cosmos-sdk/types"
)
// BeginBlocker is called on every block.
func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k keeper.Keeper) {
}
// Called every block to automatically unlock matured locks.
func EndBlocker(ctx sdk.Context, k keeper.Keeper) []abci.ValidatorUpdate {
if ctx.BlockHeight()%30 == 0 {
// TODO: Change this logic to "know" when the next unbonding time is, and only unlock at that time.
// At each unbond, do an iterate to find the next unbonding time and wait until then.
// delete synthetic locks matured before lockup deletion
k.DeleteAllMaturedSyntheticLocks(ctx)
// withdraw and delete locks
k.WithdrawAllMaturedLocks(ctx)
}
return []abci.ValidatorUpdate{}
}
// TODO: add invariant that no native lockup existent synthetic lockup exists by calling GetAllSyntheticLockups
// TODO: if superfluid does not delete synthetic lockup before native lockup deletion, it won't be able to be deleted