Fix: Migrate inconsistent qToken account balances
Democracy
0 Comments
FastTracked

Background

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.

Fix

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}
Edited
Reply
Up
Share
Second
No current seconds
This proposal has been turned into referendum.
Metadata
hash
0x3f290ea4a14b72fdce28641f20f5f5980077f33b03defeb038512d14db63a054
deposit
5 KINT
proposer
Call
Table
Json
callIndex0x5502
sectionparachainSystem
methodauthorizeUpgrade
args
codeHash0xd6026a143065258aec5b73c1cb3751e48ae5697bcd882fab1b08cf61ffb0ca23
TimelineLatest activity undefined
2023-04-24 09:27:57
Proposed
Index
#114
2023-04-24 09:40:00
FastTracked
2023-04-24 09:40:00
Started
referendumIndex
108
voteThreshold
SuperMajorityApprove
2023-04-24 12:42:48
Passed
referendumIndex
108
2023-04-24 12:43:24
Executed
result
ok
Comments
There are no comments here