Hey, guys. In my smart-contract I need to check whether the user has any token of another ERC721 contract. I don't care about what specific token user has. So I can easily use balanceOf function.

But what if another contract was ERC1155? That brings a lot of inconveniences. To use balanceOf I have to pass id, which I don't know. So just to determine whether user has any NFT of ERC1155, I need use Moralis or something else to fetch user's tokens and then I can call balanceOf passing any of fetched ids. Is that so?

Aug 20, 2022, 6:40 PM
how are u calling moralis from smart contract?
Aug 20, 2022, 6:58 PM
Not from smart-contract, from frontend or backend and then pass any id to my smart-contract, so it can call balanceOf to check whether the user has any ERC1155.

My case is to check in smart-contract whether user has any token of another contract. With ERC721 it's easy, but it's not when it comes to ERC1155.
I'm writing a staking contract for 1155. But if user has any nft of another 721, then he'll get extra 10% of tokens.
Now I'm just thinking what would I do if another contract was 1155, because I can't call bonusContract.balanceOf(address), as I need to pass any id.
Aug 20, 2022, 7:03 PM
consider staking the 721 too, otherwise we could all share one nft while depositing/withdrawing to get the boost

the other thing i dunno
Aug 20, 2022, 7:11 PM

© 2024 Draquery.com All rights reserved.