Published in


Creating EVM packages with zOS!

A step towards a more complex Smart Contract architecture

What is an EVM package?

Building an EVM Package

pragma solidity ^ 0.4 .24;import "zos-lib/contracts/Initializable.sol";contract Random is Initializable {uint256 public seed;function initialize(uint256 mySeed) initializer public {
seed = mySeed;
function getRandom(uint256 number) public view returns(uint8) {
return uint8(uint256(keccak256(abi.encodePacked(block.timestamp, block.difficulty, number, seed))) % 251);
zos publish --network local

Using a published EVM package in your project

pragma solidity ^0.4.24;import "openzeppelin-eth/contracts/token/ERC721/ERC721Mintable.sol";contract SIMPLEToken{
ERC721Mintable private _token;
function setToken(ERC721Mintable token) external {
require(token != address(0));
_token = token;
zos link openzeppelin-eth
zos add SIMPLEToken
zos session --network local --from 0x1df62f291b2e969fb0849d99d9ce41e2f137006e --expires 3600
zos push --deploy-dependencies
zos create SIMPLEToken
zos create openzeppelin-eth/StandaloneERC721 --init initialize --args SIMPLEToken,BTS,[<address>],[<address>]
npx truffle console --network local
truffle(local)> SIMPLEToken.at('<my-linked-contract-address>').setToken('<my-erc721-address>')
  • <my-linked-contract-address> with the address you got while running zos create SIMPLEToken
  • <my-erc721-address> with the address you got while creating StandaloneERC721 instance (check above command)


About QuikNode



A platform to access ETH, BTC, BSC, MATIC, OPTIMISM, ARBITRUM, FTM, CELO, SOL, TERRA & xDAI blockchains via API. Infra & tools to build + scale your #Web3 dApp!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store