CRYPTO NEWS

how to Reset all True Values to False in one Function

I am trying to create a contract that would let a holder of an NFT call a function a single time until an event occurs at a later time and then that function may be called again. the following code function achieves the first half of what I am trying to accomplish

function registertokenId(uint256 tokenId) public {     require(msg.sender == ownerOf(tokenId));     require(tokenIsEntered == false);     require(tokenEntered[tokenId] != true);     s_entrants.push(payable(msg.sender));     tokensEntered.push(tokenId);     tokenEntered[tokenId] = true; 

this works perfectly and as intended so far as I can tell tinkering on remix. however I am looking for an efficient way to reset all uint256 of tokenId entered into a mapping to be reset to false in a separate function.

while I am aware that the function `function resetArrayTest() public {

    tokenEntered[tokenId] = false; 

}`

resets the bool to false at the zero index of the array, I would like to find out if there is a way to reset them all at once.

full code is as follows

// SPDX-License-Identifier: MIT 

pragma solidity ^0.8.7;

//contract to do: // must make this contract reset after emmit winner—-is this finished yet? more testing??? //must set total supply // must set price

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";

contract BasicNft is ERC721 { error __tokenIsEntered();

string public constant TOKEN_URI =     "ipfs://bafybeig37ioir76s7mg5oobetncojcm3c3hxasyd4rvid4jqhy4gkaheg4/?filename=0-PUG.json"; uint256 private s_tokenCounter; address payable[] public s_entrants; uint256 tokenId; uint256 ownedAmount; uint256 idcounter; bool tokenIsEntered; uint256[10000] private enteredTokens; mapping(uint256 => bool ) public tokenEntered; uint256[] private tokensEntered;     constructor() ERC721("Test", "testing") {                }       function mintNft() public returns (uint256) {     _safeMint(msg.sender, s_tokenCounter);     s_tokenCounter = s_tokenCounter + 1;     return s_tokenCounter; }  function tokenURI(uint256 tokenId) public view override returns (string memory) {     // require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");     return TOKEN_URI; } function registertokenId(uint256 tokenId) public {     require(msg.sender == ownerOf(tokenId));     require(tokenIsEntered == false);     require(tokenEntered[tokenId] != true);     s_entrants.push(payable(msg.sender));     tokensEntered.push(tokenId);     tokenEntered[tokenId] = true; } function resetArrayTest() public {          tokenEntered[tokenId] = false;            }        function getTokenCounter() public view returns (uint256) {     return s_tokenCounter; }   function getNumberOfEntrants() public view returns (uint256){     return s_entrants.length; }             

}

Chinese Tech Giants Vow Support Additional Regulations on Digital Collectibles

Chinese tech giants join the state-backed efforts in regulating the digital collectibles by voicing support for the “self-discipline initiative” that ensures identity checks on users, adheres to the country’s ban on cryptocurrency and prevents the speculation of digital assets. Tech Giants Tiptoeing In Line With Authorities According to the statement by the China Cultural Industry::Listen

Chinese tech giants join the state-backed efforts in regulating the digital collectibles by voicing support for the “self-discipline initiative” that ensures identity checks on users, adheres to the country’s ban on cryptocurrency and prevents the speculation of digital assets.

Tech Giants Tiptoeing In Line With Authorities

According to the statement by the China Cultural Industry Association, a state-supervised organization, the initiative has garnered support from domestic tech giants such as Tencent Holdings, Alibaba’s Ant Group, JD.com, and Baidu, which all have deep involvement with digital collectibles in the country.

Known for its anti-crypto stance, China refers to Non-Fungible-Tokens (NFTs) as digital collectibles, which only support the country’s legal tender, Yuan, as the settlement currency. The initiative reiterates such a stance and calls the giants to follow a set of guidelines to assist regulatory efforts.

Under the 14 articles introduced by the initiative, digital collectable platforms are expected to hold relevant regulatory certifications, bolster intellectual property protection, advocate real-name authentications, and avoid establishing secondary markets meant for speculative purposes.

Alibaba-owned South China Morning Post cited a source acquired from the blockchain industry in China, stating that the initiative does not “represent the government’s stance.” Rather, it is an industry-driven attempt to respond to the previous guidelines issued by government-managed industry associations, aiming to prohibit “the financialization of digital collectibles” through securities, insurance, loans, and precious metals.

The Rise of Digital Collectibles in China

Despite the government-issued warnings on the risk of digital collectibles, the number of domestic platforms that offer services in such trading has grown five times from February to June.

Meanwhile, tech firms stepping into this sensitive field in China remain low-key, as they tried not to cross the red line as dictated by the authorities. As expected, they all avoided using the term “NFTs” to describe digital collectibles, as regulatory authorities tend to link NFTs with speculations on cryptocurrencies.

Tencent and Ant Group have private and permissioned blockchains separated from the global NFT markets, mostly built upon layer-one blockchains like Ethereum, Solana, Flow, etc. In compliance with relevant regulatory scrutiny, platforms only let owners treat their assets as digital gifts absent from financial speculations.

how to Reset all True Values to False in one Function

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