Skip to content
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

Prevent finalizing a Task with insufficient domain pot balance #2030

Merged

Conversation

rdig
Copy link
Member

@rdig rdig commented Feb 6, 2020

Description

This PR fixes the bad UX pattern where a task can be finalized with a payout larger then available funds in the domain pot.

The user would be allowed to press Finalize Task, generate the transaction, sign it, but as expected, the transaction would fail (with a rather cryptic error message)

The fix for this implies calculating the that task payout relative to the domain pot balance, and in the funds are not sufficient, show a dialog informing the user of that fact, otherwise proceed as nromal.

New stuff

  • TaskFinalize component
  • TaskFinalizeDialog dialog component

Changes

  • Refactor Task to extract the finalize button into it's own component (TaskFinalize)
  • Fix Task to use the ROOT_DOMAIN constant, rather then the number 1

Demo

demo-prevent-insufficient-funds-payouts

Resolves #1952
Resolves #1997

@rdig rdig requested review from chmanie and ceolson01 February 6, 2020 14:10
@rdig rdig self-assigned this Feb 6, 2020
Copy link
Contributor

@ceolson01 ceolson01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, nice improvement 🙌

Just one quick thing with typings!

@rdig rdig force-pushed the fix/1952-prevent-finalizing-task-with-more-tokens-then-in-pot branch from dc25d7b to 25f5f25 Compare February 7, 2020 10:07
@rdig
Copy link
Member Author

rdig commented Feb 7, 2020

@ceolson01

Yup, took your advice on the domains balances logic and now works like a charm. Thanks!

This is ready for another look.

Copy link
Contributor

@ceolson01 ceolson01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heck yes! ✅

Great stuff

@rdig rdig force-pushed the fix/1952-prevent-finalizing-task-with-more-tokens-then-in-pot branch from 25f5f25 to cce5935 Compare February 10, 2020 11:56
@rdig rdig merged commit 6e34327 into master Feb 10, 2020
@rdig rdig deleted the fix/1952-prevent-finalizing-task-with-more-tokens-then-in-pot branch February 10, 2020 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants