-
Notifications
You must be signed in to change notification settings - Fork 73
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
feat: implement Affiliates protocol interactions #1074
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks sane!
though i'm wondering if it's worth making a slice for affiliates. don't know if there's challenges to this, but i feel like all the affiliates functionality could be in a single high level hook that depends on useSubaccount
etc.
The slice is basically to leverage redux-persist, since we are deprecating our localstorage hooks. |
Implement Affiliate read and writes to the validator.
When a user lands on a referral link, we store the referral address to redux-persist via the affiliates slice. As soon a the user has a balance, we will call
registerAffiliate
to register the affiliate, and then remove the affiliate from localstorage.most of the logic is in useSubaccount for detecting the user wallet balance and affiliate address in localstorage to send the
registerAffiliate
transaction.update src/hooks/useAffiliatesInfo.ts to fetch for affiliate info from both the indexer and the protocol, check for eligibility by determining volumeEligibility and isWhitelisted
Add
getAffiliateInfo
andgetReferredBy
calls touseDydxClient
create useReferredBy hook for getting the referredBy address
added a dev only account menu item for testing RegisterAffiliate.