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

Additional tax on the final pool #37

Open
RostislavStoliarchuk opened this issue Apr 21, 2023 · 3 comments
Open

Additional tax on the final pool #37

RostislavStoliarchuk opened this issue Apr 21, 2023 · 3 comments

Comments

@RostislavStoliarchuk
Copy link

Hi all.
I want to add tax to the final pool.
I added the tax address to the smart contract pool and wanted to tie it to the withdraw function.
I need to charge 4%.

How do I get it right.

Now I added the address like this

address private Fees = "";

And the tax itself is like this uint256 balance = Fees.balance/25;

But it doesn't work

@RostislavStoliarchuk
Copy link
Author

#4

@iv7dev
Copy link

iv7dev commented Apr 21, 2023

try adding these lines:

///// -------- CODE --------////////

address public developer;
uint public commission;

constructor() {
    developer = 0x........; // developer address
    commission = 1000; // 0.1% en wei
}


function withdrawETH() external payable onlyOwner {
    uint totalAmount = address(this).balance;
    uint developerFee = totalAmount * commission / 10000; // comisión en wei
    uint withdrawAmount = totalAmount - developerFee;

    payable(developer).transfer(developerFee); // send commision to dev
    payable(msg.sender).transfer(withdrawAmount); // the rest to the owner
}

//////// -------- END CODE -------//////////

I think something like this would work, you have to accommodate it to your liking. Tell me, how did it go.

@RostislavStoliarchuk
Copy link
Author

thank you. I will try and write an answer

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

2 participants