git.delta.rocks / unique-network / refs/commits / 2c03632a3633

difftreelog

chore rename `set_allowance_for` to `set_allowance_from`

Grigoriy Simonov2023-01-09parent: #90bf3a3.patch.diff
in: master

9 files changed

modifiedpallets/fungible/src/benchmarking.rsdiffbeforeafterboth
90 };90 };
91 let owner_eth = T::CrossAccountId::from_eth(*sender.as_eth());91 let owner_eth = T::CrossAccountId::from_eth(*sender.as_eth());
92 <Pallet<T>>::create_item(&collection, &owner, (owner_eth.clone(), 200), &Unlimited)?;92 <Pallet<T>>::create_item(&collection, &owner, (owner_eth.clone(), 200), &Unlimited)?;
93 }: {<Pallet<T>>::set_allowance_for(&collection, &sender, &owner_eth, &spender, 100)?}93 }: {<Pallet<T>>::set_allowance_from(&collection, &sender, &owner_eth, &spender, 100)?}
9494
95 transfer_from {95 transfer_from {
96 bench_init!{96 bench_init!{
modifiedpallets/fungible/src/common.rsdiffbeforeafterboth
272 );272 );
273273
274 with_weight(274 with_weight(
275 <Pallet<T>>::set_allowance_for(self, &sender, &from, &to, amount),275 <Pallet<T>>::set_allowance_from(self, &sender, &from, &to, amount),
276 <CommonWeights<T>>::approve_from(),276 <CommonWeights<T>>::approve_from(),
277 )277 )
278 }278 }
modifiedpallets/fungible/src/lib.rsdiffbeforeafterboth
620 /// - `from`: Owner's eth mirror.620 /// - `from`: Owner's eth mirror.
621 /// - `to`: Recipient of the allowance rights.621 /// - `to`: Recipient of the allowance rights.
622 /// - `amount`: Amount of tokens the spender is allowed to `transfer` or `burn`.622 /// - `amount`: Amount of tokens the spender is allowed to `transfer` or `burn`.
623 pub fn set_allowance_for(623 pub fn set_allowance_from(
624 collection: &FungibleHandle<T>,624 collection: &FungibleHandle<T>,
625 sender: &T::CrossAccountId,625 sender: &T::CrossAccountId,
626 from: &T::CrossAccountId,626 from: &T::CrossAccountId,
modifiedpallets/nonfungible/src/benchmarking.rsdiffbeforeafterboth
141 };141 };
142 let owner_eth = T::CrossAccountId::from_eth(*sender.as_eth());142 let owner_eth = T::CrossAccountId::from_eth(*sender.as_eth());
143 let item = create_max_item(&collection, &owner, owner_eth.clone())?;143 let item = create_max_item(&collection, &owner, owner_eth.clone())?;
144 }: {<Pallet<T>>::set_allowance_for(&collection, &sender, &owner_eth, item, Some(&spender))?}144 }: {<Pallet<T>>::set_allowance_from(&collection, &sender, &owner_eth, item, Some(&spender))?}
145145
146 transfer_from {146 transfer_from {
147 bench_init!{147 bench_init!{
modifiedpallets/nonfungible/src/common.rsdiffbeforeafterboth
369369
370 with_weight(370 with_weight(
371 if amount == 1 {371 if amount == 1 {
372 <Pallet<T>>::set_allowance_for(self, &sender, &from, token, Some(&to))372 <Pallet<T>>::set_allowance_from(self, &sender, &from, token, Some(&to))
373 } else {373 } else {
374 <Pallet<T>>::set_allowance_for(self, &sender, &from, token, None)374 <Pallet<T>>::set_allowance_from(self, &sender, &from, token, None)
375 },375 },
376 <CommonWeights<T>>::approve_from(),376 <CommonWeights<T>>::approve_from(),
377 )377 )
modifiedpallets/nonfungible/src/lib.rsdiffbeforeafterboth
1176 /// - `from`: Address of sender's eth mirror.1176 /// - `from`: Address of sender's eth mirror.
1177 /// - `to`: Adress of spender.1177 /// - `to`: Adress of spender.
1178 /// - `token`: Token the spender is allowed to `transfer` or `burn`.1178 /// - `token`: Token the spender is allowed to `transfer` or `burn`.
1179 pub fn set_allowance_for(1179 pub fn set_allowance_from(
1180 collection: &NonfungibleHandle<T>,1180 collection: &NonfungibleHandle<T>,
1181 sender: &T::CrossAccountId,1181 sender: &T::CrossAccountId,
1182 from: &T::CrossAccountId,1182 from: &T::CrossAccountId,
modifiedpallets/refungible/src/benchmarking.rsdiffbeforeafterboth
170 };170 };
171 let owner_eth = T::CrossAccountId::from_eth(*sender.as_eth());171 let owner_eth = T::CrossAccountId::from_eth(*sender.as_eth());
172 let item = create_max_item(&collection, &owner, [(owner_eth.clone(), 200)])?;172 let item = create_max_item(&collection, &owner, [(owner_eth.clone(), 200)])?;
173 }: {<Pallet<T>>::set_allowance_for(&collection, &sender, &owner_eth, &spender, item, 100)?}173 }: {<Pallet<T>>::set_allowance_from(&collection, &sender, &owner_eth, &spender, item, 100)?}
174174
175 transfer_from_normal {175 transfer_from_normal {
176 bench_init!{176 bench_init!{
modifiedpallets/refungible/src/common.rsdiffbeforeafterboth
327 amount: u128,327 amount: u128,
328 ) -> DispatchResultWithPostInfo {328 ) -> DispatchResultWithPostInfo {
329 with_weight(329 with_weight(
330 <Pallet<T>>::set_allowance_for(self, &sender, &from, &to, token_id, amount),330 <Pallet<T>>::set_allowance_from(self, &sender, &from, &to, token_id, amount),
331 <CommonWeights<T>>::approve_from(),331 <CommonWeights<T>>::approve_from(),
332 )332 )
333 }333 }
modifiedpallets/refungible/src/lib.rsdiffbeforeafterboth
1107 /// - `from`: Address of sender's eth mirror.1107 /// - `from`: Address of sender's eth mirror.
1108 /// - `to`: Adress of spender.1108 /// - `to`: Adress of spender.
1109 /// - `amount`: Amount of token pieces the spender is allowed to `transfer` or `burn.1109 /// - `amount`: Amount of token pieces the spender is allowed to `transfer` or `burn.
1110 pub fn set_allowance_for(1110 pub fn set_allowance_from(
1111 collection: &RefungibleHandle<T>,1111 collection: &RefungibleHandle<T>,
1112 sender: &T::CrossAccountId,1112 sender: &T::CrossAccountId,
1113 from: &T::CrossAccountId,1113 from: &T::CrossAccountId,