This is my first "underground" story, where i was so close to break a whole project.
I was still using remix and doing manual tests at the time, this was a Tiki-token fork (BNB redistribution)
My edits were related to maxWallet and some other minor logic, nothing that could interfere with what was going to happen..
lol.
Those were the first minutes...
i've instantly noticed that something was wrong..
and here my paranoia for "does sell works?" has born..
Something isn't working.
nobody is selling.
No one can sell.
I've started asking in group and i saw some users having issues...
So i've started analyzing the contract for a fix.. but i've found none..
FUCK!
WHAT DO I DO?
I've asked another dev to help me with the problem and we noticed something...
The contract was swapping his full balance on the sell-side of users..
so this was the row that triggered the bug.
So the more users buy... the bigger that problem become.
FUUUUUUUUCK, time was running out!
Got a flash idea, maybe i can sell from pancake directly from the router itself, with 1 ExpectedMinAmount!
Let's try! what else i can do otherwise???
"DEV: Krako, what happen if you can sell?"
"ME: o well... i think there will be an... airdrop.."
I've sold on pancake with 99% slippage and the contract sold with me!
OMG
32 BNB in airdrops to all the holders.
They were enthusiastic!
All happy! wtf?
There's a 60% dump and everyone's happy... ok?
The problem was fixed... for some minutes.
Then it got stuck again.
Once i've unlocked it again i've understood that i had to decrease the number of tokens to swap, because the liquidity was small and the token ratio was high, that creates an huge slippage in the seller's transaction.
What i've learned
- Know your code... don't deploy forks without understanding them first
- Write your own
_transfer
, that helped me out alot - Check the ratios, if the pool is small but has an high token ratio at the launch, a big buy pressure can hang the contract if the swap system is not good
- Write a good swap system with amount to sell, min amount before sell, time between sells
- Write tests
- Don't go in panic, find the solution as soon as possible no matter what.
- Believe in yourself and the fact that you made the error and you have to resolve it.
Warlock had that problem only one time after the launch, then i've lost interest in the project due to lack of management skill by the owner.
Still in my ❤️
i cannot forget those 12 long minutes...