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

adding lend module #262

Merged
merged 5 commits into from
Jun 20, 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
Binary file removed .DS_Store
Binary file not shown.
58 changes: 33 additions & 25 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,10 @@ import (
collectorkeeper "github.com/comdex-official/comdex/x/collector/keeper"
collectortypes "github.com/comdex-official/comdex/x/collector/types"

//"github.com/comdex-official/comdex/x/lend"
//lendkeeper "github.com/comdex-official/comdex/x/lend/keeper"
//lendtypes "github.com/comdex-official/comdex/x/lend/types"
"github.com/comdex-official/comdex/x/lend"
lendclient "github.com/comdex-official/comdex/x/lend/client"
lendkeeper "github.com/comdex-official/comdex/x/lend/keeper"
lendtypes "github.com/comdex-official/comdex/x/lend/types"
"github.com/comdex-official/comdex/x/locker"
lockerkeeper "github.com/comdex-official/comdex/x/locker/keeper"
lockertypes "github.com/comdex-official/comdex/x/locker/types"
Expand Down Expand Up @@ -188,6 +189,11 @@ func GetGovProposalHandlers() []govclient.ProposalHandler {
bandoraclemoduleclient.AddFetchPriceHandler,
collectorclient.AddLookupTableParamsHandlers,
collectorclient.AddAuctionControlParamsHandler,
lendclient.AddLendPairsHandler,
lendclient.UpdateLendPairsHandler,
lendclient.AddPoolHandler,
lendclient.AddAssetToPairHandler,
lendclient.AddAssetRatesStatsHandler,
paramsclient.ProposalHandler,
distrclient.ProposalHandler,
upgradeclient.ProposalHandler,
Expand Down Expand Up @@ -236,7 +242,7 @@ var (
vesting.AppModuleBasic{},
vault.AppModuleBasic{},
asset.AppModuleBasic{},
//lend.AppModuleBasic{},
lend.AppModuleBasic{},

market.AppModuleBasic{},
locker.AppModuleBasic{},
Expand Down Expand Up @@ -317,11 +323,11 @@ type App struct {
MarketKeeper marketkeeper.Keeper
LiquidationKeeper liquidationkeeper.Keeper
LockerKeeper lockerkeeper.Keeper
//lendKeeper lendkeeper.Keeper
ScopedWasmKeeper capabilitykeeper.ScopedKeeper
AuctionKeeper auctionkeeper.Keeper
TokenmintKeeper tokenmintkeeper.Keeper
liquidityKeeper liquiditykeeper.Keeper
LendKeeper lendkeeper.Keeper
ScopedWasmKeeper capabilitykeeper.ScopedKeeper
AuctionKeeper auctionkeeper.Keeper
TokenmintKeeper tokenmintkeeper.Keeper
liquidityKeeper liquiditykeeper.Keeper
//lockingKeeper lockingkeeper.Keeper
Rewardskeeper rewardskeeper.Keeper

Expand Down Expand Up @@ -402,7 +408,7 @@ func New(
app.ParamsKeeper.Subspace(vaulttypes.ModuleName)
app.ParamsKeeper.Subspace(assettypes.ModuleName)
app.ParamsKeeper.Subspace(collectortypes.ModuleName)
//app.ParamsKeeper.Subspace(lendtypes.ModuleName)
app.ParamsKeeper.Subspace(lendtypes.ModuleName)
app.ParamsKeeper.Subspace(markettypes.ModuleName)
app.ParamsKeeper.Subspace(liquidationtypes.ModuleName)
app.ParamsKeeper.Subspace(lockertypes.ModuleName)
Expand Down Expand Up @@ -543,15 +549,16 @@ func New(
&app.MarketKeeper,
)

/*app.lendKeeper = *lendkeeper.NewKeeper(
app.LendKeeper = *lendkeeper.NewKeeper(
app.cdc,
app.keys[lendtypes.StoreKey],
app.keys[lendtypes.StoreKey],
app.GetSubspace(lendtypes.ModuleName),
app.BankKeeper,
app.AccountKeeper,
&app.AssetKeeper,
)*/
&app.MarketKeeper,
)

app.VaultKeeper = vaultkeeper.NewKeeper(
app.cdc,
Expand Down Expand Up @@ -727,6 +734,7 @@ func New(
AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)).
AddRoute(assettypes.RouterKey, asset.NewUpdateAssetProposalHandler(app.AssetKeeper)).
AddRoute(collectortypes.RouterKey, collector.NewLookupTableParamsHandlers(app.CollectorKeeper)).
AddRoute(lendtypes.RouterKey, lend.NewLendHandler(app.LendKeeper)).
AddRoute(bandoraclemoduletypes.RouterKey, bandoraclemodule.NewFetchPriceHandler(app.BandoracleKeeper)).
AddRoute(ibchost.RouterKey, ibcclient.NewClientProposalHandler(app.IbcKeeper.ClientKeeper)).
AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IbcKeeper.ClientKeeper)).
Expand Down Expand Up @@ -804,7 +812,7 @@ func New(
liquidation.NewAppModule(app.cdc, app.LiquidationKeeper, app.AccountKeeper, app.BankKeeper),
locker.NewAppModule(app.cdc, app.LockerKeeper, app.AccountKeeper, app.BankKeeper),
collector.NewAppModule(app.cdc, app.CollectorKeeper, app.AccountKeeper, app.BankKeeper),
//lend.NewAppModule(app.cdc, app.lendKeeper, app.AccountKeeper, app.BankKeeper),
lend.NewAppModule(app.cdc, app.LendKeeper, app.AccountKeeper, app.BankKeeper),
wasm.NewAppModule(app.cdc, &app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper),
auction.NewAppModule(app.cdc, app.AuctionKeeper, app.AccountKeeper, app.BankKeeper),
tokenmint.NewAppModule(app.cdc, app.TokenmintKeeper, app.AccountKeeper, app.BankKeeper),
Expand Down Expand Up @@ -860,7 +868,7 @@ func New(
ibctransfertypes.ModuleName,
assettypes.ModuleName,
collectortypes.ModuleName,
//lendtypes.ModuleName,
lendtypes.ModuleName,
vaulttypes.ModuleName,
tokenminttypes.ModuleName,
bandoraclemoduletypes.ModuleName,
Expand Down Expand Up @@ -1060,16 +1068,16 @@ func (a *App) ModuleAccountsPermissions() map[string][]string {
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
collectortypes.ModuleName: {authtypes.Burner, authtypes.Staking},
vaulttypes.ModuleName: {authtypes.Minter, authtypes.Burner},
//lendtypes.ModuleName: {authtypes.Minter, authtypes.Burner},
tokenminttypes.ModuleName: {authtypes.Minter, authtypes.Burner},
//lendtypes.ModuleAcc1: {authtypes.Minter, authtypes.Burner},
//lendtypes.ModuleAcc2: {authtypes.Minter, authtypes.Burner},
//lendtypes.ModuleAcc3: {authtypes.Minter, authtypes.Burner},
liquidationtypes.ModuleName: {authtypes.Minter, authtypes.Burner},
auctiontypes.ModuleName: {authtypes.Minter, authtypes.Burner},
lockertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
wasm.ModuleName: {authtypes.Burner},
liquiditytypes.ModuleName: {authtypes.Minter, authtypes.Burner},
lendtypes.ModuleName: {authtypes.Minter, authtypes.Burner},
tokenminttypes.ModuleName: {authtypes.Minter, authtypes.Burner},
lendtypes.ModuleAcc1: {authtypes.Minter, authtypes.Burner},
lendtypes.ModuleAcc2: {authtypes.Minter, authtypes.Burner},
lendtypes.ModuleAcc3: {authtypes.Minter, authtypes.Burner},
liquidationtypes.ModuleName: {authtypes.Minter, authtypes.Burner},
auctiontypes.ModuleName: {authtypes.Minter, authtypes.Burner},
lockertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
wasm.ModuleName: {authtypes.Burner},
liquiditytypes.ModuleName: {authtypes.Minter, authtypes.Burner},
//lockingtypes.ModuleName: nil,
rewardstypes.ModuleName: {authtypes.Minter, authtypes.Burner},
icatypes.ModuleName: nil,
Expand Down Expand Up @@ -1112,7 +1120,7 @@ func (a *App) registerUpgradeHandlers() {
auctiontypes.ModuleName,
bandoraclemoduletypes.ModuleName,
collectortypes.ModuleName,
//lendtypes.ModuleName,
lendtypes.ModuleName,
liquidationtypes.ModuleName,
liquiditytypes.ModuleName,
lockertypes.ModuleName,
Expand Down
Binary file removed proto/comdex/.DS_Store
Binary file not shown.
38 changes: 38 additions & 0 deletions proto/comdex/lend/v1beta1/gov.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
syntax = "proto3";
package comdex.lend.v1beta1;

import "gogoproto/gogo.proto";
import "comdex/lend/v1beta1/lend.proto";


option go_package = "github.com/comdex-official/comdex/x/lend/types";

message LendPairsProposal {
string title = 1 [(gogoproto.moretags) = "yaml:\"title\""];
string description = 2 [(gogoproto.moretags) = "yaml:\"description\""];
repeated Extended_Pair pairs = 3 [(gogoproto.nullable) = false];
}

message UpdatePairProposal {
string title = 1 [(gogoproto.moretags) = "yaml:\"title\""];
string description = 2 [(gogoproto.moretags) = "yaml:\"description\""];
Extended_Pair pair = 3 [(gogoproto.nullable) = false];
}

message AddPoolsProposal {
string title = 1 [(gogoproto.moretags) = "yaml:\"title\""];
string description = 2 [(gogoproto.moretags) = "yaml:\"description\""];
Pool Pool = 3 [(gogoproto.nullable) = false];
}

message AddAssetToPairProposal {
string title = 1 [(gogoproto.moretags) = "yaml:\"title\""];
string description = 2 [(gogoproto.moretags) = "yaml:\"description\""];
AssetToPairMapping AssetToPairMapping = 3 [(gogoproto.nullable) = false];
}

message AddAssetRatesStats {
string title = 1 [(gogoproto.moretags) = "yaml:\"title\""];
string description = 2 [(gogoproto.moretags) = "yaml:\"description\""];
repeated AssetRatesStats AssetRatesStats = 3 [(gogoproto.nullable) = false];
}
Loading