Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Non-Interactive Staking #12610

Merged
merged 57 commits into from
Dec 5, 2022
Merged
Changes from 1 commit
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
d2a1c7b
Improve naming.
gavofyork Nov 2, 2022
a1748df
More improvements to naming
gavofyork Nov 2, 2022
8394666
Fungible counterpart
gavofyork Nov 2, 2022
c81e4a4
Shared pot instead of reserve
gavofyork Nov 2, 2022
9a78199
Transferable receipts
gavofyork Nov 2, 2022
556aee9
Better naming
gavofyork Nov 2, 2022
326bed5
Use u128 for counterpart
gavofyork Nov 3, 2022
fb9857f
Partial thawing
gavofyork Nov 3, 2022
b232a35
Docs
gavofyork Nov 3, 2022
66fa13b
Remove AdminOrigin
gavofyork Nov 3, 2022
3855ed0
Integrate into Kitchen Sink
gavofyork Nov 3, 2022
ed21e76
Thaw throttling
gavofyork Nov 3, 2022
c2fd94e
Remove todo
gavofyork Nov 3, 2022
ec6b594
Docs
gavofyork Nov 3, 2022
1442179
Fix benchmarks
gavofyork Nov 3, 2022
86ceb01
Building
gavofyork Nov 4, 2022
54609be
Tests work
gavofyork Nov 4, 2022
085996b
New benchmarks
gavofyork Nov 5, 2022
077afbe
Benchmarking tests
gavofyork Nov 5, 2022
3ca6918
Test new defensive_saturating_* functions
ggwpez Nov 5, 2022
25d80d3
fmt
ggwpez Nov 5, 2022
9ea6681
Formatting
gavofyork Nov 6, 2022
be66334
Update frame/nis/src/lib.rs
gavofyork Nov 6, 2022
471c83b
Apply suggestions from code review
gavofyork Nov 6, 2022
c668161
Merge branch 'gav-ref-nis' of github.com:paritytech/substrate into ga…
gavofyork Nov 6, 2022
a44dc75
Events added
gavofyork Nov 6, 2022
f89b093
Fix kitchensink
gavofyork Nov 6, 2022
f5a3e3d
Update frame/nis/src/lib.rs
gavofyork Nov 8, 2022
1474a75
Review niggles
gavofyork Nov 10, 2022
376132d
Merge branch 'gav-ref-nis' of github.com:paritytech/substrate into ga…
gavofyork Nov 11, 2022
bafbdff
Merge remote-tracking branch 'origin/master' into gav-ref-nis
gavofyork Nov 11, 2022
ef9a239
Remove genesis build requirements
gavofyork Nov 11, 2022
207a4b5
Grumbles
gavofyork Nov 14, 2022
e395e84
Merge remote-tracking branch 'origin/master' into gav-ref-nis
gavofyork Nov 14, 2022
6a85012
Fixes
gavofyork Nov 14, 2022
d11f04e
Fixes
gavofyork Nov 14, 2022
8b47006
Fixes
gavofyork Nov 14, 2022
2a59d93
Update frame/nis/src/lib.rs
gavofyork Nov 22, 2022
cd45d8a
Update primitives/runtime/src/traits.rs
gavofyork Nov 22, 2022
d201b05
Merge remote-tracking branch 'origin/master' into gav-ref-nis
gavofyork Nov 22, 2022
990f280
Formatting
gavofyork Nov 22, 2022
15bd0ac
Fixes
gavofyork Nov 23, 2022
9578bf0
Fix node genesis config
ggwpez Nov 23, 2022
ecf4bc1
Fix node chain specs
ggwpez Nov 23, 2022
0a57aed
Use free asset ID as counterpart
ggwpez Nov 23, 2022
6e13e91
Account for rounding errors in fund_deficit bench
ggwpez Nov 23, 2022
45c58b4
clippy
ggwpez Nov 23, 2022
e4499b4
fmt
ggwpez Nov 23, 2022
335ca07
Fix
gavofyork Nov 27, 2022
314728f
Rename
gavofyork Nov 27, 2022
ab31838
Merge branch 'gav-ref-nis' of github.com:paritytech/substrate into ga…
gavofyork Nov 27, 2022
57402c0
Merge remote-tracking branch 'origin/master' into gav-ref-nis
gavofyork Nov 27, 2022
52e6430
Fixes
gavofyork Nov 27, 2022
5817e46
Fixes
gavofyork Nov 27, 2022
fd2575a
Merge branch 'master' into gav-ref-nis
gavofyork Dec 1, 2022
14a4085
Merge remote-tracking branch 'origin/master' into gav-ref-nis
gavofyork Dec 2, 2022
2a18a46
Formatting
gavofyork Dec 2, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Docs
  • Loading branch information
gavofyork committed Nov 3, 2022
commit b232a35fdfbc3dc3de53e4f95a412d8e606b9c47
44 changes: 26 additions & 18 deletions frame/nis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
//!
//! ## Design
//!
//! Queues for each of 1-`QueueCount` periods, given in blocks (`Period`). Queues are limited in
//! 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.
//!
Expand All @@ -40,28 +40,34 @@
//! 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 bond you can retract it instantly and the funds are
//! unreserved.
//! Until your bid is consolidated and you receive a receipt, you can retract it instantly and the
//! funds are unreserved.
//!
//! There's a target proportion of effective total issuance (i.e. accounting for existing bonds)
//! which the we attempt to have frozen at any one time. It will likely be gradually increased over
//! time by governance.
//! There's a target proportion of effective total issuance (i.e. accounting for existing receipts)
//! which the pallet attempts to have frozen at any one time. It will likely be gradually increased
//! over time by governance.
//!
//! As the total funds frozen under bonds 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 bond.
//! As the proportion of effective total issuance represented by outstanding receipts drops below
//! `FrozenFraction`, then bids are taken from queues and consolidated into receipts, with the queue
//! of the greatest period taking priority. If the item in the queue's locked amount is greater than
//! the amount remaining to achieve `FrozenFraction`, then it is split up into multiple bids and
//! becomes partially consolidated.
//!
//! 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 bond is
//! issued.
//! With the consolidation of a bid, the bid amount is taken from the owner and a receipt is issued.
//! The receipt records the proportion of the bid compared to effective total issuance at the time
//! of consolidation. The receipt has two independent elements: a "main" non-fungible receipt and
//! a second set of fungible "counterpart" tokens. The accounting functionality of the latter must
//! be provided through the `Counterpart` trait item. The main non-fungible receipt may have its
//! owner transferred through the pallet's implementation of `nonfungible::Transfer`.
//!
//! ## Suggested Values
//! A later `thaw` function may be called in order to reduce the recorded proportion or entirely
//! remove the receipt in return for the appropriate proportion of the effective total issuance.
//! This may happen no earlier than queue's period after the point at which the receipt was issued.
//! The call must be made by the owner of both the "main" non-fungible receipt and the appropriate
//! amount of counterpart tokens.
//!
//! - `QueueCount`: 300
//! - `Period`: 432,000
//! - `MaxQueueLen`: 1000
//! - `MinFreeze`: Around CHF 100 in value.
//! `NoCounterpart` may be provided as an implementation for the counterpart token system in which
//! case they are completely disregarded from the thawing logic.

#![cfg_attr(not(feature = "std"), no_std)]

Expand Down Expand Up @@ -101,6 +107,8 @@ where
}
}

//TODO: impl `ExchangeAsset`.

#[frame_support::pallet]
pub mod pallet {
pub use crate::weights::WeightInfo;
Expand Down