How to upgrade the zos to SDK?

what should I pay attention to?

1 Like

Hi @Tamir,

Welcome to the community :wave:

I suggest you look at the Migrating from ZeppelinOS to the OpenZeppelin SDK section of Announcing the OpenZeppelin SDK

Feel free to ask specific questions too.

1 Like

Hi @Tamir,

How did you get on with upgrading?

  1. mkdir .openzeppelin in root dir
  2. mv zos.{netowork}.json to .openzeppelin/{network}.json
  3. replace 'openzeppelin-eth' to '@openzeppelin/contracts-ethereum-package' in all-files(contract dir、json、js)
  4. replace to 'zos-lib' to '@openzeppelin/upgrades' in all-files(contract dir、json、js)

then i am re-runing test now, i will response you if it's finished

1 Like

I can passed all the contract tests.

then i got a few of warns when run npx openzeppelin push --network rinkeby
@abcoathup

warn:

  1. enum automatically checked

how to fix the warn?

1 Like

Hi @Tamir,

OpenZeppelin SDK automatically checks for storage compatibility, though the current version doesn’t have automatic checks for variables with struct or enums. So there isn’t a way to remove the warnings.

The warnings are to get you to check that the order in which the contract state variables are declared, and their type are not changed between upgrades for the following variables:

  • _whitelistAdmins in WhitelistAdminRole
  • _whitelisteds in WhitelistedRole
  • _pausers in PauserRole
  • calls in AssetERC721

You should check the original version of each of the variables with the upgraded version to ensure the order they are declared and the type hasn’t changed.
Assuming you upgraded from a recent version of openzeppelin-eth then I wouldn’t expect issues with the variables in Roles.

See the documentation for more information on this:
https://docs.openzeppelin.com/sdk/2.5/writing-contracts#modifying-your-contracts

It is also recommended to test your upgrade locally before running the upgrade in production.