mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-26 08:15:19 +00:00
f7a73c9245
* update to borrow interest factor * add supply interest factor to accrue interest * supply interest factor keeper methods * fix potential bug with user borrow indexing * sync supply interest on deposit/withdraw * separate withdraw/deposit * relocate interest sync methods * update comment * simplify supply interest statement * check truncated int not zero * add .sub(storedAmount) back * add store key suppliedcoins * increment/decrement supplied coins * update withdraw with new accounting * update withdraw test * catch repay edge case * unit tests * TestSupplyInterest scaffolding * test notes * temp: interest test * example test * changes, test checks more state * fix: calculate supply interest directly * fix: catch divide by zero * add state checks back into interest test * add snapshot test cases * test owed supplied interest paid at correct ratio * test user supply syncs user's borrow interest * remove print statements and clean up * refactor indented logic * test supply/borrow multiple coins * update decoder test Co-authored-by: karzak <kjydavis3@gmail.com>
142 lines
7.4 KiB
Go
142 lines
7.4 KiB
Go
package hard
|
|
|
|
// DO NOT EDIT - generated by aliasgen tool (github.com/rhuairahrighairidh/aliasgen)
|
|
|
|
import (
|
|
"github.com/kava-labs/kava/x/hard/keeper"
|
|
"github.com/kava-labs/kava/x/hard/types"
|
|
)
|
|
|
|
const (
|
|
BeginningOfMonth = keeper.BeginningOfMonth
|
|
MidMonth = keeper.MidMonth
|
|
PaymentHour = keeper.PaymentHour
|
|
AttributeKeyBlockHeight = types.AttributeKeyBlockHeight
|
|
AttributeKeyClaimAmount = types.AttributeKeyClaimAmount
|
|
AttributeKeyClaimHolder = types.AttributeKeyClaimHolder
|
|
AttributeKeyClaimMultiplier = types.AttributeKeyClaimMultiplier
|
|
AttributeKeyClaimType = types.AttributeKeyClaimType
|
|
AttributeKeyDeposit = types.AttributeKeyDeposit
|
|
AttributeKeyDepositDenom = types.AttributeKeyDepositDenom
|
|
AttributeKeyDepositor = types.AttributeKeyDepositor
|
|
AttributeKeyRewardsDistribution = types.AttributeKeyRewardsDistribution
|
|
AttributeValueCategory = types.AttributeValueCategory
|
|
DefaultParamspace = types.DefaultParamspace
|
|
DelegatorAccount = types.DelegatorAccount
|
|
EventTypeClaimHardReward = types.EventTypeClaimHardReward
|
|
EventTypeDeleteHardDeposit = types.EventTypeDeleteHardDeposit
|
|
EventTypeHardDelegatorDistribution = types.EventTypeHardDelegatorDistribution
|
|
EventTypeHardDeposit = types.EventTypeHardDeposit
|
|
EventTypeHardLPDistribution = types.EventTypeHardLPDistribution
|
|
EventTypeHardWithdrawal = types.EventTypeHardWithdrawal
|
|
LP = types.LP
|
|
LPAccount = types.LPAccount
|
|
LiquidatorAccount = types.LiquidatorAccount
|
|
Large = types.Large
|
|
Medium = types.Medium
|
|
ModuleAccountName = types.ModuleAccountName
|
|
ModuleName = types.ModuleName
|
|
QuerierRoute = types.QuerierRoute
|
|
QueryGetClaims = types.QueryGetClaims
|
|
QueryGetDeposits = types.QueryGetDeposits
|
|
QueryGetModuleAccounts = types.QueryGetModuleAccounts
|
|
QueryGetParams = types.QueryGetParams
|
|
RouterKey = types.RouterKey
|
|
Small = types.Small
|
|
Stake = types.Stake
|
|
StoreKey = types.StoreKey
|
|
)
|
|
|
|
var (
|
|
// function aliases
|
|
NewKeeper = keeper.NewKeeper
|
|
NewQuerier = keeper.NewQuerier
|
|
CalculateUtilizationRatio = keeper.CalculateUtilizationRatio
|
|
CalculateBorrowRate = keeper.CalculateBorrowRate
|
|
CalculateBorrowInterestFactor = keeper.CalculateBorrowInterestFactor
|
|
CalculateSupplyInterestFactor = keeper.CalculateSupplyInterestFactor
|
|
APYToSPY = keeper.APYToSPY
|
|
ClaimKey = types.ClaimKey
|
|
DefaultGenesisState = types.DefaultGenesisState
|
|
DefaultParams = types.DefaultParams
|
|
DepositTypeIteratorKey = types.DepositTypeIteratorKey
|
|
GetTotalVestingPeriodLength = types.GetTotalVestingPeriodLength
|
|
NewClaim = types.NewClaim
|
|
NewDelegatorDistributionSchedule = types.NewDelegatorDistributionSchedule
|
|
NewDeposit = types.NewDeposit
|
|
NewDistributionSchedule = types.NewDistributionSchedule
|
|
NewGenesisState = types.NewGenesisState
|
|
NewMsgClaimReward = types.NewMsgClaimReward
|
|
NewMsgDeposit = types.NewMsgDeposit
|
|
NewMsgWithdraw = types.NewMsgWithdraw
|
|
NewMultiplier = types.NewMultiplier
|
|
NewParams = types.NewParams
|
|
NewPeriod = types.NewPeriod
|
|
NewQueryAccountParams = types.NewQueryAccountParams
|
|
NewQueryClaimParams = types.NewQueryClaimParams
|
|
NewQueryDepositParams = types.NewQueryDepositParams
|
|
ParamKeyTable = types.ParamKeyTable
|
|
RegisterCodec = types.RegisterCodec
|
|
|
|
// variable aliases
|
|
BorrowsKeyPrefix = types.BorrowsKeyPrefix
|
|
ClaimsKeyPrefix = types.ClaimsKeyPrefix
|
|
DefaultActive = types.DefaultActive
|
|
DefaultDelegatorSchedules = types.DefaultDelegatorSchedules
|
|
DefaultDistributionTimes = types.DefaultDistributionTimes
|
|
DefaultGovSchedules = types.DefaultGovSchedules
|
|
DefaultLPSchedules = types.DefaultLPSchedules
|
|
DefaultPreviousBlockTime = types.DefaultPreviousBlockTime
|
|
ClaimTypesClaimQuery = types.ClaimTypesClaimQuery
|
|
DepositsKeyPrefix = types.DepositsKeyPrefix
|
|
ErrAccountNotFound = types.ErrAccountNotFound
|
|
ErrClaimExpired = types.ErrClaimExpired
|
|
ErrClaimNotFound = types.ErrClaimNotFound
|
|
ErrDepositNotFound = types.ErrDepositNotFound
|
|
ErrGovScheduleNotFound = types.ErrGovScheduleNotFound
|
|
ErrInsufficientModAccountBalance = types.ErrInsufficientModAccountBalance
|
|
ErrInvaliWithdrawAmount = types.ErrInvalidWithdrawAmount
|
|
ErrInvalidAccountType = types.ErrInvalidAccountType
|
|
ErrInvalidDepositDenom = types.ErrInvalidDepositDenom
|
|
ErrInvalidClaimType = types.ErrInvalidClaimType
|
|
ErrInvalidMultiplier = types.ErrInvalidMultiplier
|
|
ErrLPScheduleNotFound = types.ErrLPScheduleNotFound
|
|
ErrZeroClaim = types.ErrZeroClaim
|
|
GovDenom = types.GovDenom
|
|
KeyActive = types.KeyActive
|
|
KeyDelegatorSchedule = types.KeyDelegatorSchedule
|
|
KeyLPSchedules = types.KeyLPSchedules
|
|
ModuleCdc = types.ModuleCdc
|
|
PreviousBlockTimeKey = types.PreviousBlockTimeKey
|
|
PreviousDelegationDistributionKey = types.PreviousDelegationDistributionKey
|
|
)
|
|
|
|
type (
|
|
Keeper = keeper.Keeper
|
|
AccountKeeper = types.AccountKeeper
|
|
Borrow = types.Borrow
|
|
MoneyMarket = types.MoneyMarket
|
|
MoneyMarkets = types.MoneyMarkets
|
|
DelegatorDistributionSchedule = types.DelegatorDistributionSchedule
|
|
DelegatorDistributionSchedules = types.DelegatorDistributionSchedules
|
|
Deposit = types.Deposit
|
|
ClaimType = types.ClaimType
|
|
DistributionSchedule = types.DistributionSchedule
|
|
DistributionSchedules = types.DistributionSchedules
|
|
GenesisDistributionTime = types.GenesisDistributionTime
|
|
GenesisDistributionTimes = types.GenesisDistributionTimes
|
|
GenesisState = types.GenesisState
|
|
MsgClaimReward = types.MsgClaimReward
|
|
MsgDeposit = types.MsgDeposit
|
|
MsgWithdraw = types.MsgWithdraw
|
|
Multiplier = types.Multiplier
|
|
MultiplierName = types.MultiplierName
|
|
Multipliers = types.Multipliers
|
|
Params = types.Params
|
|
QueryAccountParams = types.QueryAccountParams
|
|
QueryClaimParams = types.QueryClaimParams
|
|
QueryDepositParams = types.QueryDepositParams
|
|
StakingKeeper = types.StakingKeeper
|
|
SupplyKeeper = types.SupplyKeeper
|
|
)
|