New answers tagged

0

It's because when the Auction contract reads the users; it only gets data types of array and not the names you have used in Resigtry contract. Understand it like this; uint => (address, int16, int8, uint, bool, int, address) So Auction contract can not lookup Address. Solution: You can use (address userAddress,,,,,,) = r.users(i); if(bid ==userAddress) { ...


0

So it seems that in the function hasAccount I am accessing msg.sender. It seems like this is not working in a view function, so it always returned false.


0

Deep down, you don't interact with the mapping. The public modifier does several things, one of those things is generate a "free" view function. You would get the same effect by removing public and instead, explicitly writing a view function like this: function patient_db(uint index) public view returns(string memory name, string memory blood) { ...


0

You cannot create a mapping (or a struct containing a mapping) in memory. So, convert your code from this: contract Campaign { struct Request { string description; uint value; address recipient; bool complete; uint approvalCount; mapping(address => bool) approvals; } Request[] public requests; ...


2

First thing. This bad form because there significant differences between 0.5.0x and 0.8.3. You should be giving an indication of the range that actually compiles and works, or even better, just declare the compiler you are using like: pragma solidity 0.8.3; Since this is using elements of the formerly "experimental ABI" there is no doubt the code ...


1

Mapping is a Key-Value storage, such that it stores a record's value as a hash. In fact, when you add a record to mapping by passing your key and value to it, mapping hashes that value. Hash is one-way, that means if one doesn't know hashing key cannot achieve the plain value . The embedded key is used to find the related hash. Finding works the way you give ...


0

if you want to traverse all address, may use a map from address to an array, but this costs a lot of gas. If you only want to tell whether the address already exists, maybe use another map to maintain this kind of information.


Top 50 recent answers are included