I am new to programming and trying to access a struct located in another smart contract but am receiving the following error.
"TypeError: Member "Address" not found or not visible after argument-dependent lookup in tuple(address,int16,int8,uint256,bool,int256,address). --> Auction.sol:45:23: | 45 | if(bid == r.users(i).Address) x = true;"
Is it possible to access structs in mappings of different contracts?
My code is as follows:
pragma solidity ^0.8.3;
contract Registry {
mapping(int => User) public users;
int8 public userCount = 0;
struct User {
address Address;
int16 Longitude;
int8 Latitude;
uint Transformer_ID;
bool Is_Prosumer;
int Peak_Power;
address Smart_Meter;
}
function addUser(int16 _longitude, int8 _latitude, uint _transformerID, bool _isProsumer, int _peakPower, address _smartMeter) public {
users[userCount] = User(msg.sender, _longitude, _latitude, _transformerID, _isProsumer, _peakPower, _smartMeter);
userCount ++;
}
}
contract Auction {
Registry r;
address registryAddr;
function RegistryRead(address addr) public {
registryAddr = addr;
r = Registry(r);
}
function verify(address addr, address bid) public returns (bool) {
int i; bool x = false;
int8 max = r.userCount();
for(i = 0; i == max; i ++)
if(bid == r.users(i).Address) x = true;
return x;
}
}