openbook-dex / openbook-v2

openbook-v2 monorepo, contains solana program and ts client
Other
165 stars 96 forks source link

Feature/dont fail insufficient funds #197

Closed skrrb closed 1 year ago

skrrb commented 1 year ago

problem

in the current implementation, if the user doesn't have enough funds, during cancel_and_place_orders an spl-transfer error will be raised failing the entire tx

solution treat the input lots as an upper limit rather than as an exact amount; max_base_lots and max_quote_lots_including_fees are overridden with the user maximum amounts available