Last night, @cumbercapital reached out with a problem: he had accidentally sent $60k USDC on Arbitrum to the address of a token on Base.
Happy to say that today we were able to successfully recover it.
Here's how (rescue repo link at the end)
1/🧵

2/ I went straight to the contract deployment on Base to find out how it was deployed. If deployed via the `CREATE` opcode, then we can deploy a rescue contract on Arbitrum from the same deployer and nonce, and it would end up at the same address.
3/ It was unfortunately created by another contract, which could have meant disaster. Thankfully, that contract was deployed by the same deployer just three transaction prior -- only a slight complication.
And even more thankfully, it was indeed deployed via `CREATE`


4/ Just like EOA `CREATE` deployments are deterministic based on nonce, smart contract deployments are as well. Contracts have their own, somewhat invisible nonce specifically used and only incremented when they themselves deploy a new smart contract.
5/ In order to conduct a rescue, we simply needed:
- Access to the deployer wallet (0x2CD5)
- Deploy a smart contract factory using the deployer's nonce 2
- Deploy a rescue contract from that factory using the factory's nonce 0
All in all, it looks something like this:

6/ The factory and rescue contracts themselves are very simple. Check them out below -
The factory only has one function, which creates a new Rescue contract.
The Rescue contract transfers USDC upon deployment.
There's also a generic rescue in case anything else gets sent in.

7/ Big shout out to @mjayceee for being so responsive and cooperative throughout the process, and getting it all set up and run this morning.
I'm glad we were able to get the funds back and make @cumbercapital whole again. twitter.com/2573380344/status/...
Oh right, repo link: github.com/QuitCrypto/Rescue-U...
And rescue tx: arbiscan.io/tx/0x556373755a365...
From Twitter
Disclaimer: The content above is only the author's opinion which does not represent any position of Followin, and is not intended as, and shall not be understood or construed as, investment advice from Followin.
Like
Add to Favorites
Comments
Share
Relevant content