Skip to content
Merged
Changes from 2 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
7 changes: 4 additions & 3 deletions rollup/fees/rate.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,22 @@ func TokenRate(state StateDB, tokenID uint16) (*big.Int, *big.Int, error) {

if info.Scale == nil || info.Scale.Sign() == 0 {
log.Error("Invalid token scale", "tokenID", tokenID, "tokenAddr", info.TokenAddress.Hex())
return nil, nil, errors.New("invalid token scale")
}

// If token address is zero, this is not a valid token
if info.TokenAddress == (common.Address{}) {
log.Error("Invalid token address", "tokenID", tokenID)
return nil, nil, err
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
return nil, nil, errors.New("invalid token price")
}

return rate, info.Scale, err
return rate, info.Scale, nil
}

func EthToAlt(state StateDB, tokenID uint16, amount *big.Int) (*big.Int, error) {
Expand Down