New answers tagged

0

Well I would say that if these are your NFTs attributes that you are storing on chain. Both of them are inefficient. Your going to have the user spend a lot of gas on the storage for that data. Most efficient way to store data is with IPFS. You can store all the data you want on IPFS and the only thing that get's stored in the contract is the CID of your ...


0

should not the function be called like this, await deals._didToDealIndexes( "did1" )[ethers.BigNumber.from("0")]


0

There's some difference in behavior but in your example the gas consumption is about the same. An array has to maintain its length and your mapping uses a counter instead. All data in the array is stored continuously and the mapping is spread in the store but that doesn't affect the costs.


0

As a concrete example for a for loop mentioned in Miguel Mota's answer, here's a simple for loop in Solidity that achieves the contains functionality: bool doesListContainElement = false; for (uint i=0; i < list.length; i++) { if (elementToLookFor == list[i]) { doesListContainElement = true; } }


Top 50 recent answers are included