contract Published {
struct Test {
uint testData_1;
uint testData_2;
}
// address => tokenId => struct
mapping(address => mapping(uint256 => Test)) public tests;
}
The new contract reads from the already published one.
// NEW CONTRACT THAT READS FROM THE PUBLISHED
// Add the getter function to the contract Interface
interface IPublished {
XXXXX
}
contract New {
IPublished publishedContract;
constructor(
address _publishedContract
) {
publishedContract = IPublished(_publishedContract);
}
function getFromMapping(
address caller,
uint256 tokenId
) external returns (IPublished.Test memory test) {
return publishedContract.tests(caller, tokenId);
}
}