Open
Conversation
f4f4a53 to
38b9e24
Compare
b8b8e59 to
a015945
Compare
b60be0a to
b3f1007
Compare
b3f1007 to
9ecca9c
Compare
44d8d93 to
17fc4e7
Compare
- Moved calculateDiscountedPrice, getUserTalentHoldings, and vault management methods from TalentPlusSubscription to TalentPlus - Updated TalentPlus constructor to accept TALENT token address and initial vault addresses - Fixed refund functionality in subscribe method (contract now receives tokens before distributing) - Updated price validation to allow price 0 when discount is 100% - Removed TALENT_TOKEN and vaultAddresses from TalentPlusSubscription - Updated TalentPlusSubscription constructor to only require owner address - Added comprehensive tests for new functionality - Updated deployment scripts to use new constructor signatures This refactoring allows TalentPlusSubscription to be replaced while keeping existing subscriptions, as payment logic is now decoupled in TalentPlus.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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