mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-11-14 03:55:19 +00:00
ded692d2f4
* Add basic savings strategy Supports ukava * Use clearer error message for ErrInvalidVaultStrategy * Add invariants * Separate specific vault/all vaults query, update depositor inconsistencies * Update swagger * Use single bkava AllowedVault for all bkava variants * Do not use allowedVault.Denom for value * Fix vault balance query * Update query to list bkava vaults * Add vaults query doc * Update grpc query test with no supply * Add earn hooks * Handle errors * Update outdated doc comments, make getAllowedVault_Raw private * Fix outdated comments, lints * Fix comment maths * Use AccAddressFromBech32 to validate message addresses
35 lines
766 B
Go
35 lines
766 B
Go
package keeper
|
|
|
|
import (
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
|
|
"github.com/kava-labs/kava/x/earn/types"
|
|
)
|
|
|
|
// Implements EarnHooks interface
|
|
var _ types.EarnHooks = Keeper{}
|
|
|
|
// AfterVaultDepositCreated - call hook if registered
|
|
func (k Keeper) AfterVaultDepositCreated(
|
|
ctx sdk.Context,
|
|
vaultDenom string,
|
|
depositor sdk.AccAddress,
|
|
sharesOwned sdk.Dec,
|
|
) {
|
|
if k.hooks != nil {
|
|
k.hooks.AfterVaultDepositCreated(ctx, vaultDenom, depositor, sharesOwned)
|
|
}
|
|
}
|
|
|
|
// BeforeVaultDepositModified - call hook if registered
|
|
func (k Keeper) BeforeVaultDepositModified(
|
|
ctx sdk.Context,
|
|
vaultDenom string,
|
|
depositor sdk.AccAddress,
|
|
sharesOwned sdk.Dec,
|
|
) {
|
|
if k.hooks != nil {
|
|
k.hooks.BeforeVaultDepositModified(ctx, vaultDenom, depositor, sharesOwned)
|
|
}
|
|
}
|