Hello everybody, I would like to ask how can I charge a commission based on the gas value of a transaction in a smart contract.
For instance, if the transaction has a gas fee of 0.05 ether, commission will be 10%, so the total value (gas + commission) would be 0.055.
I was thinking that would be something similar to the below code (a similar code to the below one works fine for commission on token value):
function transfer(address _to, uint256 gas) public returns (bool success) {
if (balances[msg.sender] >= gas+gas/100 && gas+gas/100 > 0) {
balances[msg.sender] -= gas+gas/100;
balances[00x] += gas/100;
emit Transfer(msg.sender, 00x, gas/100);
return true;
} else { return false; }
}
Is that possible to do so?