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

chore: add exception handling in amm price query and fix price feeder… #273

Merged
merged 2 commits into from
Nov 24, 2023
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
2 changes: 2 additions & 0 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,8 @@ genesis:
priceFeeders:
- feeder: "elys12tzylat4udvjj56uuhu3vj2n4vgp7cf9fwna9w"
is_active: true
- feeder: "elys1v30pe777dj9mgsnlv0j2c5wh05m0ya0nlhuv7t"
is_active: true
prices:
- asset: USDT
price: "1.00"
Expand Down
9 changes: 9 additions & 0 deletions x/amm/client/wasm/query_amm_price_by_denom.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ func (oq *Querier) queryAmmPriceByDenom(ctx sdk.Context, query *ammtypes.QueryAM
return nil, errorsmod.Wrapf(aptypes.ErrAssetProfileNotFound, "denom: %s", denom)
}

// If amount is zero
if query.TokenIn.Amount.IsZero() {
responseBytes, err := json.Marshal(sdk.ZeroDec())
if err != nil {
return nil, errorsmod.Wrap(err, "failed to serialize in route by denom response")
}
return responseBytes, nil
}

// uses asset profile denom
usdcDenom := assetProfile.Denom

Expand Down
2 changes: 1 addition & 1 deletion x/oracle/client/cli/tx_price_feeder.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func CmdSetPriceFeeder() *cobra.Command {
return err
}

isActive, err := strconv.ParseBool(args[1])
isActive, err := strconv.ParseBool(args[0])
if err != nil {
return err
}
Expand Down
Loading