Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lend final #507

Merged
merged 12 commits into from
Oct 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ import (
"github.com/comdex-official/comdex/x/esm"
esmkeeper "github.com/comdex-official/comdex/x/esm/keeper"
esmtypes "github.com/comdex-official/comdex/x/esm/types"
rewardsclient "github.com/comdex-official/comdex/x/rewards/client"

"github.com/comdex-official/comdex/x/lend"
lendclient "github.com/comdex-official/comdex/x/lend/client"
Expand Down Expand Up @@ -210,6 +211,7 @@ func GetGovProposalHandlers() []govclient.ProposalHandler {
}
proposalHandlers = append(proposalHandlers, wasmclient.ProposalHandlers...)
proposalHandlers = append(proposalHandlers, assetclient.AddAssetsHandler...)
proposalHandlers = append(proposalHandlers, rewardsclient.AddRewardsHandler...)
proposalHandlers = append(proposalHandlers, liquidityclient.LiquidityProposalHandler...)
return proposalHandlers
}
Expand Down Expand Up @@ -764,6 +766,7 @@ func New(
AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.DistrKeeper)).
AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)).
AddRoute(assettypes.RouterKey, asset.NewUpdateAssetProposalHandler(app.AssetKeeper)).
AddRoute(rewardstypes.RouterKey, rewards.NewAddRewardsProposalHandler(app.Rewardskeeper)).
AddRoute(lendtypes.RouterKey, lend.NewLendHandler(app.LendKeeper)).
AddRoute(bandoraclemoduletypes.RouterKey, bandoraclemodule.NewFetchPriceHandler(app.BandoracleKeeper)).
AddRoute(ibchost.RouterKey, ibcclient.NewClientProposalHandler(app.IbcKeeper.ClientKeeper)).
Expand Down
2 changes: 1 addition & 1 deletion app/upgrades/testnet/v1_0_0/constants.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v1_0_0
package v1_0_0 //nolint:revive,stylecheck

const (
UpgradeName = "v1.0.0"
Expand Down
2 changes: 1 addition & 1 deletion app/upgrades/testnet/v1_0_0/upgrades.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v1_0_0
package v1_0_0 //nolint:revive,stylecheck

import (
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down
2 changes: 1 addition & 1 deletion app/upgrades/testnet/v2_0_0/constants.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v2_0_0
package v2_0_0 //nolint:revive,stylecheck

const (
UpgradeName = "v2.0.0"
Expand Down
2 changes: 1 addition & 1 deletion app/upgrades/testnet/v2_0_0/upgrades.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v2_0_0
package v2_0_0 //nolint:revive,stylecheck

import (
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down
2 changes: 1 addition & 1 deletion app/upgrades/testnet/v3_0_0/contstants.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v3_0_0
package v3_0_0 //nolint:revive,stylecheck

const (
UpgradeName = "v3.0.0"
Expand Down
2 changes: 1 addition & 1 deletion app/upgrades/testnet/v3_0_0/upgrades.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v3_0_0
package v3_0_0 //nolint:revive,stylecheck

import (
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down
2 changes: 1 addition & 1 deletion app/upgrades/testnet/v4_0_0/constants.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v4_0_0
package v4_0_0 //nolint:revive,stylecheck

const (
UpgradeName = "v4.0.0"
Expand Down
2 changes: 1 addition & 1 deletion app/upgrades/testnet/v4_0_0/upgrades.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package v4_0_0
package v4_0_0 //nolint:revive,stylecheck

import (
auctionkeeper "github.com/comdex-official/comdex/x/auction/keeper"
Expand Down
3 changes: 1 addition & 2 deletions cmd/comdex/genaccounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/cosmos/cosmos-sdk/server"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -40,7 +39,7 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
depCdc := clientCtx.Codec
cdc := depCdc.(codec.ProtoCodecMarshaler)
cdc := depCdc

serverCtx := server.GetServerContextFromCmd(cmd)
config := serverCtx.Config
Expand Down
4 changes: 3 additions & 1 deletion cmd/comdex/testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
"github.com/cosmos/cosmos-sdk/server"
serverconfig "github.com/cosmos/cosmos-sdk/server/config"
"github.com/cosmos/cosmos-sdk/testutil"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
Expand All @@ -37,6 +38,7 @@ var (
flagOutputDir = "output-dir"
flagNodeDaemonHome = "node-daemon-home"
flagStartingIPAddress = "starting-ip-address"
emptyMnemonic = ""
)

func testnetCmd(mbm module.BasicManager, genBalIterator banktypes.GenesisBalancesIterator) *cobra.Command {
Expand Down Expand Up @@ -170,7 +172,7 @@ func InitTestnet(
return err
}

addr, secret, err := server.GenerateSaveCoinKey(kb, nodeDirName, true, algo)
addr, secret, err := testutil.GenerateSaveCoinKey(kb, nodeDirName, emptyMnemonic, true, algo)
if err != nil {
_ = os.RemoveAll(outputDir)
return err
Expand Down
2 changes: 1 addition & 1 deletion docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (s *s) ReadDoc() string {
},
"escape": func(v interface{}) string {
// escape tabs
str := strings.Replace(v.(string), "\t", "\\t", -1)
str := strings.Replace(v.(string), "\t", "\\t", -1) //nolint:forcetypeassert
// replace " with \", and if that results in \\", replace that with \\\"
str = strings.Replace(str, "\"", "\\\"", -1)
return strings.Replace(str, "\\\\\"", "\\\\\\\"", -1)
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.13.0
github.com/spf13/cast v1.5.0
github.com/spf13/cobra v1.5.0
github.com/spf13/cobra v1.6.0
github.com/stretchr/testify v1.8.0
github.com/swaggo/swag v1.8.6
github.com/tendermint/tendermint v0.34.21
Expand Down Expand Up @@ -151,7 +151,7 @@ require (
github.com/hdevalence/ed25519consensus v0.0.0-20210204194344-59a8610d2b87 // indirect
github.com/hexops/gotextdiff v1.0.3 // indirect
github.com/improbable-eng/grpc-web v0.14.1 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/jgautheron/goconst v1.5.1 // indirect
github.com/jingyugao/rowserrcheck v1.1.1 // indirect
github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af // indirect
Expand Down
7 changes: 4 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -638,8 +638,9 @@ github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:
github.com/improbable-eng/grpc-web v0.14.0/go.mod h1:6hRR09jOEG81ADP5wCQju1z71g6OL4eEvELdran/3cs=
github.com/improbable-eng/grpc-web v0.14.1 h1:NrN4PY71A6tAz2sKDvC5JCauENWp0ykG8Oq1H3cpFvw=
github.com/improbable-eng/grpc-web v0.14.1/go.mod h1:zEjGHa8DAlkoOXmswrNvhUGEYQA9UI7DhrGeHR1DMGU=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc=
github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/influxdata/influxdb v1.2.3-0.20180221223340-01288bdb0883/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY=
github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc=
Expand Down Expand Up @@ -1059,8 +1060,8 @@ github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tL
github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE=
github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI=
github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo=
github.com/spf13/cobra v1.5.0 h1:X+jTBEBqF0bHN+9cSMgmfuvv2VHJ9ezmFNf9Y/XstYU=
github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM=
github.com/spf13/cobra v1.6.0 h1:42a0n6jwCot1pUmomAp4T7DeMD+20LFv4Q54pxLf2LI=
github.com/spf13/cobra v1.6.0/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY=
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk=
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
Expand Down
17 changes: 17 additions & 0 deletions proto/comdex/rewards/v1beta1/gov.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
syntax = "proto3";
package comdex.rewards.v1beta1;

import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";
import "comdex/rewards/v1beta1/rewards.proto";


option go_package = "github.com/comdex-official/comdex/x/rewards/types";
option (gogoproto.equal_all) = false;
option (gogoproto.goproto_getters_all) = false;

message AddLendExternalRewardsProposal {
string title = 1 [(gogoproto.moretags) = "yaml:\"title\""];
string description = 2 [(gogoproto.moretags) = "yaml:\"description\""];
Lend_external_rewards lend_external_rewards = 3 [(gogoproto.nullable) = false];
}
16 changes: 16 additions & 0 deletions proto/comdex/rewards/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ service Query {
rpc QueryWhitelistedAppIdsVault(QueryWhitelistedAppIdsVaultRequest) returns (QueryWhitelistedAppIdsVaultResponse) {
option (google.api.http).get = "/comdex/rewards/v1beta1/whitelisted_appids_Vault";
}
rpc QueryExternalRewardLends(QueryExternalRewardLendsRequest) returns (QueryExternalRewardLendsResponse) {
option (google.api.http).get = "/comdex/rewards/v1beta1/lend_external_rewards";
}
}


Expand Down Expand Up @@ -173,6 +176,19 @@ message QueryWhitelistedAppIdsVaultResponse {
repeated uint64 whitelistedAppIdsVault = 1
[(gogoproto.moretags) = "yaml:\"whitelistedAppIdsVault\""];

cosmos.base.query.v1beta1.PageResponse pagination = 2
[(gogoproto.moretags) = "yaml:\"pagination\""];
}

message QueryExternalRewardLendsRequest{
cosmos.base.query.v1beta1.PageRequest pagination = 1
[(gogoproto.moretags) = "yaml:\"pagination\""];
}

message QueryExternalRewardLendsResponse {
repeated Lend_external_rewards lend_external_rewards = 1
[(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"vault_external_rewards\""];

cosmos.base.query.v1beta1.PageResponse pagination = 2
[(gogoproto.moretags) = "yaml:\"pagination\""];
}
2 changes: 1 addition & 1 deletion proto/comdex/rewards/v1beta1/rewards.proto
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ message Lend_external_rewards{
uint64 app_mapping_id = 2 [
(gogoproto.moretags) = "yaml:\"app_mapping_id\""
];
repeated Rewards_asset_pool_data rewards_asset_pool_data = 3 [
Rewards_asset_pool_data rewards_asset_pool_data = 3 [
(gogoproto.moretags) = "yaml:\"rewards_asset_pool_data\""
];
cosmos.base.v1beta1.Coin total_rewards = 4 [
Expand Down
8 changes: 4 additions & 4 deletions x/asset/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (

func InitGenesis(ctx sdk.Context, k keeper.Keeper, state *types.GenesisState) {
var (
assetID uint64 = 0
pairID uint64 = 0
appID uint64 = 0
extendedPairID uint64 = 0
assetID uint64
pairID uint64
appID uint64
extendedPairID uint64
)

k.SetParams(ctx, state.Params)
Expand Down
1 change: 0 additions & 1 deletion x/auction/expected/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ type LendKeeper interface {
VerifyCollateralizationRatio(ctx sdk.Context, amountIn sdk.Int, assetIn assettypes.Asset, amountOut sdk.Int, assetOut assettypes.Asset, liquidationThreshold sdk.Dec) error
CalculateCollateralizationRatio(ctx sdk.Context, amountIn sdk.Int, assetIn assettypes.Asset, amountOut sdk.Int, assetOut assettypes.Asset) (sdk.Dec, error)
GetLend(ctx sdk.Context, id uint64) (lend lendtypes.LendAsset, found bool)
DeleteBorrow(ctx sdk.Context, id uint64)
GetPool(ctx sdk.Context, id uint64) (pool lendtypes.Pool, found bool)
GetAddAuctionParamsData(ctx sdk.Context, appID uint64) (auctionParams lendtypes.AuctionParams, found bool)
ModuleBalance(ctx sdk.Context, moduleName string, denom string) sdk.Int
Expand Down
4 changes: 0 additions & 4 deletions x/auction/keeper/alias.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,6 @@ func (k Keeper) GetLend(ctx sdk.Context, id uint64) (lend lendtypes.LendAsset, f
return k.lend.GetLend(ctx, id)
}

func (k Keeper) DeleteBorrow(ctx sdk.Context, id uint64) {
k.lend.DeleteBorrow(ctx, id)
}

func (k Keeper) GetPool(ctx sdk.Context, id uint64) (pool lendtypes.Pool, found bool) {
return k.lend.GetPool(ctx, id)
}
Expand Down
3 changes: 3 additions & 0 deletions x/auction/keeper/dutch_lend.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,9 @@ func (k Keeper) PlaceLendDutchAuctionBid(ctx sdk.Context, appID, auctionMappingI
if auction.InflowTokenCurrentAmount.IsGTE(auction.InflowTokenTargetAmount) {
total := auction.OutflowTokenCurrentAmount
err = k.SendCoinsFromModuleToAccount(ctx, auctiontypes.ModuleName, sdk.AccAddress(lockedVault.Owner), sdk.NewCoins(total))
if err != nil {
return err
}
err = k.SendCoinsFromModuleToAccount(ctx, auctiontypes.ModuleName, bidder, sdk.NewCoins(totalAmountToBidder))
if err != nil {
return err
Expand Down
17 changes: 8 additions & 9 deletions x/bandoracle/keeper/oracle.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
clienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types"
channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types"
host "github.com/cosmos/ibc-go/v3/modules/core/24-host"
gogotypes "github.com/gogo/protobuf/types"
protobuftypes "github.com/gogo/protobuf/types"

"github.com/comdex-official/comdex/x/bandoracle/types"
Expand All @@ -37,7 +36,7 @@ func (k Keeper) GetFetchPriceResult(ctx sdk.Context, id types.OracleRequestID) (
// GetLastFetchPriceID return the id from the last FetchPrice request.
func (k Keeper) GetLastFetchPriceID(ctx sdk.Context) int64 {
bz := ctx.KVStore(k.storeKey).Get(types.KeyPrefix(types.LastFetchPriceIDKey))
intV := gogotypes.Int64Value{}
intV := protobuftypes.Int64Value{}
k.cdc.MustUnmarshalLengthPrefixed(bz, &intV)
return intV.GetValue()
}
Expand All @@ -46,7 +45,7 @@ func (k Keeper) GetLastFetchPriceID(ctx sdk.Context) int64 {
func (k Keeper) SetLastFetchPriceID(ctx sdk.Context, id types.OracleRequestID) {
store := ctx.KVStore(k.storeKey)
store.Set(types.KeyPrefix(types.LastFetchPriceIDKey),
k.cdc.MustMarshalLengthPrefixed(&gogotypes.Int64Value{Value: int64(id)}))
k.cdc.MustMarshalLengthPrefixed(&protobuftypes.Int64Value{Value: int64(id)}))
}

func (k Keeper) FetchPrice(ctx sdk.Context, msg types.MsgFetchPriceData) (*types.MsgFetchPriceDataResponse, error) {
Expand Down Expand Up @@ -143,15 +142,15 @@ func (k Keeper) GetFetchPriceMsg(ctx sdk.Context) types.MsgFetchPriceData {

func (k Keeper) GetLastBlockHeight(ctx sdk.Context) int64 {
bz := ctx.KVStore(k.storeKey).Get(types.KeyPrefix(types.LastBlockHeightKey))
intV := gogotypes.Int64Value{}
intV := protobuftypes.Int64Value{}
k.cdc.MustUnmarshalLengthPrefixed(bz, &intV)
return intV.GetValue()
}

func (k Keeper) SetLastBlockHeight(ctx sdk.Context, height int64) {
store := ctx.KVStore(k.storeKey)
store.Set(types.KeyPrefix(types.LastBlockHeightKey),
k.cdc.MustMarshalLengthPrefixed(&gogotypes.Int64Value{Value: height}))
k.cdc.MustMarshalLengthPrefixed(&protobuftypes.Int64Value{Value: height}))
}

func (k Keeper) AddFetchPriceRecords(ctx sdk.Context, price types.MsgFetchPriceData) error {
Expand All @@ -170,25 +169,25 @@ func (k Keeper) OraclePriceValidationByRequestID(ctx sdk.Context, req int64) boo
func (k Keeper) SetOracleValidationResult(ctx sdk.Context, res bool) {
store := ctx.KVStore(k.storeKey)
store.Set(types.KeyPrefix(types.OracleValidationResultKey),
k.cdc.MustMarshalLengthPrefixed(&gogotypes.BoolValue{Value: res}))
k.cdc.MustMarshalLengthPrefixed(&protobuftypes.BoolValue{Value: res}))
}

func (k Keeper) GetOracleValidationResult(ctx sdk.Context) bool {
bz := ctx.KVStore(k.storeKey).Get(types.KeyPrefix(types.OracleValidationResultKey))
boolV := gogotypes.BoolValue{}
boolV := protobuftypes.BoolValue{}
k.cdc.MustUnmarshalLengthPrefixed(bz, &boolV)
return boolV.GetValue()
}

func (k Keeper) SetTempFetchPriceID(ctx sdk.Context, id int64) {
store := ctx.KVStore(k.storeKey)
store.Set(types.KeyPrefix(types.TempFetchPriceIDKey),
k.cdc.MustMarshalLengthPrefixed(&gogotypes.Int64Value{Value: id}))
k.cdc.MustMarshalLengthPrefixed(&protobuftypes.Int64Value{Value: id}))
}

func (k Keeper) GetTempFetchPriceID(ctx sdk.Context) int64 {
bz := ctx.KVStore(k.storeKey).Get(types.KeyPrefix(types.TempFetchPriceIDKey))
intV := gogotypes.Int64Value{}
intV := protobuftypes.Int64Value{}
k.cdc.MustUnmarshalLengthPrefixed(bz, &intV)
return intV.GetValue()
}
Expand Down
2 changes: 1 addition & 1 deletion x/collector/expected/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ type LockerKeeper interface {
}

type RewardsKeeper interface {
GetReward(ctx sdk.Context, appId, assetID uint64) (rewards rewardstypes.InternalRewards, found bool)
GetReward(ctx sdk.Context, appID, assetID uint64) (rewards rewardstypes.InternalRewards, found bool)
CalculationOfRewards(ctx sdk.Context, amount sdk.Int, lsr sdk.Dec, bTime int64) (sdk.Dec, error)
SetLockerRewardTracker(ctx sdk.Context, rewards rewardstypes.LockerRewardsTracker)
GetLockerRewardTracker(ctx sdk.Context, id, appID uint64) (rewards rewardstypes.LockerRewardsTracker, found bool)
Expand Down
13 changes: 11 additions & 2 deletions x/lend/keeper/borrow.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ func (k Keeper) SetBorrowInterestTracker(ctx sdk.Context, interest types.BorrowI
store.Set(key, value)
}

func (k Keeper) GetBorrowInterestTracker(ctx sdk.Context, id uint64) (interest types.BorrowInterestTracker, found bool) {
func (k Keeper) GetBorrowInterestTracker(ctx sdk.Context, ID uint64) (interest types.BorrowInterestTracker, found bool) {
var (
store = k.Store(ctx)
key = types.BorrowInterestTrackerKey(id)
key = types.BorrowInterestTrackerKey(ID)
value = store.Get(key)
)

Expand All @@ -137,3 +137,12 @@ func (k Keeper) GetBorrowInterestTracker(ctx sdk.Context, id uint64) (interest t
k.cdc.MustUnmarshal(value, &interest)
return interest, true
}

func (k Keeper) DeleteBorrowInterestTracker(ctx sdk.Context, ID uint64) {
var (
store = k.Store(ctx)
key = types.BorrowInterestTrackerKey(ID)
)

store.Delete(key)
}
1 change: 1 addition & 0 deletions x/lend/keeper/funds.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func (k Keeper) UpdateReserveBalances(ctx sdk.Context, assetID uint64, moduleNam
return err
}
}
k.SetReserveBuybackAssetData(ctx, reserve)
return nil
}

Expand Down
Loading