I have a token I am creating that I would like to implement extra logic for in the "transfer" and "transferFrom". For example, to send a certain portion to be burnt for each transaction involving the token. My question is, would the extra gas (shouldn't be much) that this would require to call these functions be a problem for conforming to erc20 standards or for other accounts interacting with the token?
1 Answer
The extra gas is minimal and would not cause a technical issue.
The ERC20 standard does not require adhering to any gas costs. But semantically you are not strictly following ERC20 because a return value of success
indicates that address _to
did get _value
tokens.
Transfers
_value
amount of tokens to address_to
function transfer(address _to, uint256 _value) returns (bool success)
An example of how this burning behavior, say 10%, can cause confusion: someone uses an exchange to buy 100 of your tokens, and ends up only with 90 would be confused. Then when they send these tokens to one of their own addresses, they would end up with only 81 tokens...
Before introducing this behavior in a token contract, consider instead burning a portion of tokens when someone interacts with your non-token contract, i.e. the contract which uses your token.