When we were scoping and building Invite code & Referral program we faced with some challenges (which now is a part of our roadmap):
- How do we enable a multi-program, multi-tenant referral program? We wanted a possibillity to run simultaneously 2+ referral programs without depluying a new instance of app;
- How do we enable a targeted referral programs, eg., the program used to grow usage of only Aave delegated credit capabilty? How do we generalize key concepts common to almost any protocol or a dApp (such as liquidity providers or revenues/fees)? We used 0x address of a user as a unique identifier of an invite/revenue share programs.
- Storing the invite codes offchain is acceptable for the first version of app but we consider moving this storage onchain and organise in structure based on Merkle tree.