From 48b3789b2df548b38e477ed05c20e74324d73b58 Mon Sep 17 00:00:00 2001 From: Daniel Shiposha Date: Mon, 16 Oct 2023 14:31:51 +0200 Subject: [PATCH] fix: rename nester to depositor, add docs --- pallets/fungible/src/lib.rs | 12 +++++++----- pallets/nonfungible/src/lib.rs | 12 +++++++----- pallets/refungible/src/lib.rs | 20 +++++++++++++++----- 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/pallets/fungible/src/lib.rs b/pallets/fungible/src/lib.rs index 7d696409c0..b2ab9bbcc0 100644 --- a/pallets/fungible/src/lib.rs +++ b/pallets/fungible/src/lib.rs @@ -384,14 +384,16 @@ impl Pallet { amount: u128, nesting_budget: &dyn Budget, ) -> DispatchResultWithPostInfo { - let nester = from; - - Self::transfer_internal(collection, nester, from, to, amount, nesting_budget) + let depositor = from; + Self::transfer_internal(collection, depositor, from, to, amount, nesting_budget) } + /// Transfers tokens from the `from` account to the `to` account. + /// The `depositor` is the account who deposits the tokens. + /// For instance, the nesting rules will be checked against the `depositor`'s permissions. fn transfer_internal( collection: &FungibleHandle, - nester: &T::CrossAccountId, + depositor: &T::CrossAccountId, from: &T::CrossAccountId, to: &T::CrossAccountId, amount: u128, @@ -429,7 +431,7 @@ impl Pallet { // from != to && amount != 0 >::nest_if_sent_to_token( - nester, + depositor, to, collection.id, TokenId::default(), diff --git a/pallets/nonfungible/src/lib.rs b/pallets/nonfungible/src/lib.rs index 9f5e36f0b2..69d353ce0d 100644 --- a/pallets/nonfungible/src/lib.rs +++ b/pallets/nonfungible/src/lib.rs @@ -718,14 +718,16 @@ impl Pallet { token: TokenId, nesting_budget: &dyn Budget, ) -> DispatchResultWithPostInfo { - let nester = from; - - Self::transfer_internal(collection, nester, from, to, token, nesting_budget) + let depositor = from; + Self::transfer_internal(collection, depositor, from, to, token, nesting_budget) } + /// Transfers an NFT from the `from` account to the `to` account. + /// The `depositor` is the account who deposits the NFT. + /// For instance, the nesting rules will be checked against the `depositor`'s permissions. pub fn transfer_internal( collection: &NonfungibleHandle, - nester: &T::CrossAccountId, + depositor: &T::CrossAccountId, from: &T::CrossAccountId, to: &T::CrossAccountId, token: TokenId, @@ -767,7 +769,7 @@ impl Pallet { }; >::nest_if_sent_to_token( - nester, + depositor, to, collection.id, token, diff --git a/pallets/refungible/src/lib.rs b/pallets/refungible/src/lib.rs index a799262f9f..5ce0837479 100644 --- a/pallets/refungible/src/lib.rs +++ b/pallets/refungible/src/lib.rs @@ -615,14 +615,24 @@ impl Pallet { amount: u128, nesting_budget: &dyn Budget, ) -> DispatchResult { - let nester = from; - - Self::transfer_internal(collection, nester, from, to, token, amount, nesting_budget) + let depositor = from; + Self::transfer_internal( + collection, + depositor, + from, + to, + token, + amount, + nesting_budget, + ) } + /// Transfers RFT tokens from the `from` account to the `to` account. + /// The `depositor` is the account who deposits the tokens. + /// For instance, the nesting rules will be checked against the `depositor`'s permissions. pub fn transfer_internal( collection: &RefungibleHandle, - nester: &T::CrossAccountId, + depositor: &T::CrossAccountId, from: &T::CrossAccountId, to: &T::CrossAccountId, token: TokenId, @@ -697,7 +707,7 @@ impl Pallet { // from != to && amount != 0 >::nest_if_sent_to_token( - nester, + depositor, to, collection.id, token,