Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR: Migrate TalentPlus to USDC-Only Payments
Overview
This PR migrates the TalentPlus subscription system from ETH payments to USDC (ERC20) payments only. The changes ensure a more stable payment mechanism using a stablecoin while maintaining all existing functionality including TALENT-based discounts and subscription management features.
Changes Summary
🔄 Contract Changes
1. TalentPlus.sol
payablemodifier andmsg.valuehandling)subscribe()function now acceptstokenAmountparameter instead of ETHfinalPricetopricePaidKey Changes:
paymentTokenaddress (USDC:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913on Base)2. TalentPlusSubscription.sol
priceInEth→pricethroughout the contractpriceinstead ofpriceInEthpriceinstead ofpriceInEthKey Changes:
addSubscriptionModel():priceInEthparameter →priceparameterupdateSubscriptionModel():priceInEthparameter →priceparametergetSubscriptionModel(): Returnspriceinstead ofpriceInEthcalculateDiscountedPrice(): Usesmodel.priceinstead ofmodel.priceInEth🧪 Test Updates
1. TalentPlusSubscription.ts
model.priceInEth→model.price(2 occurrences)2. TalentPlus.ts
beforeEachpaymentTokenparameter{ value: ... }) with token paymentssubscribe()calls to usetokenAmountparameterfinalPrice→pricePaid📜 Script Updates
1. deployTalentPlus.ts
0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913deployTalentPlus()call to include USDC address2. shared/index.ts
deployTalentPlus()function signature to acceptpaymentTokenparameterBreaking Changes
TalentPlus Constructor
TalentPlus.subscribe()
TalentPlusSubscription Functions
TalentPlus.SubscriptionCreated
Migration Guide
For Users
Approve USDC Spending
Subscribe with USDC
Testing
All tests have been updated and are passing:
Run tests with:
Security Considerations
nonReentrantmodifierBenefits
Deployment Checklist
Files Changed
Contracts
contracts/talent_plus/TalentPlus.solcontracts/talent_plus/TalentPlusSubscription.solTests
test/contracts/talent_plus/TalentPlus.tstest/contracts/talent_plus/TalentPlusSubscription.tsScripts
scripts/talent_plus/deployTalentPlus.tsscripts/shared/index.tsRelated Issues
Notes
0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913