GMX V2 Cauldrons
Last updated
Last updated
The Abracadabra GMX V2 Cauldrons work a bit differently from other cauldrons. The process of Borrowing is the same and while Leveraging is very similar and straightforward, it is important for users to understand the differences.
On GMX V2, entering or exiting a GM position is . The user first creates a deposit or withdrawal order, which is then filled by GMX's . This means that 2 transactions happen: the order creation and its fulfillment. This design choice of GMX is made to prevent front-running and make the users safe
In the time between the order creation with borrowed MIM and its fulfillment, the USDC that sits in the order provides backing for the borrowed MIM. After its fulfillment, the gm tokens are added as collateral and backing behaves normally. Note: The following documentation applies for all gm based cauldrons, no matter the underlying collateral. GM cauldrons have been added to Abracadabra's lineup following SAIP #34.
When you leverage, most of the times, you will just have 2 transactions to make, like you normally would: approving the use of your GM tokens, and executing the leverage transaction. However, in the backend, more steps will happen:
You execute the leverage transaction, which borrows MIM, swaps it for USDC, and send a deposit order to acquire GM tokens. The USDC and the order are owned by the user until executed. The UI will show you this GM Leverage screen.
After some time ((usually a few seconds, but it rare occasions it could take up to 5h) the GMX keeper will execute the deposit, converting your USDC tokens to GM and sending them back to the cauldron to be added as collateral. After this step, the leverage is complete.
Sometimes, for unforeseen reasons, the second step can fail. This does not affect the security of your funds, as the USDC is stored in a contract you own. In this case, the Abracadabra frontend will ask you to retry, sending a transaction that will finalize the leverage.
Because of the non-atomic nature of GMX V2, deleveraging a position will require one more transaction from the user. The way you interact with the interface remains unchained however.
You select your parameters, choosing how much debt you want to repay and how much collateral to withdraw, like you normally would.
After sending the second transaction, the deleverage is complete. If you forgot to send the second transaction, you will be prompted to do so in the deleverage UI bellow the close position. Clicking "Deleverage" will finish the deleveraging process.
Note: GM cauldrons are audited by Guardian, the audit can be found here.
Signing the transaction on your wallet, the transaction is sent and the UI waits for the GMX keeper to complete the withdrawal from GMX. You will then, be asked to send a second transaction, finishing the deleverage.