I wanted to create a getter function to access a mapping nested inside a struct. But the function that I made required me to use the expiremental version (I'm on Remix).
So I used the expiremental version to verify if the code I had done was correct and it was. Here the used code that I simplified as much as I could:
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
contract SupChain{
enum StateType {Created, InTransit, Stored, OutOfComplicance, Completed}
struct Status{
StateType state;
address currentCounterparty;
string test;
}
struct Order{
uint256 orderID;
uint256 NumberOfUpdate;
string test;
mapping (uint256 => Status) statutes;
}
mapping (uint256 => Order) public orders;
function getStatus(uint256 id, uint256 concernedStatusNumber)
public returns (Status memory status){
Order storage concernedOrder = orders[id];
Status memory concernedStatus = concernedOrder.statutes[concernedStatusNumber];
return concernedStatus;
}
Now I would like to be capable to access to the map without using the expiremental version. How do I code such a getter version ?