Skip to content
Merged
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
11 changes: 11 additions & 0 deletions rollup/fees/rate.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ func TokenRate(state StateDB, tokenID uint16) (*big.Int, *big.Int, error) {
log.Error("Invalid token address", "tokenID", tokenID)
return nil, nil, errors.New("invalid token address")
}

// If price is nil or zero, this token doesn't have a valid price
if rate == nil || rate.Sign() == 0 {
log.Error("Invalid token price", "tokenID", tokenID, "tokenAddr", info.TokenAddress.Hex())
return nil, nil, err
}
Comment thread
Kukoomomo marked this conversation as resolved.

if info.Scale == nil || info.Scale.Sign() == 0 {
log.Error("Invalid token scale", "tokenID", tokenID, "tokenAddr", info.TokenAddress.Hex())
return nil, nil, err
}
Comment thread
Kukoomomo marked this conversation as resolved.
return rate, info.Scale, nil
}

Expand Down