OptiFi is a DEX (decentralized exchange) based on Solana. A couple of days ago they admitted they made some mistakes because of which $661,000 USDC was permanently locked.
OptiFi's program has been closed by mistakes we made.
1. We accidentally closed the OptiFi mainnet program and it's not recoverable
2. 661k USDC is locked in the PDAs, luckily 95% of the fund is from our team member
3. We will compensate for all users’ funds
— OptiFi (@OptifiLabs) August 29, 2022
Therefore, this is not a bug, and the Solana blockchain has to do with this story only because it is the infrastructure chosen by the OptiFi team for its DEX.
The developers of a DEX on Solana made a serious mistake
The fact is that DEXs are based on immutable smart contracts, which even their authors cannot change. Therefore, the actions performed on those programs can be irreversible, as in this case.
The error was the accidental closure of the Mainnet OptiFi program, which makes it no longer recoverable. So the OptiFi program is effectively shut down.
Trivially, the error was caused by a manual action of an administrator, because on August 29 while the distributor was trying to update the OptiFi program on Solana’s mainnet, he accidentally used the close command, effectively causing its irreversible closure.
This resulted in all funds on the smart contract being locked forever.
From a strictly technical standpoint, the developer was trying to update the program on Solana‘s mainnet using “anchor deploy” for deployment, but the deployment transaction took much longer than usual, probably due to momentary network congestion. At this point, they halted the deployment to recover the funds as soon as possible.
The OptiFi team states:
“Without fully understanding the impact, we used ‘Solana close program’ and the OptiFi program on mainnet was closed, and cannot be recovered anymore.”
The technical details of the error
The full technical details of the incident were then also released on Medium.
The problem in these cases is that the operators of a decentralized smart contract may have actions available that can block or limit the activity of the smart contract itself. In this particular case, using Solana’s shutdown program, the smart contract can be disabled forever, and this action is not reversible.
According to the statement, there should not be many user funds that have been lost, and by September 2 all should be returned. But in case there were more, the problem could also have been much more serious.