Skip to content

Owner of 721 and 1155 fix#715

Merged
robGG1997 merged 31 commits intomainfrom
rob/721-1155-integer-check-701
Nov 9, 2023
Merged

Owner of 721 and 1155 fix#715
robGG1997 merged 31 commits intomainfrom
rob/721-1155-integer-check-701

Conversation

@robGG1997
Copy link
Copy Markdown
Contributor

@robGG1997 robGG1997 commented Nov 8, 2023

closes #701

There is no ownerOf function for ERC1155 because a token is not necessarily unique, it can have multiple owners. So I didn't implement it.
BatchOwnerOf already works with both types for tokenId so no need for a refactor there.

@robGG1997 robGG1997 self-assigned this Nov 8, 2023
@robGG1997 robGG1997 force-pushed the rob/721-1155-integer-check-701 branch from 96179ed to 5ece09b Compare November 8, 2023 08:17
@robGG1997 robGG1997 force-pushed the rob/721-1155-integer-check-701 branch from 64eedf8 to 18d7bc3 Compare November 8, 2023 10:19
@robGG1997 robGG1997 marked this pull request as ready for review November 8, 2023 10:25
@RyRy79261
Copy link
Copy Markdown
Contributor

@robGG1997

So with ERC1155, theres a concept of BalanceOf & BalanceOfBatch

This allows you to see how many of a token, by its ID, an account has. If you have set up the token by that ID to be a singular, unique, NFT. Then it would return a balance of 1.

If it is an NFT that you've issued a few of, say a badge for attending an event, multiple accounts could have a balance of 1.

If its gold in a game, then the balance would return more than 1 in some instances:
https://docs.openzeppelin.com/contracts/3.x/erc1155

@robGG1997
Copy link
Copy Markdown
Contributor Author

@robGG1997

So with ERC1155, theres a concept of BalanceOf & BalanceOfBatch

This allows you to see how many of a token, by its ID, an account has. If you have set up the token by that ID to be a singular, unique, NFT. Then it would return a balance of 1.

If it is an NFT that you've issued a few of, say a badge for attending an event, multiple accounts could have a balance of 1.

If its gold in a game, then the balance would return more than 1 in some instances: https://docs.openzeppelin.com/contracts/3.x/erc1155

Understood, so I should refactor Balance function instead?

@RyRy79261
Copy link
Copy Markdown
Contributor

@robGG1997 Yeah I rate just adding the non batch variant for 1155 if its missing is fine. I still need to actually review the code though.

@robGG1997 robGG1997 force-pushed the rob/721-1155-integer-check-701 branch from 51f8b89 to b520786 Compare November 8, 2023 12:54
@robGG1997
Copy link
Copy Markdown
Contributor Author

@robGG1997 Yeah I rate just adding the non batch variant for 1155 if its missing is fine. I still need to actually review the code though.

Updated BalanceOf for Erc1155

@robGG1997 robGG1997 requested a review from kantagara November 8, 2023 12:55
@robGG1997 robGG1997 added the ready-to-merge Ready to Merge PR - this'll trigger required checks label Nov 8, 2023
Copy link
Copy Markdown
Contributor

@kantagara kantagara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@robGG1997 robGG1997 force-pushed the rob/721-1155-integer-check-701 branch from a2327af to 4da4916 Compare November 8, 2023 15:42
Copy link
Copy Markdown
Contributor

@juans-chainsafe juans-chainsafe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Samples working! tested with wallet connect and web3auth.

Also fixed the issue with ImportNftTexture scene ✅

@robGG1997 robGG1997 added ready-to-merge Ready to Merge PR - this'll trigger required checks and removed ready-to-merge Ready to Merge PR - this'll trigger required checks labels Nov 9, 2023
@robGG1997 robGG1997 merged commit 3c62d22 into main Nov 9, 2023
@robGG1997 robGG1997 deleted the rob/721-1155-integer-check-701 branch November 9, 2023 06:31
rob1997 pushed a commit that referenced this pull request Jan 16, 2025
* Revert "automated duplicating imported samples modifications (#595)"

This reverts commit a555894.

* checkpoint

* added overload with different typed tokenId parameter

* reverted type cast for batchOwnerOf

* small optimization changes

* Auto-duplicate Packages Samples

* tokenId type now BigInteger

* added overload implementation for 1155

* fix for loading SampleImportNftTexture scene

* Auto-duplicate Packages Samples

---------

Co-authored-by: robGG1997 <robGG1997@users.noreply.github.com>
sergeypanin1994 pushed a commit to sergeypanin1994/web3.unity that referenced this pull request Mar 16, 2025
* Revert "automated duplicating imported samples modifications (ChainSafe#595)"

This reverts commit a555894.

* checkpoint

* added overload with different typed tokenId parameter

* reverted type cast for batchOwnerOf

* small optimization changes

* Auto-duplicate Packages Samples

* tokenId type now BigInteger

* added overload implementation for 1155

* fix for loading SampleImportNftTexture scene

* Auto-duplicate Packages Samples

---------

Co-authored-by: robGG1997 <robGG1997@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Ready to Merge PR - this'll trigger required checks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OwnerOf 721 and 1155 type error with integers

6 participants