-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[LeverageLp]: Update liquidation algorithm (#646)
* optimise liquidation * store sorted key with consistent length * changes * consider old debt * del * add sorted list test * add interest hook * stablestake hooks * fix * remove * add collateral, close, add lev tests * fix * add hook in app.go * add hook function test * add migration * liquidate
- Loading branch information
1 parent
d3a457a
commit f44b203
Showing
21 changed files
with
442 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package keeper | ||
|
||
import ( | ||
"cosmossdk.io/math" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
stablestaketypes "github.com/elys-network/elys/x/stablestake/types" | ||
) | ||
|
||
func (k Keeper) AfterUpdateInterestStacked(ctx sdk.Context, address string, old sdk.Int, new sdk.Int) error { | ||
k.SetSortedLiquidation(ctx, address, old, new) | ||
return nil | ||
} | ||
|
||
// Hooks wrapper struct for incentive keeper | ||
type StableStakeHooks struct { | ||
k Keeper | ||
} | ||
|
||
var _ stablestaketypes.StableStakeHooks = StableStakeHooks{} | ||
|
||
// Return the wrapper struct | ||
func (k Keeper) StableStakeHooks() StableStakeHooks { | ||
return StableStakeHooks{k} | ||
} | ||
|
||
func (h StableStakeHooks) AfterBond(ctx sdk.Context, sender string, shareAmount math.Int) error { | ||
return nil | ||
} | ||
|
||
func (h StableStakeHooks) AfterUnbond(ctx sdk.Context, sender string, shareAmount math.Int) error { | ||
return nil | ||
} | ||
|
||
func (h StableStakeHooks) AfterUpdateInterestStacked(ctx sdk.Context, address string, old sdk.Int, new sdk.Int) error { | ||
h.k.AfterUpdateInterestStacked(ctx, address, old, new) | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.