I have a contract like this
pragma solidity ^0.4.24;
import './MyLibrary.sol';
contract A {
// Do Stuff
}
And I have a factory contract instanciating A contracts
pragma solidity ^0.4.24;
import './A.sol';
contract B {
mapping(uint => address) instances;
function newA(uint id) {
instances[id] = new A();
}
}
I want to use B as a factory, and A is calling MyLibrary regularly. Is there any way with Truffle migrations to do something like this (deploying MyLibrary on the network, and then linking each A deployed contracts with the library)? It's easy to link a library to a contract during deployment, but I don't know how to do it dynamically on the blockchain.