Fix: Migrate inconsistent qToken account balances


While the core implementation of the lending protocol on Kintsugi has proven sound and works smoothly, we recently identified a UX bug at the parachain level where the "collateral toggle" does not work correctly.

The expected behaviour is that when the collateral toggle is enabled for a certain currency, the user's qToken balance becomes locked. Any incoming qTokens that the user receives, either by depositing underlying currency such as DOT and receiving qDOT, or by receiving qDOT from another user through a direct transfer, is automatically locked so it counts as collateral. This auto-locking of incoming qTokens is configured in the orml-tokens pallet.

  • The Kintsugi-Testnet, where we ran the trading competition, had a correct configuration of the orml-tokens pallet and everything worked correctly.
  • The Kintsugi mainnet, on the other hand, had no configuration for qToken actions, which resulted in incoming tokens not being auto-locked. This can cause several issues, such as max redeems failing, or new deposits not increasing the borrow capacity.


Since the bug is that users may have both locked and free qTokens due to the auto-locking not happening, the fix is to lock all the free qTokens for these users. In addition, the auto-locking actions are added to the Kintsugi runtime.

There are currently six accounts in an inconsistent state, all of which will have their free qToken balance locked once the fix executes. See the list below, where lendToken is the on-chain representation of qTokens.

a3c7Y5PBGnRRqmdoLpMo57JEJvpMcf6UmeaVgcARtFaj83XLU { lendToken: 3 } {"free":308696658247,"reserved":10058464217,"frozen":0} a3f7VPekrRf6Fve5JZXSnVqfkk5sa11UK3vU4WmXcGZxFmbMq { lendToken: 1 } {"free":99999579,"reserved":199999159,"frozen":0} a3aW5opjuroJDexG2edqXao5YqopHitoDxeuN98jvXDd3KRLp { lendToken: 3 } {"free":3058194,"reserved":3597544,"frozen":0} a3enkTvngppdDCLHkCSWmVQeFJ4NY35CStucvwHaRzhp56Tn8 { lendToken: 1 } {"free":599997308,"reserved":249999394,"frozen":0} a3aQPXJV6GGboBc3PPFbjM7cMEXLEw6X5DukgSFEhf8ucNNkN { lendToken: 1 } {"free":1249994288,"reserved":1124994859,"frozen":0} a3dkY3yWweLMkUjbSSNC2NawWegH3NZkWpYjsnBr2srQsp9LZ { lendToken: 2 } {"free":299970489359256,"reserved":100000000000000,"frozen":0}
No current seconds
This proposal has been turned into referendum.
  • Call
  • Metadata
  • Timeline2
There are no comments here