New answers tagged

0

It's actually part of a broader concern. You can put access control on a read-only function, but an adversary will: Have all of your code Have all of the data Therefore, an adversary will get around any notion of confidentiality you construct. private doesn't change that. The most you can do is inconvenience a determined adversary. Since it is ...


1

This field's type is editor[], and its name is editors. So change rentalStructs[_bagId].editor to rentalStructs[_bagId].editors. Also, for good practice, I recommend that you move struct editor { ... } before (above) struct BuildingRental { ... }, since the latter depends on the former and not vice-versa.


0

From Solidity read the docs: Array: Arrays can have a compile-time fixed size, or they can have a dynamic size. Indices are zero-based. Takeaway: Solidity does not support heterogeneous arrays yet, i.e. the indices for arrays are integers and not any other value. Mapping: Mapping types use the syntax mapping (_KeyType => _ValueType) and variables of ...


1

If you need any of the following to run in O(1) operations: Get an item by unique ID which is not a sequential number (e.g., an address) Remove an item Then an array is inappropriate, and you must use a mapping.


0

I tried the contracts in Remix and they kind of work, updateDoc might trigger the event DocUploaded multiple times and the _title is not updated. The function updateDoc doesn't need to iterate over the mapping. It can access the Doc directly with _id. function updateDoc(uint _id, string memory _IPFShash, string memory _title) public { if (Docs[_id].id =...


Top 50 recent answers are included