OpenZeppelin / openzeppelin-sdk

OpenZeppelin SDK repository for CLI and upgrades.js. No longer actively developed.
MIT License
431 stars 201 forks source link

Support for loom-network #405

Open crackwei opened 6 years ago

crackwei commented 6 years ago

hello, i was tried zos and openzeppelin on last 2 month,they are very good.for now i already deploied to our program.but as the gas reason,we want to deploy zos program to loom-network.the problem is promopt the error,as "web3 version error".so my problem is :

does Zos support loom-network?and how to?

i try truffle migrate,and can deploy to loom-network.

crackwei commented 5 years ago

i change the function getNodeVersion of "zos-lib/lib/utils/Transactions.js",and it can be work:

async function getNodeVersion() {
  await web3.version.getNode(function(error, result)
  {
    if (error)
    {
      state.nodeInfo = 'UnknowNetwork'
    }
    else if (!state.nodeInfo) {
      state.nodeInfo = (0, _util.promisify)(web3.version.getNode.bind(web3.version))();
    }
  });
  if (!state.nodeInfo)
  {
    state.nodeInfo = await (0, _util.promisify)(web3.version.getNode.bind(web3.version))();
  }

  return state.nodeInfo;
}
crackwei commented 5 years ago

can be run "zos push ..." after i change the getNodeVersion code.but it still have an error after created proxy when get implementation of the contract.problem is in the function getStorageAt(position){...}, provider did not support "web3_getStorageAt()"

abcoathup commented 5 years ago

Need Loom (loom-truffle-provider) to support JSON RPC methods web3_clientVersion and eth_getStorageAt

Loom Issue: https://github.com/loomnetwork/loom-js/issues/306

network.js for Loom extdev_plasma_us1

const { readFileSync } = require('fs')
const LoomTruffleProvider = require('loom-truffle-provider')

const chainId = 'extdev-plasma-us1'
const writeUrl = 'http://extdev-plasma-us1.dappchains.com:80/rpc'
const readUrl = 'http://extdev-plasma-us1.dappchains.com:80/query'

// ./privateKey file contains a base64 encoded key generated by the command:
// loom genkey -a publicKey -k privateKey
const privateKey = readFileSync('./privateKey', 'utf-8')

const loomTruffleProvider = new LoomTruffleProvider(chainId, writeUrl, readUrl, privateKey)

// Create 10 extra accounts, useful for tests
loomTruffleProvider.createExtraAccounts(10)

const loomProvider = loomTruffleProvider.getProviderEngine()

loomProvider.addCustomMethod('web3_clientVersion', payload => {
  return 'Loom/v1.0.0/loom-js'
})

module.exports = {
  networks: {
    extdev_plasma_us1: {
      provider: function() {
        return loomTruffleProvider
      },
      networkId: '9545242630824'
    },
  },
};

Topic in Community Forum: https://forum.openzeppelin.com/t/loom-support/1239