Frankencoin-ZCHF / frankencoin-dapp

Frankencoin Web App to interact with the Eco System
https://frankencoin.com/
MIT License
0 stars 4 forks source link

Support WFPS redemption #63

Open luziusmeisser opened 3 weeks ago

luziusmeisser commented 3 weeks ago

Currently, the equity page only allows selling FPS:

image

For example, this could be done by making the FPS thing a uniswap-inspired dropdown that allows the user to select WFPS:

image

Related to that, we should also show the WFPS and the Polygon WFPS balances of the user. (I'll create a separate issue for that.)

After selecting WFPS, it could look like this:

image
luziusmeisser commented 3 weeks ago

The function that is to be called when redeeming WFPS is different from the function for redeeming FPS. For WFPS, it is:

wfps.unwrapAndSell(uint256 amount)

See also here: https://etherscan.io/address/0x5052d3cc819f53116641e89b96ff4cd1ee80b182#writeContract

The maximum amount is the WFPS balance of the user. And to check the holding period, you have to get the FPS holding period of the WFPS contract, i.e.:

fps.holdingDuration(wfps)

image

At the time of writing, this is 5982719 seconds, or 69 days, so the button would be disabled!