Aldrin Network is a cutting-edge virtual machine designed specifically for decentralized exchanges on Solana. It combines advanced sharding with innovative fee structures to deliver institutional-grade performance while maintaining fairness and accessibility.
- Zero-copy architecture with cache-aligned data structures
- Sharded orderbook for parallel execution
- Lock-free atomic operations
- Optimized memory management
const FeeLevel = struct {
volume_threshold: u64,
base_fee_bps: u16,
};
const NftStakingConfig = struct {
enabled: bool,
discount_bps: u16,
min_stake_time: u64,
};
const LpDiscountTier = struct {
lp_amount_threshold: u64,
discount_bps: u16,
};
- Volume-based tiered fees
- NFT staking discounts
- LP provision rewards
- Real-time fee calculation
const OrderTreeMap = std.TreeMap(
u64,
CacheAlignedOrder,
void,
orderCompare
);
const ShardedOrderbook = struct {
shards: []OrderTreeMap,
shard_count: usize,
};
- Cache-optimized order storage
- Efficient price-time priority
- Fast order matching
- Minimal memory footprint
const AldrinVM = struct {
registers: [11]u64,
memory: []u8,
program: []const Instruction,
orderbook: ShardedOrderbook,
best_bid: u64,
best_ask: u64,
};
const Market = struct {
orderbook: ShardedOrderbook,
fee_structure: FeeStructure,
user_volumes: OrderTreeMap,
nft_stakes: OrderTreeMap,
lp_amounts: OrderTreeMap,
};
- Order Processing: Sub-microsecond latency
- Throughput: 1M+ orders/second
- Memory Usage: ~1GB for 1M orders
- Cache Efficiency: >95% hit rate
- Vectorized price checks
- Cross-shard order matching
- Atomic state updates
- Optimized instruction set
- Dynamic fee calculation
- Multi-tier discounts
- Stake-based rewards
- Volume tracking
- Efficient spread maintenance
- Volume-based incentives
- Anti-gaming protections
- Risk controls
// Initialize market with custom fee structure
var market = try Market.init(
allocator,
8, // shard count
&[_]FeeLevel{
.{ .volume_threshold = 0, .base_fee_bps = 50 },
.{ .volume_threshold = 100_000, .base_fee_bps = 30 },
},
.{
.enabled = true,
.discount_bps = 10,
.min_stake_time = 86400,
},
&[_]LpDiscountTier{
.{ .lp_amount_threshold = 10_000, .discount_bps = 5 },
},
);
defer market.deinit();
// Place order with automatic fee calculation
try market.placeOrder(
user_id: 1,
price: 1000,
amount: 10,
order_id: 1,
);
- Cross-market arbitrage
- Advanced order types
- Performance optimizations
- Enhanced fee models
- On-chain agent trading
- Automated market making
- Global order routing
- Advanced analytics
We welcome contributions in:
- Performance optimizations
- New order types
- Fee model enhancements
- Testing infrastructure