MeteoraAg / dlmm-sdk

An SDK for building applications on top of Dynamic CLMM
68 stars 57 forks source link

SDK Swap example has an infinite loop... #95

Open impactdni2 opened 3 months ago

impactdni2 commented 3 months ago

https://github.com/MeteoraAg/dlmm-sdk/blob/main/commons/src/quote.rs#L126-L148

With certain inputs into swap, causes an infinite loop where amount_in > 0 (keeps the outer loop looping), and the bin_array is outside the range (error), so it breaks the inner loop.

Without the actual code for the program (#60 ) its hard to know how this matches up, but my guess is the amount_in check needs to break the inner loop, and the is_bin_id_within_range needs to advance the active bin and then break?