difftreelog
Merge branch 'develop' into feature/fix_unit_tests
in: master
4 files changed
pallets/fungible/src/lib.rsdiffbeforeafterboth--- a/pallets/fungible/src/lib.rs
+++ b/pallets/fungible/src/lib.rs
@@ -285,7 +285,11 @@
spender: &T::CrossAccountId,
amount: u128,
) {
- <Allowance<T>>::insert((collection.id, owner, spender), amount);
+ if amount == 0 {
+ <Allowance<T>>::remove((collection.id, owner, spender));
+ } else {
+ <Allowance<T>>::insert((collection.id, owner, spender), amount);
+ }
collection.log_infallible(ERC20Events::Approval {
owner: *owner.as_eth(),
pallets/nonfungible/src/lib.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -177,6 +177,15 @@
.checked_add(1)
.ok_or(ArithmeticError::Overflow)?;
+ let balance = <AccountBalance<T>>::get((collection.id, sender))
+ .checked_sub(1)
+ .ok_or(ArithmeticError::Overflow)?;
+
+ if balance == 0 {
+ <AccountBalance<T>>::remove((collection.id, sender));
+ } else {
+ <AccountBalance<T>>::insert((collection.id, sender), balance);
+ }
// =========
<Owned<T>>::remove((collection.id, &token_data.owner, token));
pallets/refungible/src/lib.rsdiffbeforeafterboth175 <TotalSupply<T>>::remove_prefix((id,), None);175 <TotalSupply<T>>::remove_prefix((id,), None);176 <Balance<T>>::remove_prefix((id,), None);176 <Balance<T>>::remove_prefix((id,), None);177 <Allowance<T>>::remove_prefix((id,), None);177 <Allowance<T>>::remove_prefix((id,), None);178 <Owned<T>>::remove_prefix((id,), None);179 <AccountBalance<T>>::remove_prefix((id,), None);178 Ok(())180 Ok(())179 }181 }180182465 token: TokenId,467 token: TokenId,466 amount: u128,468 amount: u128,467 ) {469 ) {470 if amount == 0 {471 <Allowance<T>>::remove((collection.id, token, sender, spender));472 } else {468 <Allowance<T>>::insert((collection.id, token, sender, spender), amount);473 <Allowance<T>>::insert((collection.id, token, sender, spender), amount);474 }469 // TODO: ERC20 approval event475 // TODO: ERC20 approval event470 <PalletCommon<T>>::deposit_event(CommonEvent::Approved(476 <PalletCommon<T>>::deposit_event(CommonEvent::Approved(471 collection.id,477 collection.id,runtime/src/lib.rsdiffbeforeafterboth--- a/runtime/src/lib.rs
+++ b/runtime/src/lib.rs
@@ -146,7 +146,7 @@
spec_name: create_runtime_str!("opal"),
impl_name: create_runtime_str!("opal"),
authoring_version: 1,
- spec_version: 912202,
+ spec_version: 912204,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,