Hello i’m curious about adding new structs into a contract after deploying.
I see upgradeable safe documentation mentions only variables are affected when upgrading, so does this mean we can upgrade our contract with a new struct, and use that new struct with a new mapping variable such as the follow
contract A {
struct X {
uint256 Z
}
mapping(address => X) public myVar1;
}
After upgrade
contract A {
struct X {
uint256 Z
}
struct Y {
uint256 Z
}
mapping(address => X) public myVar1;
mapping(address => Y) public myVar2;
}
@Dellybro The latest release of the upgrades plugins will check structs automatically. The scenario that you described will be allowed, as well as adding new struct members to X.