mirror of
https://github.com/luxfi/dex.git
synced 2026-10-30 14:45:46 +00:00
The best_venue_buy() and best_venue_sell() methods used Decimal::from_double(1e18) as a sentinel value, which caused integer overflow (1e18 * 1e8 scale = 1e26 exceeds int64_t max ~9.2e18). This resulted in undefined behavior during price comparisons. Changed to use std::optional<Decimal> for safe sentinel-free comparisons.
29 lines
769 B
Go
29 lines
769 B
Go
// Package adapters provides venue adapter implementations.
|
|
package adapters
|
|
|
|
import (
|
|
"github.com/luxfi/trading"
|
|
)
|
|
|
|
func init() {
|
|
trading.RegisterAdapterFactory(&factory{})
|
|
}
|
|
|
|
type factory struct{}
|
|
|
|
func (f *factory) CreateDexAdapter(name string, cfg *trading.NativeVenueConfig) trading.VenueAdapter {
|
|
return NewLxDexAdapter(name, cfg)
|
|
}
|
|
|
|
func (f *factory) CreateAmmAdapter(name string, cfg *trading.NativeVenueConfig) trading.VenueAdapter {
|
|
return NewLxAmmAdapter(name, cfg)
|
|
}
|
|
|
|
func (f *factory) CreateCcxtAdapter(name string, cfg *trading.CcxtConfig) trading.VenueAdapter {
|
|
return NewCcxtAdapter(name, cfg)
|
|
}
|
|
|
|
func (f *factory) CreateHummingbotAdapter(name string, cfg *trading.HummingbotConfig) trading.VenueAdapter {
|
|
return NewHummingbotAdapter(name, cfg)
|
|
}
|