Uniques: Reset approved account after transfer (#12145)

* reset approved account

* wrap at 100

* doc

* fmt

* Update frame/uniques/src/tests.rs

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* new test

* Update frame/uniques/src/lib.rs

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* fmt

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
This commit is contained in:
Sergej Sakac
2022-09-01 10:45:20 +02:00
committed by GitHub
parent 9bbf8efd02
commit 7f1b9a937a
3 changed files with 48 additions and 0 deletions
+6
View File
@@ -48,6 +48,12 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
Account::<T, I>::insert((&dest, &collection, &item), ());
let origin = details.owner;
details.owner = dest;
// The approved account has to be reset to None, because otherwise pre-approve attack would
// be possible, where the owner can approve his second account before making the transaction
// and then claiming the item back.
details.approved = None;
Item::<T, I>::insert(&collection, &item, &details);
ItemPriceOf::<T, I>::remove(&collection, &item);