0g-chain/x/earn/keeper/hooks.go
Derrick Lee ded692d2f4
Add savings strategy (#1290)
* 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
2022-09-12 10:50:35 -07:00

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)
}
}