-
Notifications
You must be signed in to change notification settings - Fork 370
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
feat: add community cdp repay debt proposal #1565
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
78f3a84
add CommunityPoolCDPRepayDebtProposal proto & type
pirtleshell 94ec3d9
add cdpKeeper to x/community's keeper
pirtleshell b37c4f4
add handler for CommunityPoolCDPRepayDebtProposal
pirtleshell 0acba15
more test cases
pirtleshell c51dd47
rename CommunityPoolCDP -> CommunityCDP
pirtleshell b6ecba9
fix & test stringer
pirtleshell afc38bb
update changelog
pirtleshell File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package testutil | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/cosmos/cosmos-sdk/codec" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
|
||
"github.com/kava-labs/kava/app" | ||
cdptypes "github.com/kava-labs/kava/x/cdp/types" | ||
) | ||
|
||
func NewCDPGenState(cdc codec.JSONCodec, denom, asset string, liquidationRatio sdk.Dec) app.GenesisState { | ||
cdpGenesis := cdptypes.GenesisState{ | ||
Params: cdptypes.Params{ | ||
GlobalDebtLimit: sdk.NewInt64Coin("usdx", 1000000000000), | ||
SurplusAuctionThreshold: cdptypes.DefaultSurplusThreshold, | ||
SurplusAuctionLot: cdptypes.DefaultSurplusLot, | ||
DebtAuctionThreshold: cdptypes.DefaultDebtThreshold, | ||
DebtAuctionLot: cdptypes.DefaultDebtLot, | ||
CollateralParams: cdptypes.CollateralParams{ | ||
{ | ||
Denom: denom, | ||
Type: asset + "-a", | ||
LiquidationRatio: liquidationRatio, | ||
DebtLimit: sdk.NewInt64Coin("usdx", 1000000000000), | ||
StabilityFee: sdk.MustNewDecFromStr("1.000000001547125958"), // %5 apr | ||
LiquidationPenalty: sdk.MustNewDecFromStr("0.05"), | ||
AuctionSize: sdk.NewInt(100), | ||
SpotMarketID: asset + ":usd", | ||
LiquidationMarketID: asset + ":usd", | ||
KeeperRewardPercentage: sdk.MustNewDecFromStr("0.01"), | ||
CheckCollateralizationIndexCount: sdk.NewInt(10), | ||
ConversionFactor: sdk.NewInt(6), | ||
}, | ||
}, | ||
DebtParam: cdptypes.DebtParam{ | ||
Denom: "usdx", | ||
ReferenceAsset: "usd", | ||
ConversionFactor: sdk.NewInt(6), | ||
DebtFloor: sdk.NewInt(10000000), | ||
}, | ||
}, | ||
StartingCdpID: cdptypes.DefaultCdpStartingID, | ||
DebtDenom: cdptypes.DefaultDebtDenom, | ||
GovDenom: cdptypes.DefaultGovDenom, | ||
CDPs: cdptypes.CDPs{}, | ||
PreviousAccumulationTimes: cdptypes.GenesisAccumulationTimes{ | ||
cdptypes.NewGenesisAccumulationTime(asset+"-a", time.Time{}, sdk.OneDec()), | ||
}, | ||
TotalPrincipals: cdptypes.GenesisTotalPrincipals{ | ||
cdptypes.NewGenesisTotalPrincipal(asset+"-a", sdk.ZeroInt()), | ||
}, | ||
} | ||
return app.GenesisState{cdptypes.ModuleName: cdc.MustMarshalJSON(&cdpGenesis)} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
creating a public record of the fact that because this was originally passed as a copy, any positions it created never had claims instantiated (because the hooks do not get registered to the copy).
this may have consequences for the open lend position held by the community module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
confirmed with @rhuairahrighairidh any fixes needed for this would be in a follow up pr. commencing merge!