Sponsors who are willing to fund the project can send different whitelisted tokens, making it difficult to distribute the rewards.
After the contest is set up by the owner, either the organizer or sponsors will fund the yet-to-be-deployed proxy address. We assume that many sponsors want to support the project, so each sponsor can send different whitelisted tokens to the proxy contract. For example, Sponsor A can send USDC, and Sponsor B can send JPY tokens. This will result in a contract with different tokens to distribute.
If the protocol has 20 whitelisted tokens and sponsors send 20 types of tokens to the proxy contract, then the distribute function has to be called 20 times, each time with all the percentage calculations to determine how much each recipient should receive. This approach is not feasible and the system will eventually fail to distribute rewards fairly.
manual review
Instead of accepting all tokens as a fund, the contest should specify which token will be distributed as a reward. To do this, the organizer can specify the token to the owner. At the time of setContest, the owner can explicitly set the reward token in the storage mapping for that contestId.
Below is the example
This should be the updated set contest function with the new mapping of contestIdToRewardToken and new error ProxyFactory__NotWhiteListed()
We also need to check if the token sent for distribution is the same as the reward token or not in Distribution.sol
This is the updated code. please note that we are also sending the contestId in the parameter so update your off-chain data accordingly.
The update have one new error Distributor__InvalidRewardToken(); and one check in distribute function
Also, make sure to render the reward token in the frontend so sponsors can know which token to send.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.