Create a half burnable and staking ERC20 token

Hello,

I am new to the process of coding a token (and a smart contract).
I wish to create a token (using your library) with a 5% tax on the seller, half of it would be burned and the other half would be sent to a pool witch would then be used to finance the staking.

Could you show me how to integrate both codes together or maybe find me an example of an existing one please ?

Thanks for your attention. I’m looking forward to your reply.

1 Like

When you want to burn some tokens, you can refer to this contract: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20Burnable.sol#L19

1 Like

Thanks,
But how can i integrate a code for burn 2.5% token and send other 2.5% in a pool in order to remunerate stakers ?

1 Like

As for an ERC20 token, there is not a role of seller, it has sender and recipient, so I think your mean is a crowdfunding contract.

1 Like

It is an erc20, in the role of a sender.
I meant that I want to create 2.5% burn and 2.5% sent to a pool to finance the staking at each transaction where the user will sell the token so effectively sender.

1 Like

So, when transfer(accountA, 1000), accountA will get 9975 token, and 25 token will be sent to another contract, right?

1 Like

When a Transaction occurs (example: from A to B 1000):

  • account B will get 950 tokens (95% of transaction)
  • smart contract for staking will get 25 tokens (2.5% of transaction)
  • burning of token will be of 25 tokens (2.5% of tansaction)
1 Like

Okay, I see. So you can write this logic in the transfer().

1 Like

Hi @genesis24,

Welcome to the community :wave:

Thanks @Skyge as always :pray:

You could override transfer and transferFrom or _transfer to potentially implement this functionality, though you should investigate how this impacts other services that you may want to use your token with.

:warning: If you create a fee on transfer or deflationary token (burn a percentage on transfer) this can cause issues with use in other contracts such as: https://medium.com/balancer-protocol/incident-with-non-standard-erc20-deflationary-tokens-95a0f6d46dea

Any solution should be appropriately tested (including testing with services that you want to use) and appropriately audited.

I also suggest looking at Points to consider when creating a fungible token (ERC20, ERC777).

Where you ever able to get the staking and the burn working if so please let me know I'm currently try to implement something very similar.

Sir how to code a token with built in benefits to those who hold the token?

Sorry I am not sure what do you mean.

Hi, welcome! :wave:

I think it depends on your logic of this token.
And you can search to find how other tokens do this.