How to integrate openzeppelin upgrade module to a truffle project, specifically how to "link"?

Viewed 169

I'm trying to make my solidity project upgradeable using openzeppelin's upgrade module. I' ve tryed a lot by the openzeppelin upgrade. And it's fine if I just deployed single contract. Problems occured when I wanted to link a library contract.

For example:

const { scripts, ConfigManager } = require('@openzeppelin/cli');
const { add, push, create } = scripts;

async function deploy(options) {
  add({ contractsData: [{ name: 'Counter', alias: 'Counter' }] });
  await push(options);
  await create(Object.assign({ contractAlias: 'Counter' }, options));
}

module.exports = function(deployer, networkName, accounts) {
  deployer.then(async () => {
    const { network, txParams } = await ConfigManager.initNetworkConfiguration({ network: networkName, from: accounts[0] })
    await deploy({ network, txParams })
  })
}

The code above is from the openzeppelin doc. It's fine for me. But in my condition, I want to link a library, the native truffle deploy code is below :

await deployer.deploy(A);
await deployer.link(A, B);
await deployer.deploy(B);

So what should I do if I want to deal with the link to the upgradeable format. In other words, how to convert the native truffle format to the oz upgradeable format for link. I've Googled a lot but there seems nothing talking about this subject.

Hope you guys could help me. By the way, I'm not a native English speaker. So please forgive my Enghlish :)

1 Answers

I put the question in openzeppelin's forum. And there's seems no way to do it now according to this post. Maybe I'll just have to use the oz CLI command.

Related