liquity / ChickenBond

GNU General Public License v3.0
32 stars 5 forks source link

Frontend won't load when market premium is below "1 - fee" #192

Closed danielattilasimon closed 1 year ago

danielattilasimon commented 2 years ago

The cause is uncaught exception originating from here: https://github.com/liquity/dev/blob/e76b000e9558640e9479b8080786a9fbc47ed570/packages/dev-frontend/src/components/Bonds/context/api.ts#L112-L118

The frontend should explicitly handle (rare) scenarios when break-even is impossible.

Edit: hacking around the above failure reveals another issue here: https://github.com/liquity/dev/blob/e76b000e9558640e9479b8080786a9fbc47ed570/packages/dev-frontend/src/components/Bonds/context/api.ts#L84

When the market premium is insufficient, the rebonding ROI will be negative, which is not currently supported by Decimal. We might be fine with just a regular old number instead.