You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On Solidity we cannot add new variable to a parent class, if the child class have some custom properties, as the index of the variable must be consistent.
A known solution is to use __gap properties.
Storage gaps are a convention for reserving storage slots in a base contract, allowing future versions of that contract to use up those slots without affecting the storage layout of child contracts.
To create a storage gap, declare a fixed-size array in the base contract with an initial number of slots. This can be an array of uint256 so that each element reserves a 32 byte slot. Use the name __gap or a name starting with _gap for the array so that OpenZeppelin Upgrades will recognize the gap:
On Solidity we cannot add new variable to a parent class, if the child class have some custom properties, as the index of the variable must be consistent.
A known solution is to use
__gap
properties.Storage gaps are a convention for reserving storage slots in a base contract, allowing future versions of that contract to use up those slots without affecting the storage layout of child contracts.
To create a storage gap, declare a fixed-size array in the base contract with an initial number of slots. This can be an array of uint256 so that each element reserves a 32 byte slot. Use the name __gap or a name starting with _gap for the array so that OpenZeppelin Upgrades will recognize the gap:
with a new version reducing the
__gap
propertyor
The text was updated successfully, but these errors were encountered: