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

Accept ERC-20 tokens instead of ETH #87

Merged
merged 1 commit into from
Jun 28, 2024
Merged

Accept ERC-20 tokens instead of ETH #87

merged 1 commit into from
Jun 28, 2024

Conversation

guidanoli
Copy link
Contributor

Closes #85

@guidanoli
Copy link
Contributor Author

Rollmelette 0.1.0 has a bug on ERC-20 withdraw vouchers having the wrong destination address.
See rollmelette/rollmelette#2 for more information on that.

@guidanoli guidanoli changed the base branch from main to feature/bump-rollmelette April 27, 2024 02:21
@guidanoli
Copy link
Contributor Author

Rollmelette v0.1.1 has fixed this bug.
A bump is performed by PR #89, which this PR is based on.

Base automatically changed from feature/bump-rollmelette to main May 3, 2024 12:30
@guidanoli guidanoli force-pushed the feature/erc-20 branch 3 times, most recently from 84c6772 to 57f28b4 Compare May 17, 2024 04:53
@guidanoli guidanoli changed the base branch from main to feature/frontend-refactor May 17, 2024 04:53
@claudioantonio claudioantonio added this to the Testnet 2/2 milestone May 22, 2024
@guidanoli guidanoli force-pushed the feature/frontend-refactor branch from cf79d97 to bd0031d Compare May 22, 2024 19:34
@guidanoli guidanoli changed the title Support ERC-20 tokens Accept ERC-20 tokens instead of ETH May 23, 2024
@claudioantonio claudioantonio added a-frontend Area: front-end a-backend Area: back-end labels May 27, 2024
Copy link

vercel bot commented May 28, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
bug-buster ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 22, 2024 7:41pm

@guidanoli guidanoli marked this pull request as ready for review June 22, 2024 19:40
@guidanoli guidanoli requested a review from claudioantonio June 22, 2024 19:40
@guidanoli
Copy link
Contributor Author

guidanoli commented Jun 22, 2024

Here's an overview of the changes:

Back-end

  • No longer accept inputs from the Ether portal
  • Start accepting inputs from the ERC-20 portal
  • Add Token field to AppBounty and CreateAppBounty structs
  • Check if sponsorships use the token established by developer

CLI

  • Update sponsor command to use the ERC-20 portal

Tests

  • Refactor advance_ether_deposit into advance_erc20_deposit
  • Define several dummy ERC-20 token contract addresses
  • Add token field to sponsorship inputs and expected states

Front-end

  • Update state and input schema
  • Add required "Token" field to bounty creation form
  • Add auxiliary "Token" field to sponsorship form for extra reference (see screenshot below)
  • Display ERC-20 token amount instead of ETH, using symbol and decimals, when available
  • Add hover card to ERC-20 token symbol to show the token contract address
  • Add "Approve" button to sponsorship form
  • Update voucher decoding logic, now only expecting transfer function calls
  • Update "add sponsorship" hook to interact with the ERC-20 portal

@guidanoli
Copy link
Contributor Author

guidanoli commented Jun 22, 2024

Hovering your cursor over the ERC-20 token symbol will display the token contract address. This is important because anyone can create a fake ERC-20 token contract with the same symbol as a real one. The address is meant to distinguish the two.

image

Observation: with the hover card component from Mantine, it is possible to select the token address, and copy it. It's not a tooltip, it's an actual React component.

@guidanoli
Copy link
Contributor Author

I've also taken inspiration from the Rollups Explorer when dealing with ERC-20 tokens. Also, buttons related to transactions show a "loading" animation when user input is requested through a wallet browser extension.

image

@guidanoli
Copy link
Contributor Author

Also, the sponsorship form now has a disabled "Token address" field to show the address of the ERC-20 token set by the developer during creation.

image

@guidanoli
Copy link
Contributor Author

I've also added this "loading" animation to the "Test" button on the exploit form.

image

Copy link
Contributor

@claudioantonio claudioantonio left a comment

Choose a reason for hiding this comment

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

LGTM! Kudos!

@claudioantonio claudioantonio removed this from the Testnet 2/2 milestone Jun 28, 2024
@guidanoli guidanoli merged commit 55dad32 into main Jun 28, 2024
2 checks passed
@guidanoli guidanoli deleted the feature/erc-20 branch June 28, 2024 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-backend Area: back-end a-frontend Area: front-end
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support ERC-20 tokens
2 participants