-
Notifications
You must be signed in to change notification settings - Fork 101
fix: minimum staking reward calculation #1820
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
cvarley100
merged 5 commits into
feat/staking
from
fix/minimum-staking-reward-calculation
Dec 21, 2021
Merged
fix: minimum staking reward calculation #1820
cvarley100
merged 5 commits into
feat/staking
from
fix/minimum-staking-reward-calculation
Dec 21, 2021
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cvarley100
approved these changes
Dec 21, 2021
cvarley100
added a commit
that referenced
this pull request
Dec 21, 2021
* clean up tooltip code in Staking Indicator * Rollback returned type in StakingIndicator function that gets tooltip's parent coordinates * Localize staking indicator dynamic texts * replace locale with localize * Type position in tooltip * Remove unnecessary space * Remove wrong Button prop * replace locale with localize * feat: integrate ledger staking flow * fix: Update typings for `AccountParticipationOverview` * feat: Add better locale for event states in `StakingInfo` * feat: Add partially staked funds tooltip * feat: Add node compatibility check for participation plugin * feat: Change error message for staking action completions * feat: Add better reactivity and styling to `StakingManager` * chore: Update and adjust icons for account tiles * feat: Add text for bottom of `StakingManager` * chore: Make styling adjustments and fix account tiles * feat: Add background participation display for staking dashboard * feat: Add handling for if user can't stake any accounts * feat: Add particiaption websites to whitelist * feat: Add highlight for if staking is a new feature * fix: Remove staked accounts from send dropdowns * fix: Adjust calculation for airdrop rewards * fix: Adjust polling and querying for participation overview * fix: Adjust Ledger flow logic and move to staking dashboard component * feat: Work on transaction list aggregation * fix: Fix `stringFromUtf8Array` for bad input * feat: warn users on sending if funds are staked * feat: include warning text * fix: Get to working state without transaction aggregation * fix: Adjust reward calculation and formatting * chore: Refactor `participation.ts` * fix: Fix formatting function for Assembly rewards * fix: Adjust colors for Assembly and modify airdrop tiles * feat: Add airdrop staking indicators * fix: Adjust store calculation for staked accounts * fix: Fix reactivity in `StakingManager` * feat: Update `StakingInfo` with new graphics and code * feat: Adjust tx warning popup * feat: Add spinner for confirming stake tx * fix: Adjust staking airdrop indicator text * fix: Adjust popup warning * chore: Update some code * fix: Fix import paths for participation API bridge * feat: Adjust staking info button * feat: Make locale adjustment * fix: More adjustments * chore: update shimmer & assembly event IDs * feat: add a delay after staking / unstaking action * feat: check against shimmerStakedFunds when deriving state for staked accounts * fix: Adjust locale again :) * feat: display staked funds in transaction history * feat: Complete airdrop selection flow * feat: Adjust `StakingConfirmation` popup styling: * fix: Move back arrow to local popup and not general component * feat: call getParticipationOverview() when StakingManager component mounts (#1692) * fix: Change logic based on network status * fix: Add check in `StakingSummary.svelte` too * fix: Change store variable for staking event state * fix: Make adjustments to staking confirmation popup * fix: Switch backend to remote repo * update backend * Extract participation object from indexation payload (#1693) * feat: call getParticipationOverview() when StakingManager component mounts * feat: add a method for extracting participation object from indexation payload * feat: keep track of pending participations (#1695) this commit also stores new messages so that they are properly displayed in "latest transactions" tab * fix: remove code related to maintenance of pending participations (#1699) It is no longer needed as we need to maintain only account ids which we are already maintaining * fix: Change staked / unstaked amount calculation * fix: Improve token amount formatting in confirmation popup * chore: Update text for regular transfer warning * fix: Remove yellow checkmark from manager * fix: Change logic for showing event notice * fix: Adjust some formatting in summar and airdrop tiles * fix: ensure there is no crash when you are sending funds (#1700) * fix: Add more logic for selectable airdrop staking * temp: update devnet node * fix: Adjust UX for `StakingConfirmation` in partial stake flow * fix: Move locale data and remove some styling from some components * fix: Swap back arrow icon * feat: Add min stake reward state to `StakingIndicator` * Feat: Polish staking UI (#1705) * Polish staking account tiles * Improve CSS account tiles * Improve sidebar icons * Improve airdrop svg icons * Add missing props to voting icon * Update staking airdrop indicator bg * Fix minor CSS * Fix voting and staking transaction icons * Improve CSS for Staking Airdrop tiles * Remove debug code * feat: Add stubbed logic for min rewards indicator * feat: ensure atomicity when the state updates for staking/unstaking * temp: add beta logos * fix: update beta keychain and product name * chore: update version and product name for beta * temp: update keychain entry for beta * chore: disable logger * temp: enable dev tools * fix: Make some general fixes and adjust partial staking flow * chore: update backend rev * fix: tooltip positioning (#1710) Co-authored-by: Charlie Varley <charlievarley@MacBook-Pro.local> * fix: adjust UI to reflect staking end state (#1709) Co-authored-by: Charlie Varley <charlievarley@MacBook-Pro.local> * chore: Cleanup code for linter and add some fixes * test: Add mock to test * chore: fix naming * temp: fix notarization script for beta * fix: beta app name in notarize.macos.js * chore: Update event IDs for testing and fix some logic * chore: Update event IDs and cleanup files * fix: Add some fixes, adjust locale for event state * chore: point wallet-rs to latest * fix: rename method * test: Fix i18n mock for test suite * fix: Add missing return statement in time calculation * feat: check for staked funds rather than participations in stakedAccounts store * feat: change the way we detect if its staking for airdrop * fix: Adjust formatting for Assembly amount (based on data from node) * feat: make sure illustration view updates when the staking tx gets confirmed * update: change participation event ids * updates: remove old event ids * Fixed a typo (#1717) Changing "worls" to "worlds". * Feat: Polish staking UI (#1715) * Replace staking illustrations with animation. + Minor CSS fixes * Add airdrop bg videos * Retouch staking view panes CSS * Add max height to popup to prevent small screen cut * fix darkmode staking contrasts * fix: another typo (#1719) Changed "repspective" to "respective". * fix: Adjust reward amount formatting * chore: Update event IDs for more dev work * fix: Re-point backend to correct `wallet.rs` revision * fix: Removing unstake warning popup if not in holding or commencing phase * Feat: Polish staking UI (#1723) * Add videos to public build gitignore * improve icon sizings * Improve staking indicator CSS and icons * Improve bottom tooltip * add darkmode to text to allow disabled * fix staked & staked for * fix send from staked account warning in darkmode * Add new styles for AccountTiles states * fix: Fix logic for calculating staked, unstaked, and partially staked funds * feat: display a proper node error if participation plugin is not available (#1728) * chore: updaet cargo lock file * feat: log a proper error in error log if node doesn't have a participation plugin * chore: fix trailing semicolon Co-authored-by: Charlie Varley <charlievarley@MacBook-Pro.local> * fix: ensure unstake warning does not show after the event has finished (#1726) * fix: ensure unstake warning does not show on send after the event has finished * chore: formatting fixes * fix: cleanup checks for staking ended * chore: fix comment * fix: adjust isStakingPossible logic Co-authored-by: Charlie Varley <charlievarley@MacBook-Pro.local> * update: assembly video animation (#1729) Co-authored-by: Charlie Varley <charlievarley@MacBook-Pro.local> * update: bump backend revs * fix: Adjust logic for displaying `AccountTile` UI * update: change event ids and nodes * fix: Fix choice disabling logic for participating airdrops (#1731) Co-authored-by: Charlie Varley <charlievarley@MacBook-Pro.local> * fix: Adjust algo for calculating partially staked amount (#1732) Co-authored-by: Charlie Varley <charlievarley@MacBook-Pro.local> * chore: fix duplicate definition * fix: remove unnecessary send warning check * update: chrysalis string * fix: Use function param as intended in delineator function (#1739) * fix: amount input (#1738) * fix: Fix bug in `Amount.svelte` for conversions * fix: Address `NaN` issue with near zero conversions Co-authored-by: Nicole O'Brien <nicole.obrien@iota.org> Co-authored-by: Nicole O'Brien <nicole.obrien@iota.org> * fix: Adjust event IDs * Feat: Polish staking UI (#1733) * Bugfix tooltip zindex * Retouch airdrop reward/time CSS * Reduce staking font-size amount to 1.5rem (same size as wallet dashboard) * polish staking overview module ui * Add wallet preview for staked/unstaked wallets on each project * polish airdrop project texts * refine staking pulsing indicator * Add round checkbox * update staking confirmation popup to new ui * update: chrysalis string * Add airdrop network popups * fix partial staking darkmode * Add airdrop account tile open popup * Add staking info popup assets * fix wrong merge * update: change dummy strings Co-authored-by: Charlie Varley <charlievarley@MacBook-Pro.local> * feat: stop participation overview poll if node does not have the plugin (#1734) * chore: update lock file * feat: stop polling if node does not have participation plugin This commit also ensures to reinitialise participation plugin polling when a user changes node * chore: fix formatting; Co-authored-by: Charlie Varley <charlievarley@MacBook-Pro.local> * feat: minimum reward time (#1735) * feat: Add calculation for remaining minimum reward time * feat: Move min airdrop tooltip into wallet dashboard * fix: Adjust some logic for `AccountTile.svelte` * fix: Add better locale entries for min rewards * feat: Add better tooltip messages * fix: Show warning for unstaked accounts * feat: Add tooltip text for `ended` event state * fix: Remove tooltip warning for unstaked accounts Co-authored-by: Charlie Varley <charlievarley@MacBook-Pro.local> * chore: Cleanup code * chore: Add code comments, cleanup locale, and an missing unsubscribe call * fix: improve Ledger staking flows (#1740) * fix: ensure popup closes when rejecting ledger staking tx * fix: ensure stake/unstake buttons reenable after successful stake/unstake * chore: remove unnecessary prop * fix: add ledger connect prompt while staking * chore: remove unnecessary return statement Co-authored-by: Charlie Varley <charlievarley@MacBook-Pro.local> * Feat: refactor tooltip component (#1744) * refactor tooltip component * fix linting warning * chore: remove unused store * chore: Change wording to "merge" rather than "stake" for partially staked funds * fix: make close settings go back to previous tab (#1747) * fix: prevent localise warning on logout (#1745) * fix: set primary node on new profile (#1746) * fix: set random primary node on new profile * fix: make code more DRY * fix: prevent staking on an account while it has unconfirmed transactions (#1749) * fix: prevent staking on an account while it has unconfirmed transactions * fix: improve formatting * fix: rename canAccountParticipate to getAccountParticipationAbility * chore: Add locale strings for min balance tooltips * update: finalise staking strings (#1752) Co-authored-by: Charlie Varley <charlievarley@MacBook-Pro.local> * feat: adjust merge stake behaviour (#1755) * update: finalise staking strings * feat: ensure merge stake cannot change airdrops Co-authored-by: Charlie Varley <charlievarley@MacBook-Pro.local> * fix: add wiki to allow list (#1754) * Feat: Polish staking UI (#1751) * polish staking info pane for large screens and animation jump * Right align right element in project pane & switch order * refine staking info aspect ratio * fix airdrop project pane in large screens * remove red border around staking airdrop indicator when red * hotfix svg slow css transition * replace inline css in account tile for scss * apply yellow for warning & orange for staking tx * fix account tile name overflow * fix text overflows in airdrop selection * align updating wallet text * adjust account tile min height * refine css in checkbox button for dev profile * move autofocus on popup to first element * add dark color to send from staked account disclaimer * Display error notification when staking / unstaking operation fails (#1748) * chore: update cargo lock file * feat: display error notification when staking / unstaking operation fails * fix: use existing error types for displaying participation error notification * chore: fix formatting Co-authored-by: Charlie Varley <charlievarley@MacBook-Pro.local> * update: change event ids * fix: import * fix: styling issues * fix: change the way we calculate staked / unstaked balance (#1761) * fix: change the way we calculate staked / unstaked balance * fix: formatting Co-authored-by: Charlie Varley <charlievarley@MacBook-Pro.local> * fix: close staking manager if the staking event state is inactive (#1762) Co-authored-by: Charlie Varley <charlievarley@MacBook-Pro.local> * update: staking event ids * fix: update UI elements when staking event state changes (#1764) * Feat: Update T&Cs (#1763) * Update terms & conditions * add missing space * fix: minimum reward time (#1753) * fix: Add safe prop access in lib functions * feat: Add explanatory tooltip for min airdrop in `StakingManager` * fix: Do NOT display tooltip for min rewards if account already has rewards * feat: Add calculation of remaining IOTAs to reach min reward * chore: Cleanup code and ready for merge * fix: Add better text for `StakingIndicator` if ended and reward not met * fix: Fix broken import and slightly uneven styling * fix: Add logic for handling if in commencing phase * fix: increase x padding on StakingAirdropIndicator * fix: minimum balance logic for initiating staking * fix: formatting * fix: reduce calls to pollParticipationOverview and prevent more than 1 polling interval. Co-authored-by: Charlie Varley <charlievarley@MacBook-Pro.local> Co-authored-by: Nicole O'Brien <nicole.obrien@iota.org> * update: event ids * Feat: Polish Staking UI (#1767) * remove non existing tailwing class * Bugfix tooltip flicker * Make popup autofocus optional and disable for staking manager * Remove unnecessary padding in backup popup * Retouch CSS airdrop project tiles * tweak css staking account pills * update: block staking if wallets are currently syncing (#1769) Co-authored-by: Charlie Varley <charlievarley@MacBook-Pro.local> * update: event ids * Feat: Show staking sidebar notification per profile and on partial stake (#1779) * fix: decimal separator in amount (#1776) * fix: Add formatting to displayed number in `Amount.svelte` on MAX click * fix: Use `formatNumber` rather than `formatCurrency` * Make staking blob notification in sidebar per profile * show staking notification upon detcting (new)unstaked funds * show staking sidebar notification when event active and unstaked funds increase * rename variable * fix unstaked funda notification Co-authored-by: Matthew Maxwell <44885822+maxwellmattryan@users.noreply.github.com> Co-authored-by: Charlie Varley <charlievarley@MacBook-Pro.local> * fix: use account ID instead of index when getting migration address for ledger (#1775) * fix: use account ID instead of index when getting migration address for ledger * chore: rename account index to account identifier * chore: use AccountIdentifer type * Fix: reactivity not working in wallet txs overview & below minimum account tile (#1788) * Fix minimum stake reactivity in account tile * Fix profile history txs reactivity * cleanup css * fix staking welcome delay (#1789) * feat: fix minimum reward edge cases (#1783) * fix: minimum airdrop time left calculation * fix: staking confirmation minimum reward logic * fix: account tile minimum reward tooltip logic * fix: minimum reward blocks during pre-staking * fix: minimum airdrop calculation for pre-staking * update: event ids * Merge remote-tracking branch 'origin/feat/staking' into feat/minimum-rewards Co-authored-by: Charlie Varley <charlievarley@MacBook-Pro.local> Co-authored-by: Nicole O'Brien <nicole.obrien@iota.org> * fix: disable accounts with pending transactions (#1791) * fix: Add disabled button for on pending message confirmations * fix: Disrupt original flow less and just disable non-actioned accounts * fix: zen guy for both airdrops (#1794) * fix: Fix some punctuation in `ja.json` locale * fix: Change logic for determining zen guy animation * chore: resolve conflicts * fix: no balance string * fix: locale time formatting (#1800) * temp: disable mqtt * fix: Adjust formatting for time strings: Co-authored-by: Charlie Varley <charlievarley@MacBook-Pro.local> * fix: Change UI logic to not rely on whitespace (locales will be different) (#1792) * fix: consistent icon sizes (#1798) * fix: sizing of icons on staking manager * fix: size of icons on staking confirmation * fix: format multiple messages in tooltip (#1799) * fix: sizing of icons on staking manager * fix: size of icons on staking confirmation * fix: improve formatting of multiple messages in tooltip * fix: add margin to tooltip Co-authored-by: Charlie Varley <charlievarley@MacBook-Pro.local> * chore: resolve conflicts * Add airdrop zen animation for each side (#1802) Co-authored-by: Charlie Varley <charlievarley@MacBook-Pro.local> * Feat: fix tooltip issues (#1801) * fix tooltip flickering in staking indicator * fix account tile tooltip zindex * fix account tile tooltip z-index using css * fix css Co-authored-by: Charlie Varley <charlievarley@MacBook-Pro.local> * Re-render account component only by selected account ID (#1803) * tests: update time.test.ts (#1807) * fix: remove tooltip on balance summary (#1808) * Feat: UI fixes (#1805) * fix disabled colors for caution button * update assemvly video * update airdrop bg colors to match videos * increase tooltip offset to avoid border overlap with anchor * fix: staking notification badge logic and colour (#1809) * update: staking badge colours * fix: staking notification badge logic * fix: cant read value of undefined in store * fix: close popup in openSettings function (#1810) * chore: Add exclamation to staking welcome toast notification * add link to airdrop network info (#1812) * fix: improve account tile styling (#1811) * update: remove ledger icon from account tile * update: change styling of account tile background * fix: remove accidental change * fix: formatting Co-authored-by: Charlie Varley <charlievarley@MacBook-Pro.local> * fix: add correct staking link (#1814) Co-authored-by: Charlie Varley <charlievarley@MacBook-Pro.local> * fix: check for activeProfile object before accessing migratedTransactions prop (#1815) * chore: Re-write conditional statements in proper way * Feat: Add tooltip to wallet staking (#1817) * add reusable wallet pill component * update wallet navigation to new wallet pill * add wallet pill with tooltip to airdrop project summary * Feat: minor UI fixes (#1818) * update shimmer video * improve disabled warning button in darkmode * feat: remove wallet staking tooltip string (#1819) * add reusable wallet pill component * update wallet navigation to new wallet pill * add wallet pill with tooltip to airdrop project summary * fix: remove new string Co-authored-by: Begoña Alvarez <balvarez@boxfish.studio> Co-authored-by: Charlie Varley <charlievarley@MacBook-Pro.local> * fix: minimum staking reward calculation (#1820) * temp: logging for debugging * chore: Remove console logs and fix some TSDoc comments * fix: Only display tooltip body paragraph if time above zero * chore: Cleanup code Co-authored-by: Nicole O'Brien <nicole.obrien@iota.org> * fix: double / negative balance issues & account specific transactions reactivity issue (#1821) * fix: resolve double / negative balance bugs * fix: resolve account view (tx) reactivity issue * chore: remove unused code Co-authored-by: Charlie Varley <charlievarley@MacBook-Pro.local> * fix: ui fixes Co-authored-by: Nicole O'Brien <nicole.obrien@iota.org> * fix: incorrect icon * update: event ids * fix: merge staking selection logic (#1824) Co-authored-by: Zuiev <zitvura@gmail.com> Co-authored-by: Begoña Alvarez <balvarez@boxfish.studio> Co-authored-by: Umair Sarfraz <aquadestructor@icloud.com> Co-authored-by: Charlie Varley <cvarley100@gmail.com> Co-authored-by: Charlie Varley <charlievarley@MacBook-Pro.local> Co-authored-by: Umair Sarfraz <umair.sarfraz@iota.org> Co-authored-by: Thoralf-M <thoralf.mue@gmail.com> Co-authored-by: Nicole O'Brien <nicole.obrien@iota.org> Co-authored-by: Richard K <17240275+r-c-k@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of change
Fixes the logic for some edge cases around calculating the minimum reward time for either staking airdrops.
Links to any relevant issues
None
Type of change
How the change has been tested
Platforms:
Cases:
rewardsandrewardsBelowMinimumfields in theAccountParticipationOverviewtype must both be non-zeroChange checklist