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

Feature/dev #492

Merged
merged 51 commits into from
Oct 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
8644fb3
updated lend and borrow structs
Sep 27, 2022
d3b53d1
Merge branch 'feature/dev' of https://github.com/comdex-official/comd…
Sep 27, 2022
3141a5f
update pair proposal added
Sep 27, 2022
87d0bae
updated testcases
Sep 27, 2022
8bdf868
updating test cases
Sep 28, 2022
ffaf60a
Merge branch 'feature/dev' of https://github.com/comdex-official/comd…
Sep 28, 2022
15ba227
Merge branch 'development' of https://github.com/comdex-official/comd…
Sep 28, 2022
51d8dc6
merge conflict removed
Sep 30, 2022
9bb5488
upgrade code added for testing
Sep 30, 2022
0de7fc1
Bump actions/labeler from 4.0.0 to 4.0.1
dependabot[bot] Oct 3, 2022
0d22eb8
Merge pull request #485 from comdex-official/dependabot/github_action…
dheerajkd30 Oct 4, 2022
4857b1a
band, market refactor, double type removed in app, rest tx modified i…
Oct 5, 2022
350f39c
conflicts removed
Oct 5, 2022
1d861fd
Merge branch 'feature/dev' of https://github.com/comdex-official/comd…
Oct 6, 2022
c944b32
adding supplyCap Check
Oct 6, 2022
6078bc3
rest handler added for locker, bandoracle
Oct 6, 2022
c1b1402
calcPrice func added
Oct 6, 2022
1ef9080
Merge pull request #489 from comdex-official/feature/lend
cgsingh33 Oct 6, 2022
0b26033
adding lend ext reward proto
Oct 6, 2022
1aae27a
Merge pull request #490 from comdex-official/feature/lend
pratikasr Oct 6, 2022
b917e1a
adding ext rewards lend module
Oct 7, 2022
6121c83
lend wip
Oct 7, 2022
61595dc
lend wip
Oct 7, 2022
d55572b
price function changed
Oct 7, 2022
b877ea9
lend wip
Oct 7, 2022
e73ef70
lend wip
Oct 7, 2022
9f0b7ce
rewards module fixed
Oct 7, 2022
cc21570
get borrows added
Oct 7, 2022
a7584b6
get borrows added
Oct 7, 2022
fa5663e
liquidation and auction fixed
Oct 7, 2022
7340e89
todo completed
Oct 7, 2022
159ebd3
testcases fixed
Oct 7, 2022
5b338a3
adding params for total interest accumulated
Oct 7, 2022
efc9e87
query modified
Oct 7, 2022
020989b
genesis commented for temp
Oct 7, 2022
1500376
duplicate lend issue fixed
Oct 8, 2022
36f5fb5
duplicate lend issue fixed
Oct 8, 2022
734398e
updating scripts
Oct 8, 2022
bc0dde2
removing comments
Oct 8, 2022
0bc6e9d
duplicate issue fixed
Oct 8, 2022
af6098e
removing dummmy prices
Oct 8, 2022
15b39b6
removing dummmy prices
Oct 8, 2022
e62a576
updating CreteNewBorrow
Oct 8, 2022
f757c82
Merge branch 'hbrefactor' of https://github.com/comdex-official/comde…
Oct 8, 2022
31050a4
duplicate fixed
Oct 8, 2022
d52cdb4
duplicate issue fixed
Oct 8, 2022
c75f0aa
duplicate issue fixed
Oct 8, 2022
51fbdf8
fixed testcases
Oct 8, 2022
c6c863b
Merge pull request #488 from comdex-official/hbrefactor
dheerajkd30 Oct 8, 2022
cca33ca
go lint resovle
dheerajkd30 Oct 8, 2022
1f0c15f
Merge pull request #493 from comdex-official/dd-lint-8
dheerajkd30 Oct 8, 2022
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 added .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ jobs:
labeler:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected].0
- uses: actions/[email protected].2
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
11 changes: 8 additions & 3 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,9 @@ func GetGovProposalHandlers() []govclient.ProposalHandler {
bandoraclemoduleclient.AddFetchPriceHandler,
lendclient.AddLendPairsHandler,
lendclient.AddPoolHandler,
lendclient.UpdateLendPairsHandler,
lendclient.AddAssetToPairHandler,
lendclient.AddAssetRatesStatsHandler,
lendclient.AddAssetRatesParamsHandler,
lendclient.AddAuctionParamsHandler,
paramsclient.ProposalHandler,
distrclient.ProposalHandler,
Expand Down Expand Up @@ -553,6 +554,7 @@ func New(
&app.MarketKeeper,
&app.Rewardskeeper,
&app.VaultKeeper,
&app.BandoracleKeeper,
)

app.LendKeeper = lendkeeper.NewKeeper(
Expand Down Expand Up @@ -723,6 +725,7 @@ func New(
app.LiquidityKeeper,
&app.MarketKeeper,
&app.EsmKeeper,
&app.LendKeeper,
)

wasmDir := filepath.Join(homePath, "wasm")
Expand Down Expand Up @@ -1141,8 +1144,8 @@ func (a *App) ModuleAccountsPermissions() map[string][]string {

func (a *App) registerUpgradeHandlers() {
a.UpgradeKeeper.SetUpgradeHandler(
tv4_0_0.UpgradeNameV4_3_0,
tv4_0_0.CreateUpgradeHandlerV430(a.mm, a.configurator, a.AssetKeeper),
tv4_0_0.UpgradeNameV4_4_0,
tv4_0_0.CreateUpgradeHandlerV440(a.mm, a.configurator, a.LendKeeper, a.LiquidationKeeper, a.AuctionKeeper),
)

// When a planned update height is reached, the old binary will panic
Expand Down Expand Up @@ -1218,6 +1221,8 @@ func upgradeHandlers(upgradeInfo storetypes.UpgradeInfo, a *App, storeUpgrades *
storeUpgrades = &storetypes.StoreUpgrades{}
case upgradeInfo.Name == tv4_0_0.UpgradeNameV4_3_0 && !a.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height):
storeUpgrades = &storetypes.StoreUpgrades{}
case upgradeInfo.Name == tv4_0_0.UpgradeNameV4_4_0 && !a.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height):
storeUpgrades = &storetypes.StoreUpgrades{}
}
return storeUpgrades
}
14 changes: 14 additions & 0 deletions app/upgrades/testnet/v4_0_0/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,17 @@ const (
}
}'`
)

const (
UpgradeNameV4_4_0 = "v4.4.0.beta"
UpgradeHeightV4_4_0 = "" // replace this height
UpgradeInfoV4_4_0 = `'{
"binaries": {
"darwin/arm64":"",
"darwin/x86_64":"",
"linux/arm64":"",
"linux/x86_64":"",
"windows/x86_64":""
}
}'`
)
39 changes: 39 additions & 0 deletions app/upgrades/testnet/v4_0_0/upgrades.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package v4_0_0

import (
auctionkeeper "github.com/comdex-official/comdex/x/auction/keeper"
lendkeeper "github.com/comdex-official/comdex/x/lend/keeper"
liquidationkeeper "github.com/comdex-official/comdex/x/liquidation/keeper"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
Expand Down Expand Up @@ -122,3 +125,39 @@ func CreateUpgradeHandlerV430(
return newVM, err
}
}

func UpdateDutchLendAuctions(
ctx sdk.Context,
liquidationkeeper liquidationkeeper.Keeper,
auctionkeeper auctionkeeper.Keeper,
) {
lockedVaults := liquidationkeeper.GetLockedVaults(ctx)
for _, v := range lockedVaults {
if v.Kind != nil {
err := auctionkeeper.LendDutchActivator(ctx, v)
if err != nil {
return
}
}
}
}

// CreateUpgradeHandler creates an SDK upgrade handler for v4_4_0
func CreateUpgradeHandlerV440(
mm *module.Manager,
configurator module.Configurator,
lendkeeper lendkeeper.Keeper,
liquidationkeeper liquidationkeeper.Keeper,
auctionkeeper auctionkeeper.Keeper,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
// This change is only for testnet upgrade

UpdateDutchLendAuctions(ctx, liquidationkeeper, auctionkeeper)
newVM, err := mm.RunMigrations(ctx, configurator, fromVM)
if err != nil {
return newVM, err
}
return newVM, err
}
}
1 change: 1 addition & 0 deletions app/wasm/bindings/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ type MsgUpdatePairsVault struct {
ClosingFee sdk.Dec `json:"closing_fee"`
LiquidationPenalty sdk.Dec `json:"liquidation_penalty"`
DrawDownFee sdk.Dec `json:"draw_down_fee"`
IsVaultActive bool `json:"is_vault_active"`
MinCr sdk.Dec `json:"min_cr"`
DebtCeiling uint64 `json:"debt_ceiling"`
DebtFloor uint64 `json:"debt_floor"`
Expand Down
4 changes: 2 additions & 2 deletions proto/comdex/asset/v1beta1/app.proto
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ message AppData {
(gogoproto.moretags) = "yaml:\"min_gov_deposit\"",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false];
double gov_time_in_seconds = 5 [(gogoproto.moretags) = "yaml:\"gov_time_in_seconds\""];
uint64 gov_time_in_seconds = 5 [(gogoproto.moretags) = "yaml:\"gov_time_in_seconds\""];
repeated MintGenesisToken genesis_token = 6 [(gogoproto.moretags) = "yaml:\"genesis_token\"",
(gogoproto.nullable) = false];
}
Expand All @@ -30,7 +30,7 @@ message MintGenesisToken {

message AppAndGovTime {
uint64 app_id = 1 [(gogoproto.moretags) = "yaml:\"app_id\""];
double gov_time_in_seconds = 2 [(gogoproto.moretags) = "yaml:\"gov_time_in_seconds\""];
uint64 gov_time_in_seconds = 2 [(gogoproto.moretags) = "yaml:\"gov_time_in_seconds\""];
string min_gov_deposit = 3 [
(gogoproto.moretags) = "yaml:\"min_gov_deposit\"",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
Expand Down
4 changes: 0 additions & 4 deletions proto/comdex/bandoracle/v1beta1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ import "comdex/bandoracle/v1beta1/fetch_price.proto";

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

service Msg {
rpc FetchPriceData(MsgFetchPriceData) returns (MsgFetchPriceDataResponse);
}

message MsgFetchPriceData {
string creator = 1;
uint64 oracle_script_id = 2 [
Expand Down
78 changes: 39 additions & 39 deletions proto/comdex/lend/v1beta1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,44 +8,44 @@ import "comdex/lend/v1beta1/params.proto";
option go_package = "github.com/comdex-official/comdex/x/lend/types";

message GenesisState {
repeated BorrowAsset borrowAsset = 1
[ (gogoproto.moretags) = "yaml:\"borrowAsset\"", (gogoproto.nullable) = false ];
repeated UserBorrowIdMapping userBorrowIdMapping = 2
[ (gogoproto.moretags) = "yaml:\"userBorrowIdMapping\"", (gogoproto.nullable) = false ];
repeated BorrowIdByOwnerAndPoolMapping borrowIdByOwnerAndPoolMapping = 3
[ (gogoproto.moretags) = "yaml:\"borrowIdByOwnerAndPoolMapping\"", (gogoproto.nullable) = false ];
BorrowMapping borrowMapping = 4
[ (gogoproto.moretags) = "yaml:\"borrowMapping\"", (gogoproto.nullable) = false ];
repeated LendAsset lendAsset = 5
[ (gogoproto.moretags) = "yaml:\"lendAsset\"", (gogoproto.nullable) = false ];
repeated Pool pool = 6
[ (gogoproto.moretags) = "yaml:\"pool\"", (gogoproto.nullable) = false ];
repeated AssetToPairMapping assetToPairMapping = 7
[ (gogoproto.moretags) = "yaml:\"assetToPairMapping\"", (gogoproto.nullable) = false ];
repeated UserLendIdMapping userLendIdMapping = 8
[ (gogoproto.moretags) = "yaml:\"userLendIdMapping\"", (gogoproto.nullable) = false ];
repeated LendIdByOwnerAndPoolMapping lendIdByOwnerAndPoolMapping = 9
[ (gogoproto.moretags) = "yaml:\"lendIdByOwnerAndPoolMapping\"", (gogoproto.nullable) = false ];
repeated LendIdToBorrowIdMapping lendIdToBorrowIdMapping = 10
[ (gogoproto.moretags) = "yaml:\"lendIdToBorrowIdMapping\"", (gogoproto.nullable) = false ];
repeated AssetStats assetStats = 11
[ (gogoproto.moretags) = "yaml:\"assetStats\"", (gogoproto.nullable) = false ];
LendMapping lendMapping = 12
[ (gogoproto.moretags) = "yaml:\"lendMapping\"", (gogoproto.nullable) = false ];
DepositStats userDepositStats = 13
[ (gogoproto.moretags) = "yaml:\"userDepositStats\"", (gogoproto.nullable) = false ];
DepositStats reserveDepositStats = 14
[ (gogoproto.moretags) = "yaml:\"reserveDepositStats\"", (gogoproto.nullable) = false ];
DepositStats buyBackDepositStats = 15
[ (gogoproto.moretags) = "yaml:\"buyBackDepositStats\"", (gogoproto.nullable) = false ];
DepositStats borrowDepositStats = 16
[ (gogoproto.moretags) = "yaml:\"borrowDepositStats\"", (gogoproto.nullable) = false ];
repeated Extended_Pair extended_Pair = 17
[ (gogoproto.moretags) = "yaml:\"extended_Pair\"", (gogoproto.nullable) = false ];
repeated AssetRatesStats assetRatesStats = 18
[ (gogoproto.moretags) = "yaml:\"assetRatesStats\"", (gogoproto.nullable) = false ];
repeated AuctionParams auctionParams = 19
[ (gogoproto.moretags) = "yaml:\"auctionParams\"", (gogoproto.nullable) = false ];
Params params = 20 [(gogoproto.nullable) = false];
// repeated BorrowAsset borrowAsset = 1
// [ (gogoproto.moretags) = "yaml:\"borrowAsset\"", (gogoproto.nullable) = false ];
// repeated UserBorrowIdMapping userBorrowIdMapping = 2
// [ (gogoproto.moretags) = "yaml:\"userBorrowIdMapping\"", (gogoproto.nullable) = false ];
// repeated BorrowIdByOwnerAndPoolMapping borrowIdByOwnerAndPoolMapping = 3
// [ (gogoproto.moretags) = "yaml:\"borrowIdByOwnerAndPoolMapping\"", (gogoproto.nullable) = false ];
// BorrowMapping borrowMapping = 4
// [ (gogoproto.moretags) = "yaml:\"borrowMapping\"", (gogoproto.nullable) = false ];
// repeated LendAsset lendAsset = 5
// [ (gogoproto.moretags) = "yaml:\"lendAsset\"", (gogoproto.nullable) = false ];
// repeated Pool pool = 6
// [ (gogoproto.moretags) = "yaml:\"pool\"", (gogoproto.nullable) = false ];
// repeated AssetToPairMapping assetToPairMapping = 7
// [ (gogoproto.moretags) = "yaml:\"assetToPairMapping\"", (gogoproto.nullable) = false ];
// repeated UserLendIdMapping userLendIdMapping = 8
// [ (gogoproto.moretags) = "yaml:\"userLendIdMapping\"", (gogoproto.nullable) = false ];
// repeated LendIdByOwnerAndPoolMapping lendIdByOwnerAndPoolMapping = 9
// [ (gogoproto.moretags) = "yaml:\"lendIdByOwnerAndPoolMapping\"", (gogoproto.nullable) = false ];
// repeated LendIdToBorrowIdMapping lendIdToBorrowIdMapping = 10
// [ (gogoproto.moretags) = "yaml:\"lendIdToBorrowIdMapping\"", (gogoproto.nullable) = false ];
// repeated AssetStats assetStats = 11
// [ (gogoproto.moretags) = "yaml:\"assetStats\"", (gogoproto.nullable) = false ];
// LendMapping lendMapping = 12
// [ (gogoproto.moretags) = "yaml:\"lendMapping\"", (gogoproto.nullable) = false ];
// DepositStats userDepositStats = 13
// [ (gogoproto.moretags) = "yaml:\"userDepositStats\"", (gogoproto.nullable) = false ];
// DepositStats reserveDepositStats = 14
// [ (gogoproto.moretags) = "yaml:\"reserveDepositStats\"", (gogoproto.nullable) = false ];
// DepositStats buyBackDepositStats = 15
// [ (gogoproto.moretags) = "yaml:\"buyBackDepositStats\"", (gogoproto.nullable) = false ];
// DepositStats borrowDepositStats = 16
// [ (gogoproto.moretags) = "yaml:\"borrowDepositStats\"", (gogoproto.nullable) = false ];
// repeated Extended_Pair extended_Pair = 17
// [ (gogoproto.moretags) = "yaml:\"extended_Pair\"", (gogoproto.nullable) = false ];
// repeated AssetRatesStats assetRatesStats = 18
// [ (gogoproto.moretags) = "yaml:\"assetRatesStats\"", (gogoproto.nullable) = false ];
// repeated AuctionParams auctionParams = 19
// [ (gogoproto.moretags) = "yaml:\"auctionParams\"", (gogoproto.nullable) = false ];
// Params params = 20 [(gogoproto.nullable) = false];

}
9 changes: 7 additions & 2 deletions proto/comdex/lend/v1beta1/gov.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,22 @@ message AddPoolsProposal {
string description = 2 [(gogoproto.moretags) = "yaml:\"description\""];
Pool Pool = 3 [(gogoproto.nullable) = false];
}
message UpdateLendPairsProposal {
string title = 1 [(gogoproto.moretags) = "yaml:\"title\""];
string description = 2 [(gogoproto.moretags) = "yaml:\"description\""];
Extended_Pair pairs = 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 {
message AddAssetRatesParams {
string title = 1 [(gogoproto.moretags) = "yaml:\"title\""];
string description = 2 [(gogoproto.moretags) = "yaml:\"description\""];
AssetRatesStats AssetRatesStats = 3 [(gogoproto.nullable) = false];
AssetRatesParams AssetRatesParams = 3 [(gogoproto.nullable) = false];
}

message AddAuctionParamsProposal {
Expand Down
Loading