Hello everyone! My name is Tom!
Today we will deal with the system of scam through gas token
Let’s begin
I will not describe the principles of gas token, you can easily Google it, the Internet is full of information, but I will talk about the principle of this method of scam and how it works
I personally encountered this method when I went to apeBoard and saw my balance tokens unknown to me in the amount of 1k$. I understood that these are not super pure tokens and there is a trick, but I was quite interested to explore this token. I went to exchanger and tried to swap it, accordingly I had to give approve before that, but here is the problem, after I sent transaction with approve — approve was not given!
I went to the etherscan and looked at the approve transaction and saw the following
And then everything fell into place, because I’m just being scammed to pay for gas!
The gas token contract itself has this mint function
In which, after some logic, tokens mint to msg.sender
Thus, in general, any contract can put in itself the call of mint of gas token and so scam people for gas (usually there counts gas to the balance of the native token in the wallet), and tokens themselves will be minted to the address of the scam token contract, which called the contract gas token
The gas token itself is traded on dexes, and there is even some liquidity
Example
In the example we will make a cut down token scam contract, purely to show the functionality of this method
In the configuration, we prescribe the network and the block on which we will fork the network, because for the example I want to use real data
And this is what our scam token contract will look like, I repeat, it is made simply as a concept, purely to demonstrate options for implementation
In our case, we override the approve function by simply adding a mint gas token call to it
Write some tests and get the following
It all worked out, we minted gas tokens on our scam token contract!
The code for the whole example can be found in my repository: https://github.com/ortomich/GasToken_scam_example
I hope the article was interesting and understandable!
- My Twitter
- My GitHub
- Support (any EVM networks): 0xd661909C7537D090af9fC3b3Fedf8f46BE60AfAc
Thank you! ❤️