--- a/pallets/nft/src/lib.rs +++ b/pallets/nft/src/lib.rs @@ -1143,8 +1143,8 @@ // Check approval let mut approval: u128 = 0; - if >::contains_key(collection_id, (item_id, &from, &recipient)) { - approval = >::get(collection_id, (item_id, &from, &recipient)); + if >::contains_key(collection_id, (item_id, &from, &sender)) { + approval = >::get(collection_id, (item_id, &from, &sender)); ensure!(approval >= value, Error::::TokenValueNotEnough); appoved_transfer = true; } @@ -1165,10 +1165,10 @@ // Reduce approval by transferred amount or remove if remaining approval drops to 0 if approval.checked_sub(value).unwrap_or(0) > 0 { - >::insert(collection_id, (item_id, &from, &recipient), approval - value); + >::insert(collection_id, (item_id, &from, &sender), approval - value); } else { - >::remove(collection_id, (item_id, &from, &recipient)); + >::remove(collection_id, (item_id, &from, &sender)); } match target_collection.mode