Solana-based (SOL) decentralized exchange OptiFi mistakenly closed its program on August 29, losing $661,000 of its funds permanently.
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
According to an announcement by the DEX, the mistake occurred around 06:00 UTC when its deployer tried to upgrade its program on the Solana mainnet.
How OptiFi closed its program
The team explained that the deployer was trying to upgrade the OptiFi program using the anchor deploy. However, the process took longer than usual, probably because of network congestion.
The deployer aborted this anchor deploy upgrade before getting a response. Meanwhile, the process had created an unused buffer account with a balance of 17.2023808 SOL.
So, the deployer attempted to close this buffer account to regain its balance before proceeding with the mainnet upgrade.
However, the deployer unknowingly permanently closed the main program instead of closing the buffer account.
According to the team, it used the “Solana close program” without fully understanding the impact of the action.
The team said the response from a Solana core developer “overwhelmingly” showed that it would be unable to re-deploy its program to the previous program id.
The OptiFi team revealed that it has permanently lost access to the $661,000 locked in the contract.
OptiFi stated that 95% of this fund is from its team member.
However, “ALL the users’ margin accounts USDC tokens, option tokens, and AMMs USDC vaults” which are bound to the program have been lost.
It continued that it plans to compensate for all the lost users’ funds while adding more stringent measures to avoid a repeat occurrence in the future.
OptiFi team also advised Solana to add descriptions to the solana docs to warn about the result of closing a program and recommended adding a two-step confirmation for running the “solana program close” command.