wildcards-world / ui

Wildcards project - Always for sale NFT's used to raise money for endangered animals through harberger patronage
https://wildcards.world
11 stars 4 forks source link

fixed monthly contribution in UI + fixed some spelling #126

Closed ChrisTritton closed 2 years ago

ChrisTritton commented 2 years ago

The monthly contribution number under 'User Profile' in UI is now correct for foreclosed patrons - people who's deposit has actually run out not just when (patron.isMarkedAsForeclosed = true) - because this is a lagging variable.

vercel[bot] commented 2 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/avolabs/ui/HmBMVh6p7pAj9ox8FeE1yErgtVAt
✅ Preview: https://ui-git-chris1-avolabs.vercel.app

ChrisTritton commented 2 years ago

No problem, I know you're super busy, this will make it quicker for you:

The only change that isn't adding comments or fixing spelling in this PR, is:

in UserProfile.res where the monthly wei and dai is contributed is calculated, for both these calcs, all I've done is add a check to see if the useIsForeclosed QlHook (line 123) thinks the patron is foreclosed or not. If true, then the calc returns zero because they clearly are not contributing monthly anymore. This fixes the 'monthly contribution' number on the UI under the patron's profile.

The problem was that the monthly contribution calcs use a graph variable patronTokenCostScaledNumerator which is lagging unless there is a txn to foreclose. The useIsForeclosed hook is super cool because it actually calcs the true remaining deposit in real time

Will add more conclusive comments in future so that it's faster for you 🥇