Could not find zos-lib/contracts/migrations/Migratable.sol from any sources when following tutorial

Hi. I am going to the official Tutorial for upgradable SmartContracts using OpenZellin-OS and got in stuck very fast:

The base contract is importing zos-lib/contracts/migrations/Migratable.sol. But there is none in zos-lib.

pragma solidity ^0.4.21;
import "zos-lib/contracts/migrations/Migratable.sol";

contract MyContract is Migratable {
  uint256 public x;

  function initialize(uint256 _x) isInitializer("MyContract", "0") public {
    x = _x;
  }
}

The command zos add MyContract gives the following error:

Could not find zos-lib/contracts/migrations/Migratable.sol from any sources

Looking into the sos-lib package, there is no migration-folder.

$ ls -l node_modules/zos-lib/contracts/

lists only those:

Initializable.sol 
application       
cryptography      
ownership         
upgradeability    
util

Do I have to add more packages in order to make it work?

2 Likes

Hi @oxuw4 I get the same error, using the following versions:

zos --version 2.3.0
truffle version Truffle v5.0.2 (core: 5.0.2)

Just some housekeeping, I have moved the topic to the #support:zeppelinos category so we can track it until we have an answer and renamed the topic slightly to be clear that this is an issue when following the tutorial.

It seems that things have changed significantly here. Referring to this tutorial, which seems to be more up to date, the initializing-process goes as follows:

pragma solidity ^0.5.0;

import "zos-lib/contracts/Initializable.sol";

contract MyContract is Initializable {

  uint256 public x;
  string public s;

  function initialize(uint256 _x, string memory _s) initializer public {
    x = _x;
    s = _s;
  }
}

Please consider the import of initializable.sol instead migratable.sol

Hope this helps.

4 Likes

Hey @itinance. Thanks for your contribution!

2 Likes

The current tutorial for ZeppelinOS:

The current tutorial for using ZepKit:
https://zepkit.zeppelinos.org/

The tutorial is for ZeppelinOS 1.x
Migratable has been deprecated.

https://docs.zeppelinos.org/docs/new_2.html
On 2.x, the Migratable contract has been deprecated, and we are shifting to a much simpler flavour of Initializable .

Apologies for the confusion. I have logged as an issue to improve the documentation: https://github.com/zeppelinos/zos/issues/923

2 Likes