Is my custom type or struct compatible with Upgradeability?

Hello, i was reading the frequently asked questions about upgradeability, and it said to refer to forum and ask whether or not my structs are safe for proxies.

So my structs are as follows

struct Reserves {
        uint256 eth;
        uint256 token;
        uint256 lastPrice;
        uint256 middlePrice;
    }

    struct EthRef {
        uint256 eth;
        address ref;
    }

Thanks in advance!

1 Like

Hi @Dellybro,

For anyone reading this, the Upgrades Plugins don’t currently support checking enums and structs for upgrade safety, see: https://docs.openzeppelin.com/upgrades-plugins/1.x/faq#why-cant-i-use-custom-types

For checking for upgrade safety I suggest writing higher level tests that check all the state before and after an upgrade, see the proxy tests for an example: OpenZeppelin Upgrades: Step by Step Tutorial for Truffle

How are you using your structs? (e.g. in a mapping or a state variable)

Are you able to share your smart contract?

Depending on how you are using your structs, this may limit what changes you can make to state variables in upgrades.

Hi @Dellybro,

Just wanted to follow up to see if you needed more information?