func (db *Database) GetTokenDecimals(poolName, tokenName string) (uint8, error) {
	poolName = strings.ToLower(poolName)
	tokenName = strings.ToLower(tokenName)
	db.namedLock.RLock(poolName)
	defer db.namedLock.RUnlock(poolName)
	var pool Pool
	if err := db.db.Where("name = ?", poolName).First(
		&pool,
		datatypes.JSONQuery("token_decimals").HasKey(tokenName),
	).Error; err != nil {
		return 0, err
	}
	strDec, ok := pool.TokenDecimals[tokenName].(string)
	if !ok {
		return 0, errors.New("tokenDecimal is not of type string")
	}
	dec, err := strconv.ParseUint(strDec, 10, 64)
	if err != nil {
		return 0, err
	}
	return uint8(dec), nil
}
// GetTokenDecimals returns the decimal count associated with various tokens
GetTokenDecimals returns the decimal count associated with various tokens
// GetTokenDecimals returns the decimal count associated with various tokens
func (db *Database) GetTokenDecimals(poolName, tokenName string) (uint8, error) {
	poolName = strings.ToLower(poolName)
	tokenName = strings.ToLower(tokenName)
	db.namedLock.RLock(poolName)
	defer db.namedLock.RUnlock(poolName)
	var pool Pool
	if err := db.db.Where("name = ?", poolName).First(
		&pool,
		datatypes.JSONQuery("token_decimals").HasKey(tokenName),
	).Error; err != nil {
		return 0, err
	}
	strDec, ok := pool.TokenDecimals[tokenName].(string)
	if !ok {
		return 0, errors.New("tokenDecimal is not of type string")
	}
	dec, err := strconv.ParseUint(strDec, 10, 64)
	if err != nil {
		return 0, err
	}
	return uint8(dec), nil
}
func ( db * Database ) GetTokenDecimals ( poolName , tokenName string ) ( uint8 , error ) { poolName = strings . ToLower ( poolName ) tokenName = strings . ToLower ( tokenName ) db . namedLock . RLock ( poolName ) defer db . namedLock . RUnlock ( poolName ) var pool Pool if err := db . db . Where ( " " , poolName ) . First ( & pool , datatypes . JSONQuery ( " " ) . HasKey ( tokenName ) , ) . Error ; err != nil { return 0 , err } strDec , ok := pool . TokenDecimals [ tokenName ] . ( string ) if ! ok { return 0 , errors . New ( " " ) } dec , err := strconv . ParseUint ( strDec , 10 , 64 ) if err != nil { return 0 , err } return uint8 ( dec ) , nil }
GetTokenDecimals returns the decimal count associated with various tokens
GetTokenDecimals returns the decimal count associated with various tokens