capofficial / client

CAP protocol web client built with Svelte
https://cap.io
Other
2 stars 4 forks source link

Fix - 0x leverage #52

Closed janbsw closed 1 year ago

janbsw commented 1 year ago

Concerns issue #49.

As rounding shenanigans are the reason 0x leverage is possible, we just check if value < 1 and if so set it to be 1.

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
client ✅ Ready (Inspect) Visit Preview Dec 10, 2022 at 1:31AM (UTC)
kappacappa commented 1 year ago

@janbsw thanks, can you please confirm this has been tested on your local machine and works as expected? If so, I'll merge.

janbsw commented 1 year ago

Yes, although I think we have to do something like
if(value < 1 && !nullValue){ value = 1; // min leverage }

So sliders with integers only and Nullvalue can actually be zero

Also, this fix makes it so, there are basically 2 options for 1x leverage, not optimal. I've tested a lot of things and got the best result by restricting the slider progress.