publishers icon indicating copy to clipboard operation
publishers copied to clipboard

add usdc options

Open jlbyrne opened this issue 9 months ago • 1 comments

Resolves https://github.com/brave-intl/creators-private-issues/issues/1804

jlbyrne avatar May 08 '24 03:05 jlbyrne

The following commits were not verified: 77f02294aebcbbfe3905af7d8cc72b9d9e558d17 (unsigned)

github-actions[bot] avatar May 22 '24 15:05 github-actions[bot]

[puLL-Merge] - brave-intl/publishers@4434

Here is my review of the pull request:

Description

This PR makes several changes to add support for USDC payments on both Ethereum and Solana in the crypto payment widget on public channel pages. It pulls the USDC contract addresses from environment variables and allows users to select USDC as a payment option. It also updates some dependencies.

Changes

Changes

.github/workflows/test.yml

  • Adds a new environment variable BAT_RATIOS_URL for tests

Gemfile, Gemfile.lock

  • Updates webmock gem to version 3.23
  • Updates selenium-webdriver gem to version 4.4

app/assets/images/usdc_icon.svg

  • Adds a new icon for USDC

app/controllers/public_channel_controller.rb

  • Pulls USDC contract addresses from environment variables and passes them to the view

app/javascript/locale/en.ts

  • Adds copy for USDC payment options

app/javascript/views/publicChannelPage/CryptoPaymentWidget.jsx

  • Adds USDC as a selectable payment option
  • Implements logic to send USDC payments on Ethereum and Solana
  • Fixes amount calculation for USDC to use the correct number of decimal places
  • Refactors Ethereum token payment logic into reusable function
  • Adds a CSS class name to the currency dropdown

app/javascript/views/publicChannelPage/erc20Abi.json

  • Adds ABI for standard ERC20 token contracts

config/secrets.yml

  • Uncomments bat_ratios_token and bat_ratios_url config needed for tests

package.json

  • Updates web3 dependency to version 4.8.0

test/*

  • Adds feature tests for the public channel page
  • Enables VCR for tests that make external HTTP requests

Security Hotspots

The main security consideration is pulling the USDC contract addresses from environment variables. Need to ensure these are set to the correct addresses for mainnet to avoid any issues.

The other changes look fairly low risk from a security perspective. The ERC20 and Solana token transfer logic follows established practices.

Let me know if you have any other questions!

github-actions[bot] avatar May 22 '24 15:05 github-actions[bot]