reflectfinance / reflect-contracts

GNU General Public License v3.0
106 stars 120 forks source link

Improvements? #4

Open aress31 opened 3 years ago

aress31 commented 3 years ago

I am getting started with Solidity and struggle a bit to understand this RFI contract, if you could refactor it to extend openzepplin contracts (and use the same vars name, e.g., _totalSupply) and use more explicit variable names (what is rTotal, rOwned, tOwned, tTotal, MAX etc.) and comment the code that would help a lot!

Alternatively, explaining in the README how to use extend this contract would do!

BryantS11 commented 3 years ago

What they did was that they have their own custom names to the vars,

but you can see what those vars are:

function name() public view returns (string memory) {
    return _name;
} 

 function symbol() public view returns (string memory) {
    return _symbol;
}

function decimals() public view returns (uint8) {
    return _decimals;
}

function totalSupply() public view override returns (uint256) {
    return _tTotal;
}

With the functions you see that _tTotal is totalSupply, etc.

aress31 commented 3 years ago

@BryantS11 these ones are the easy ones, what about the one I mention above? rOwned, tOwned, MAX, etc. These are the ones I would like to understand.

BryantS11 commented 3 years ago

@BryantS11 these ones are the easy ones, what about the one I mention above? rOwned, tOwned, MAX, etc. These are the ones I would like to understand.

from what i understand: _rOwned and _tOwned are equal to _balances in a regular token

_rOwned are addresses that are not excluded _tOwned are addresses that are excluded

Sheldenshi commented 3 years ago

@BryantS11 Do you know what _rTotal and _tFeeTotal are and what roles they play in redistributing fees?

aress31 commented 3 years ago

@BryantS11 these ones are the easy ones, what about the one I mention above? rOwned, tOwned, MAX, etc. These are the ones I would like to understand.

from what i understand: _rOwned and _tOwned are equal to _balances in a regular token

_rOwned are addresses that are not excluded _tOwned are addresses that are excluded

Alright, not excluded and excluded from what exactly?

From:

And what is the difference between these two very similarly named vars:

    mapping(address => bool) private _isExcludedFromFee;
    mapping(address => bool) private _isExcluded;

And lastly what is the role of:

    bool inSwapAndLiquify;
    bool public swapAndLiquifyEnabled = true;
BryantS11 commented 3 years ago

@BryantS11 these ones are the easy ones, what about the one I mention above? rOwned, tOwned, MAX, etc. These are the ones I would like to understand.

from what i understand: _rOwned and _tOwned are equal to _balances in a regular token _rOwned are addresses that are not excluded _tOwned are addresses that are excluded

Alright, not excluded and excluded from what exactly?

From:

  • rewards
  • or from taxes
  • or both?

And what is the difference between these two very similarly named vars:

    mapping(address => bool) private _isExcludedFromFee;
    mapping(address => bool) private _isExcluded;

And lastly what is the role of:

    bool inSwapAndLiquify;
    bool public swapAndLiquifyEnabled = true;

They are Excluded from rewards, Example: You exclude a Exchange address so that the exchange is not receiving rewards and users receive more of a share because less addresses are participating.

The mapping checks if the sender and/or recipient _isExcluded and it runs different functions based on result

I'm new to Solidity so I don't understand it too much