Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

[Claim] Revoke Approval hook #2249

Merged
merged 11 commits into from
Jan 25, 2022
Merged

[Claim] Revoke Approval hook #2249

merged 11 commits into from
Jan 25, 2022

Conversation

W3stside
Copy link
Contributor

@W3stside W3stside commented Jan 21, 2022

Summary

This exists purely as a positive side-effect of having to create this function when testing approve logic in #2175 - doesn't have to stay but think it's useful or at least almost at a useful state.

High-level description of what your changes are accomplishing
Allows "revoking" approval of a token for a spender. Sets approve to "0" - maybe there's a better way or even a native unapprove method but this is what I have for now.

image

To Test

  1. approve a token on claim
  2. revoke button, click it

@W3stside W3stside changed the base branch from develop to claim-approve-optional-param January 21, 2022 14:35
@W3stside W3stside force-pushed the claim-revoke-approve-hook branch from b5553b6 to 0faa470 Compare January 21, 2022 14:37
@W3stside W3stside marked this pull request as ready for review January 21, 2022 14:39
@W3stside W3stside requested review from a team January 21, 2022 14:40
@github-actions
Copy link
Contributor

  • 🔭 GP Swap: Gnosis Protocol v2 Swap UI

@elena-zh
Copy link

@W3stside , now Approved! is displayed even for an account that has not approved this token before
image

It is displayed right after I change an account after claim. it might be displayed up to 30 sec (or so)
See the video: https://watch.screencastify.com/v/KwVzg2Qv3nhEif1Mho6n

Can we do something with this?

@elena-zh
Copy link

Another question: when I press on the Revoke button, I see 'Approving..' modal.
Maybe we could name it 'Revoking approval'?
image

The same with the sent request to the connected wallet.
It would be great to show transaction log and toast message nicer
image

@W3stside W3stside changed the title Claim revoke approve hook [Claim] Revoke Approval hook Jan 21, 2022
@W3stside
Copy link
Contributor Author

Another question: when I press on the Revoke button, I see 'Approving..' modal. Maybe we could name it 'Revoking approval'? image

The same with the sent request to the connected wallet. It would be great to show transaction log and toast message nicer image

I think this pr is more for testing the base pr of approvals, if we decide we want this we can fix that for sure

@fairlighteth
Copy link
Contributor

Agree, if we implement it, modals should reflect that. I understand this is for testing purposes with the option to actually expose it at all times?

In the investment flow, the only scenario I can see someone revoking is when they approved and changed their mind. Because once claimed they'd never see that screen again? Unless they're claiming for multiple accounts.

In general I like giving this control to the user. But feel a more central place (approvals management?) better serves this functionality. That being said, doesn't hurt to keep it the way you showed it.

Copy link
Contributor

@alfetopito alfetopito left a comment

Choose a reason for hiding this comment

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

Love the idea and it's working great.

Minor comments about the UI adding on top of Elena's comments:

The inner modal still says approving
Screen Shot 2022-01-21 at 10 14 25

When the revoke is being mined, there's no feedback in the page.
Would be nice to have it like we do for the approval:
Screen Shot 2022-01-21 at 10 16 23

Copy link
Contributor

@anxolin anxolin left a comment

Choose a reason for hiding this comment

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

We can merge, use it for testing, but after i think is ok to delete the button (the hook could be left around in case we need it, or users ask for this).

Not strongly opposed to it, but i wouldn't do it.
Reason are same as @biocom.

Since this is there, if users ask for it, we can add it back.

APPROVING with comments

@@ -233,6 +292,11 @@ export default function InvestOption({ claim, optionIndex, openModal, closeModal
)}
</ButtonConfirmed>
)}
{isAlreadyApproved && (
<UnderlineButton disabled={approving || !isAlreadyApproved} onClick={handleRevokeApproval}>
Revoke approval
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add a (Test only) if we want to merge this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll remove this if we merge

@W3stside W3stside force-pushed the claim-revoke-approve-hook branch from 6ab360c to d4c96e9 Compare January 22, 2022 23:41
@W3stside W3stside force-pushed the claim-approve-optional-param branch from 5bfd28e to 433afe4 Compare January 24, 2022 14:40
@W3stside W3stside force-pushed the claim-revoke-approve-hook branch from d4c96e9 to 37644ce Compare January 24, 2022 14:45
@github-actions
Copy link
Contributor

  • 🔭 GP Swap: CoW Protocol v2 Swap UI

@elena-zh
Copy link

Works fine to me now!
The only thing I can report is the same as @alfetopito has mentioned above: need to change text in the 'Revoking' modal
revoking

@W3stside W3stside force-pushed the claim-approve-optional-param branch from 433afe4 to 8956e62 Compare January 25, 2022 11:55
@W3stside W3stside force-pushed the claim-revoke-approve-hook branch from 37644ce to eece0ba Compare January 25, 2022 11:57
Base automatically changed from claim-approve-optional-param to release/1.10 January 25, 2022 12:08
@W3stside W3stside force-pushed the claim-revoke-approve-hook branch from eece0ba to 63a9031 Compare January 25, 2022 12:18
Copy link

@elena-zh elena-zh left a comment

Choose a reason for hiding this comment

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

LGTM now!

@W3stside W3stside merged commit 7355deb into release/1.10 Jan 25, 2022
@W3stside W3stside deleted the claim-revoke-approve-hook branch January 25, 2022 15:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants