A Technical Whitepaper for Reflect Contracts

I wrote a technical whitepaper for Reflect Contracts. ↓
https://reflect-contract-doc.netlify.app/

In short, reflect contracts are tokens that have auto-staking mechanism built in. Safemoon, Octa, Lunarswap tokens, are some examples.

I decided to write the technical paper because there wasn’t one. In fact, if you look at the program , it is very hard to read and understand. I spent some time digging it to the program, tried to understand how it works, and then finally wrote the paper.

I think there are some grammar mistakes and some of the equations may be wrong.
Any feedback is welcome! And feel free to make Pull Request!

Sneak peak:


Source code: https://github.com/REGO350/reflect-contract-doc
PDF version: https://www.keepandshare.com/doc15/24269/reflect-technical-paper-pdf-822k?da=y

Thank you for taking time to write this paper. It really helped me to understand reflect algo. On your paper, you mentioned

RFI contracts has one fundamental issue over including users into staking. The conversion rate between
t-values and r-values is calculated using equa!on (5). Here, it is excluding non-stakers out of equa!on in
order to fully reward the stakers. However, when a new user gets included into staking, the rate updates,
thereby changing all stakers balance. Using this feature, it can be used to rug-pull rewards from stakers
by including a whale.

Could you elaborate more and give an example how rug-pull can happen? Thanks

What happens is that, when you include a user to staking (exclude from excludeStaking mapping), the conversion rate between t-value and r-value changes (look at equation 5). This results in distributing the reward also to the new user because stakers balance is calculated like this: balance[user] = rOwned[user] / rate. If you include a whale (maybe dev wallet), you will be able to take most of users' reward.

I'll try to make example code when I have time.

1 Like