Skip to content

Commit

Permalink
Merge pull request #62 from onomyprotocol/dong/bug-createvaults
Browse files Browse the repository at this point in the history
bug: check denom for minted
  • Loading branch information
hieuvubk authored Oct 31, 2024
2 parents 8662da9 + 4b4da2e commit 113acb2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions x/vaults/keeper/vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ func (k *Keeper) CreateNewVault(
return fmt.Errorf("%s was not actived", denom)
}

if mint.Denom != types.DefaultMintDenom {
return fmt.Errorf("minted denom must be %s", types.DefaultMintDenom)
}

params := k.GetParams(ctx)
vmParams := vm.Params

Expand Down Expand Up @@ -121,6 +125,9 @@ func (k *Keeper) MintCoin(
sender sdk.AccAddress,
mint sdk.Coin,
) error {
if mint.Denom != types.DefaultMintDenom {
return fmt.Errorf("minted denom must be %s", types.DefaultMintDenom)
}
vault, err := k.GetVault(ctx, vaultId)
if err != nil {
return err
Expand Down Expand Up @@ -185,6 +192,10 @@ func (k *Keeper) RepayDebt(
sender sdk.AccAddress,
mint sdk.Coin,
) error {
if mint.Denom != types.DefaultMintDenom {
return fmt.Errorf("minted denom must be %s", types.DefaultMintDenom)
}

vault, err := k.GetVault(ctx, vaultId)
if err != nil {
return err
Expand Down

0 comments on commit 113acb2

Please sign in to comment.