-
Notifications
You must be signed in to change notification settings - Fork 1
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
Vault/allow multiple currency #76
Conversation
Son/auction multiple stable
auction: fix abci aution
Vaults: Add test vaults abci
vaults: Add beginblocker vaults
vaults: Add validate StabilityFee
vault: add default for DefaultMintDenoms
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.
Add some comments.
There something about VaultManager.MintAvailable
we should go deeper since we allow multi debt denoms. Currently it math.Int
so we need to use a unified currency unit for calculations, or have max debt for each debt denom
string denom = 1; | ||
string debt_denom = 1; | ||
|
||
string mint_denom = 2; |
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.
we should rename. Lets say debt and mint denom is same nomUSD
@@ -142,7 +144,9 @@ message VaultLiquidationStatus { | |||
} | |||
|
|||
message Liquidation { | |||
string denom = 1; | |||
string debt_denom = 1; |
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.
should be collateral_denom I think
@@ -31,7 +34,8 @@ func (k Keeper) GetNewAuction(ctx context.Context, | |||
if newAuction != nil { | |||
return newAuction, false, nil | |||
} | |||
newAuction, err = k.NewAuction(ctx, startTime, initialPrice, item, targetGoal, vaultId) | |||
newAuction, err = k.NewAuction(ctx, startTime, initialPrice, item, targetGoal, vaultId, vault.Debt.Denom) | |||
|
|||
if err != nil { | |||
return newAuction, true, err |
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.
if err != nil so the auction should not be created. Let check the bool return
@@ -58,7 +63,7 @@ func (k Keeper) NewAuction(ctx context.Context, | |||
LastDiscountTime: startTime, | |||
Status: types.AuctionStatus_AUCTION_STATUS_ACTIVE, | |||
TargetGoal: targetGoal, | |||
TokenRaised: sdk.NewCoin(vaultstypes.DefaultMintDenom, math.ZeroInt()), | |||
TokenRaised: sdk.NewCoin(mintDenom, math.ZeroInt()), |
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.
nice
if price == nil || price.IsNil() { | ||
return errors.Wrapf(oracletypes.ErrInvalidOracle, "CreateNewVault: can not get price with base %s quote %s", denom, types.DefaultMintDenom) | ||
return errors.Wrapf(oracletypes.ErrInvalidOracle, "CreateNewVault: can not get price with base %s quote %s", denom, types.DefaultMintDenoms) |
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.
return errors.Wrapf(oracletypes.ErrInvalidOracle, "CreateNewVault: can not get price with base %s quote %s", denom, types.DefaultMintDenoms) | |
return errors.Wrapf(oracletypes.ErrInvalidOracle, "CreateNewVault: can not get price with base %s quote %s", denom, mint.Denom) |
if price == nil || price.IsNil() { | ||
return errors.Wrapf(oracletypes.ErrInvalidOracle, "MintCoin: can not get price with base %s quote %s", lockedCoin.Denom, types.DefaultMintDenom) | ||
return errors.Wrapf(oracletypes.ErrInvalidOracle, "MintCoin: can not get price with base %s quote %s", lockedCoin.Denom, types.DefaultMintDenoms) |
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.
dito
// defensive programming: should never happen since when withdraw should always have a valid oracle price | ||
if price == nil || price.IsNil() { | ||
return errors.Wrapf(oracletypes.ErrInvalidOracle, "WithdrawFromVault: can not get price with base %s quote %s", collateral.Denom, types.DefaultMintDenom) | ||
return errors.Wrapf(oracletypes.ErrInvalidOracle, "WithdrawFromVault: can not get price with base %s quote %s", collateral.Denom, types.DefaultMintDenoms) |
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.
dito
if price == nil || price.IsNil() { | ||
return true, errors.Wrapf(oracletypes.ErrInvalidOracle, "GetLiquidations: can not get price with base %s quote %s", vm.Denom, types.DefaultMintDenom) | ||
return true, errors.Wrapf(oracletypes.ErrInvalidOracle, "GetLiquidations: can not get price with base %s quote %s", vm.Denom, types.DefaultMintDenoms) |
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.
dito
vaults: check status
Psm: allow multiple currency for psm
Close #75