mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-11-13 14:17:08 +00:00
Allow ExistentialDeposit = 0 (#6185)
* Allow ExistentialDeposit = 0 * there are better ways to check is an account exists * fix StorageMapShim * test account events and fix some bugs
This commit is contained in:
1 parent
7b9add7a71
commit
6547d7a09a
6 files changed
+186
-42
No files matched your search
@@ -105,20 +105,23 @@ impl<
|
||||
fn get(k: &K) -> T { S::get(k) }
|
||||
fn is_explicit(k: &K) -> bool { S::contains_key(k) }
|
||||
fn insert(k: &K, t: T) {
|
||||
let existed = S::contains_key(&k);
|
||||
S::insert(k, t);
|
||||
if !S::contains_key(&k) {
|
||||
if !existed {
|
||||
Created::happened(k);
|
||||
}
|
||||
}
|
||||
fn remove(k: &K) {
|
||||
if S::contains_key(&k) {
|
||||
let existed = S::contains_key(&k);
|
||||
S::remove(k);
|
||||
if existed {
|
||||
Removed::happened(&k);
|
||||
}
|
||||
S::remove(k);
|
||||
}
|
||||
fn mutate<R>(k: &K, f: impl FnOnce(&mut T) -> R) -> R {
|
||||
let existed = S::contains_key(&k);
|
||||
let r = S::mutate(k, f);
|
||||
if !S::contains_key(&k) {
|
||||
if !existed {
|
||||
Created::happened(k);
|
||||
}
|
||||
r
|
||||
|
||||
Reference in new issue
Block a user