Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reflection / Burn Logic #1

Open
Jovonni opened this issue May 1, 2021 · 7 comments
Open

Reflection / Burn Logic #1

Jovonni opened this issue May 1, 2021 · 7 comments

Comments

@Jovonni
Copy link

Jovonni commented May 1, 2021

Hey team,

Great work so far.

I have seen people ask these questions, and I have also wondered myself, but if you can help us understand this, that would be great.

Is the burn + reflection logic manual? If not where in the contract does this logic reside?

Or, is the burn and reflection logic residing in another contract at another address?

It is understood, that the 10% tax exists in the contract, as the two fee variables declared in the token contract:

contract SafeMoon is Context, IERC20, Ownable

but where do we find the logic to:

  1. Reward tokens to holders, weighted by how many tokens they hold. I see references to _rOwned and _tOwned

Is it these two functions:

function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
        (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount);
        _rOwned[sender] = _rOwned[sender].sub(rAmount);
        _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
        _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);           
        _takeLiquidity(tLiquidity);
        _reflectFee(rFee, tFee);
        emit Transfer(sender, recipient, tTransferAmount);
    }

    function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
        (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount);
        _tOwned[sender] = _tOwned[sender].sub(tAmount);
        _rOwned[sender] = _rOwned[sender].sub(rAmount);
        _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);   
        _takeLiquidity(tLiquidity);
        _reflectFee(rFee, tFee);
        emit Transfer(sender, recipient, tTransferAmount);
    }

includeInReward is the only function I see that is making use of iterating over accounts, aside from _getCurrentSupply

Does the includeInReward function set who in included in the reflection?

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;
            }
        }
    }
  1. secondly, where is the logic to Burn the other 50% (from the 10% tax). I see the burn function, and event declared but don't see where they are invoked. I also don't see the burn event is ever emitted in this contract.

These are pretty straightforward answers, and I think this will help quite a bit of supporters, including myself. Any help on this would be greatly appreciated

Love the approach overall 🚀

@PiecePaperCode
Copy link

How it works

10% Tax
Here The Owner has exkluded himself

function _tokenTransfer(address sender, address recipient, uint256 amount,bool takeFee) private {

Everybody else pays the tax
function _transferStandard(address sender, address recipient, uint256 tAmount) private {

5% gets added to the LP

function _takeLiquidity(uint256 tLiquidity) private {

the contract adress gets the LP Fee _rOwned[address(this)] = _rOwned[address(this)].add(rLiquidity);

5% Token gets Burned

function _reflectFee(uint256 rFee, uint256 tFee) private {

the burned amount just gets added to an variable and are taken away from the total supply variable
as per this code there is no Burned Wallet you just get returned an int of the total burned amount.

Whats the 0 Adress? With no surprice the owner of the contract himself.

//Unlocks the contract for owner when _lockTime is exceeds

and here is how the owner will rugpull out

set Tax to 100%, 0% 50%
He can make prevent people of pulling out of this contract

function setTaxFeePercent(uint256 taxFee) external onlyOwner() {

Think about if Satoshi could just 100% the fees all by himself BTC would be worthless

This Code was copypasted and a couple of lines are changed. So there is some dead code in ther that dosent run or is runned by another contract but i dont know ether.

@Kovan91
Copy link

Kovan91 commented May 2, 2021

Unfortunately, he can. This is often used as a defense mechanism against hackers, but it can be updated with a better one. Many lines should be included

@PiecePaperCode
Copy link

https://www.certik.org/projects/safemoon
it got adressed here aswell. its an issue that needs to be adressed

@hamza9114
Copy link

https://www.certik.org/projects/safemoon it got adressed here aswell. its an issue that needs to be adressed

For example people buy and then they change tax to 100% and now only owner can sell tax free right? but if owner have no tokens to sell and liquidity is all burned into dead wallet. This happened with me but i am not sure how owner can rug? when he have no tokens and liquidity is burned how he can be benifit by stoping us from selling?? kindly reply

@PiecePaperCode
Copy link

PiecePaperCode commented Oct 9, 2021

https://www.certik.org/projects/safemoon it got adressed here aswell. its an issue that needs to be adressed

For example people buy and then they change tax to 100% and now only owner can sell tax free right? but if owner have no tokens to sell and liquidity is all burned into dead wallet. This happened with me but i am not sure how owner can rug? when he have no tokens and liquidity is burned how he can be benifit by stoping us from selling?? kindly reply

You are right.
It is a centraliced company that tries to sell decentralized crypto but holds all the cards.

example:
if i am an exchanche and i want to sell safemonn on my own bag they can just shut down the exchange adress. Other mayor tokens have given that power away by using a concens algo.

to add:

  1. the owner has acces to the liq pool and they can swap and liquify to bsc. the safemoon dev is selling his bag aswell.

  2. the owner has not implemented the reflection code in this repo. we dont really know how it works. they could take 50% of all reflections and no one would know.

  3. if the private key of the owner ever gets leaked its over. its a one point of failure.

  4. Videos of the safemoon company employed have surfaced where they eat golden beef.

to finish:
ill be very happy to see the V2 of the contract where all the issues are adressed. the code is much cleaner. and it would be possible to contribute as open source. doing everythin inhouse is just to much time co suming

@yuc0rp
Copy link

yuc0rp commented Jan 18, 2022

wen v2

@mamadeusia
Copy link

Hi, I implemented burnable safemoon token in this repository https://github.com/mamadeusia/BurnableReflectionToken
I also checked the functionality of code with python in jupyter-lab. if you have problem with it feel free to ask .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants