From 62a3acac7d23204fe41e238335c10dbcd1224f03 Mon Sep 17 00:00:00 2001 From: Nadai2010 Date: Fri, 20 Sep 2024 10:59:07 +0100 Subject: [PATCH] fmt --- packages/snfoundry/contracts/src/YourCollectible.cairo | 8 +++++--- .../contracts/src/components/ERC721Enumerable.cairo | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/snfoundry/contracts/src/YourCollectible.cairo b/packages/snfoundry/contracts/src/YourCollectible.cairo index 291aecc9..b58d5b02 100644 --- a/packages/snfoundry/contracts/src/YourCollectible.cairo +++ b/packages/snfoundry/contracts/src/YourCollectible.cairo @@ -166,8 +166,8 @@ mod YourCollectible { enumerable_component.all_tokens_length.write(length + 1); } else if (token_id < token_id_counter + 1) { // `Transfer Token` Case: Remove token from owner and update enumerable component - // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and - // then delete the last slot (swap and pop). + // To prevent a gap in from's tokens array, we store the last token in the index of + // the token to delete, and then delete the last slot (swap and pop). let owner = self.owner_of(token_id); if owner != to { let last_token_index = self.balance_of(owner) - 1; @@ -179,7 +179,9 @@ mod YourCollectible { .owned_tokens .read((owner, last_token_index)); // Move the last token to the slot of the to-delete token - enumerable_component.owned_tokens.write((owner, token_index), last_token_id); + enumerable_component + .owned_tokens + .write((owner, token_index), last_token_id); // Update the moved token's index enumerable_component.owned_tokens_index.write(last_token_id, token_index); } diff --git a/packages/snfoundry/contracts/src/components/ERC721Enumerable.cairo b/packages/snfoundry/contracts/src/components/ERC721Enumerable.cairo index a6f02b47..8fd7760b 100644 --- a/packages/snfoundry/contracts/src/components/ERC721Enumerable.cairo +++ b/packages/snfoundry/contracts/src/components/ERC721Enumerable.cairo @@ -19,7 +19,7 @@ pub mod ERC721EnumerableComponent { owned_tokens: LegacyMap<(ContractAddress, u256), u256>, // Mapping from token ID to index of the owner tokens list owned_tokens_index: LegacyMap, - // Mapping with all token ids, + // Mapping with all token ids, all_tokens: LegacyMap, // Helper to get the length of `all_tokens` all_tokens_length: u256,