What exactly is rTotal? When calculating it, it gives an extremely large number. I can understand that it’s supposed to stand for reflection total, but why is that different than the total supply? What am I missing about the conversion? I have a feeling it has to do with the way ethereum looks at the total supply rather than a human does.
@Skyge hey Skyge, what does rTotal actually represent in this situation. I understand that the total supply is just that, the total token supply, but what is rTotal trying to show here? Does it mean realTotal? As in the real token supply, combined with decimals?
Thanks Skyge! Yeah I’m having a hard time figuring out why exactly they did that in RFI code. I can understand the math, but why is another story haha.
I will probably end up figuring out why it’s exactly doing that after I test deploy and start messing with reflect fees and LP swaps.
Sorry to the OP for bumping this thread, but it’s relevant to figuring out what that code actually does, not just the MAX part.
I tried to get in touch with the RFI team, but to no avail.
When reading through the code it looks like it really does stand for “total reflections”.
Later on in the code it has a requirement
function tokenFromReflection(uint256 rAmount) public view returns (uint256){
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = getReflectRate();
return rAmount.div(currentRate);
}
But this begs the question of why does _rTotal start out extremely large? Does it mean the Total Possible Reflections?
Nope, but it the code works, reflection tokens are split between all holders of the token. Perhaps in the future there will be a standardized way to take a tax of a transaction and split it among all holders.
Not sure, if you could, could you try to ask in RFI Telegram? I tried but got no response. It would help a lot of people if you got an answer from them.
So I’m not the only one who is confused as hell about this contract which turns out SafeMoon.sol also cloned. My understanding is it’s keeping a ratio between tTotal 1E24 and the difference with MAXuInt24 rTotal because of burning and redistribution.
They can’t just loop through every owned address to .add(redistributionToken) because that would go over the gas limit and pay crazy amount of gas fee.
That said, it’s super confusing and I can’t tell the exact logic what’s happening. If anyone ever figures out, please share.
Also another thing after you deploy the contract is in the constructor, the address deployed will own all of rTotal. So does that mean the Devs secretly hold a lot of tokens and not revealed in the blockchain?
Yes, when the contract is deployed (safemoon clones) the tokens go directly to the holder by default. Then the dev usually does dxSale or locked liquidity.
but rTotal is not supplyTotal (tTotal). rTotal is maxuint256 with last 1E24 0. So even if dev burns half of tTotal it’s still a large amount of token left from rTotal?
hi all - this is a great post thanks for sharing I had the same questions as i was working through the contract today.
I also had another question along similar lines. in the code below the _tOwned[account]=0. If you include an account to participate in rewards - why would we be setting the owned amount to zero?
function includeInReward(address account) external onlyOwner() {
require(_isExcluded[account], "Account is already excluded");
for (uint256 i = 0; i < _excluded.length; i++) {
if (_excluded[i] == account) {
_excluded[i] = _excluded[_excluded.length - 1];
**_tOwned[account] = 0;**
_isExcluded[account] = false;
_excluded.pop();
break;
}
}
}