CRYPTO NEWS

Cardano (ADA) Awaits Strong Breakout to Move in a Positive Direction!

Cardano is currently ranked 8th amongst the leading cryptocurrency market capitalizations. With its huge valuation being limited, ADA requires a huge buying trend to reach its previous all-time highs witnessed in August 2021. Cardano blockchain showcases immense possibilities in replacing exchange or currency value tokens, which are inexpensive in terms of modern-day value. Since Cardano …

Update HashMap on ERC721 received with Vyper

When a contract receives an NFT by calling safeTransferFrom, onERC721Received is called on the receiving contract and I want to be able to update a Hashmap to record the address of the sender and the NFT token ID. Here, calling setOwner works as expected: ownerMapping: HashMap[address, DynArray[uint256, 3]] @external def setOwner(newAddress:address, nft:uint256): self._setOwner(newAddress, nft) @internal::Listen

When a contract receives an NFT by calling safeTransferFrom, onERC721Received is called on the receiving contract and I want to be able to update a Hashmap to record the address of the sender and the NFT token ID.

Here, calling setOwner works as expected:

ownerMapping: HashMap[address, DynArray[uint256, 3]]  @external def setOwner(newAddress:address, nft:uint256):     self._setOwner(newAddress, nft)      @internal def _setOwner(newAddress:address, nft:uint256):     #set a new owner     self.ownerMapping[newAddress].append(nft) 

but when I try to call _setOwner in the onERC721Received function to keep track of which tokens belong to which addresses, the transaction reverts:

ownerMapping: HashMap[address, DynArray[uint256, 3]]  @external def onERC721Received(_operator: address,_from: address,_tokenId: uint256,_data: Bytes[1024]) -> bytes4:     self._setOwner(_from, _tokenId)     return method_id("onERC721Received(address,address,uint256,bytes)", output_type=bytes4)      @internal def _setOwner(newAddress:address, nft:uint256):     #set a new owner     self.ownerMapping[newAddress].append(nft) 

Cardano (ADA) Awaits Strong Breakout to Move in a Positive Direction!

Shopping cart
There are no products in the cart!
Continue shopping
0