Gilt
A insight into the workings of the Gilt pallet

What is the Gilt pallet?

The Gilt pallet allows accounts to auction for being frozen and receive open-ended inflation-protection in return.

Overview

Lock up tokens, for at least as long as you offer, and be free from both inflation and intermediate reward or exchange until the tokens become unlocked.

Design

Queues for each of 1-`QueueCount` periods, given in blocks (`Period`). Queues are limited in size to something sensible, `MaxQueueLen`. A secondary storage item with `QueueCount` x `u32` elements with the number of items in each queue.
Queues are split into two parts. The first part is a priority queue based on bid size. The second part is just a FIFO (the size of the second part is set with `FifoQueueLen`). Items are always prepended so that removal is always O(1) since removal often happens many times under a single weighed function (`on_initialize`) yet placing bids only ever happens once per weighed function (`place_bid`). If the queue has a priority portion, then it remains sorted in order of bid size so that smaller bids fall off as it gets too large.
Account may enqueue a balance with some number of `Period`s lock up, up to a maximum of `QueueCount`. The balance gets reserved. There's a minimum of `MinFreeze` to avoid dust.
Until your bid is turned into an issued gilt you can retract it instantly and the funds are unreserved.
There's a target proportion of effective total issuance (i.e. accounting for existing gilts) which we attempt to have frozen at any one time. It will likely be gradually increased over time by governance.
As the total funds frozen under gilts drops below `FrozenFraction` of the total effective issuance, then bids are taken from queues, with the queue of the greatest period taking priority. If the item in the queue's locked amount is greater than the amount left to be frozen, then it is split up into multiple bids and becomes partially frozen under gilt.
Once an account's balance is frozen, it remains frozen until the owner thaws the balance of the account. This may happen no earlier than queue's period after the point at which the gilt is issued.
Last modified 1yr ago
Copy link
On this page