Uniques: An economically-secure basic-featured NFT pallet (#8813)

* Uniques: An economically-secure basic-featured NFT pallet

* force_transfer

* freeze/thaw

* team management

* approvals

* Fixes

* force_asset_status

* class_metadata

* instance metadata

* Fixes

* use nmap

* Fixes

* class metadata has information field

* Intiial mock/tests and a fix

* Remove impl_non_fungibles

* Docs

* Update frame/uniques/src/lib.rs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* Update frame/uniques/src/lib.rs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* Update frame/uniques/src/lib.rs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* Update frame/uniques/src/lib.rs

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>

* Reserve, don't transfer.

* Fixes

* Tests

* Tests

* refresh_deposit

* Tests and proper handling of metdata destruction

* test burn

* Tests

* Update impl_fungibles.rs

* Initial benchmarking

* benchmark

* Fixes

* cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_uniques --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/uniques/src/weights.rs --template=./.maintain/frame-weight-template.hbs

* Attributes

* Attribute metadata

* Fixes

* Update frame/uniques/README.md

* Docs

* Docs

* Docs

* Simple metadata

* Use BoundedVec

* cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_uniques --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/uniques/src/weights.rs --template=./.maintain/frame-weight-template.hbs

* Update frame/uniques/src/lib.rs

Co-authored-by: Lohann Paterno Coutinho Ferreira <developer@lohann.dev>

* Update frame/uniques/src/lib.rs

Co-authored-by: Lohann Paterno Coutinho Ferreira <developer@lohann.dev>

* Update frame/uniques/src/lib.rs

Co-authored-by: Lohann Paterno Coutinho Ferreira <developer@lohann.dev>

* Update frame/uniques/src/lib.rs

Co-authored-by: Lohann Paterno Coutinho Ferreira <developer@lohann.dev>

* Update frame/uniques/src/lib.rs

Co-authored-by: Lohann Paterno Coutinho Ferreira <developer@lohann.dev>

* Fixes

* Update frame/uniques/README.md

Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>

* Update frame/uniques/README.md

Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>

* Update frame/uniques/README.md

Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>

* Docs

* Bump

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Parity Bot <admin@parity.io>
Co-authored-by: Lohann Paterno Coutinho Ferreira <developer@lohann.dev>
Co-authored-by: Alexander Popiak <alexander.popiak@parity.io>
This commit is contained in:
Gavin Wood
2021-06-01 17:03:13 +01:00
committed by GitHub
parent c408515501
commit e819fd03f9
17 changed files with 2973 additions and 15 deletions
@@ -127,6 +127,34 @@ pub trait Saturating {
/// Saturating exponentiation. Compute `self.pow(exp)`, saturating at the numeric bounds
/// instead of overflowing.
fn saturating_pow(self, exp: usize) -> Self;
/// Increment self by one, saturating.
fn saturating_inc(&mut self) where Self: One {
let mut o = Self::one();
sp_std::mem::swap(&mut o, self);
*self = o.saturating_add(One::one());
}
/// Decrement self by one, saturating at zero.
fn saturating_dec(&mut self) where Self: One {
let mut o = Self::one();
sp_std::mem::swap(&mut o, self);
*self = o.saturating_sub(One::one());
}
/// Increment self by some `amount`, saturating.
fn saturating_accrue(&mut self, amount: Self) where Self: One {
let mut o = Self::one();
sp_std::mem::swap(&mut o, self);
*self = o.saturating_add(amount);
}
/// Decrement self by some `amount`, saturating at zero.
fn saturating_reduce(&mut self, amount: Self) where Self: One {
let mut o = Self::one();
sp_std::mem::swap(&mut o, self);
*self = o.saturating_sub(amount);
}
}
impl<T: Clone + Zero + One + PartialOrd + CheckedMul + Bounded + num_traits::Saturating> Saturating for T {