Skip to content

Commit

Permalink
fix:check empty interval field
Browse files Browse the repository at this point in the history
  • Loading branch information
leonz789 committed Aug 14, 2024
1 parent cb54e7c commit 28fde00
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions precompiles/assets/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ func (p Precompile) TokenFromInputs(ctx sdk.Context, args []interface{}) (types.
if len(chainDesc) == 2 {
oracleInfo.Chain.Desc = chainDesc[1]
}
fallthrough
case l >= 5:
oracleInfo.Token.Contract = parsed[4]
fallthrough
Expand Down
14 changes: 7 additions & 7 deletions x/oracle/keeper/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const (

func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) {
store := ctx.KVStore(k.storeKey)
bz := store.Get(types.ParamsKey) // return types.NewParams()
bz := store.Get(types.ParamsKey)
if bz != nil {
k.cdc.MustUnmarshal(bz, &params)
}
Expand Down Expand Up @@ -55,12 +55,12 @@ func (k Keeper) RegisterNewTokenAndSetTokenFeeder(ctx sdk.Context, oInfo *types.
if err != nil {
return err
}
if decimalInt < 0 {
return fmt.Errorf("decimal can't be negative:%d", decimalInt)
}
intervalInt, err := strconv.ParseUint(oInfo.Feeder.Interval, 10, 64)
if err != nil {
return err
intervalInt := uint64(0)
if len(oInfo.Feeder.Interval) > 0 {
intervalInt, err = strconv.ParseUint(oInfo.Feeder.Interval, 10, 64)
if err != nil {
return err
}
}
if intervalInt == 0 {
intervalInt = defaultInterval
Expand Down

0 comments on commit 28fde00

Please sign in to comment.