publishers
publishers copied to clipboard
add usdc options
Resolves https://github.com/brave-intl/creators-private-issues/issues/1804
The following commits were not verified: 77f02294aebcbbfe3905af7d8cc72b9d9e558d17 (unsigned)
[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
andbat_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!