We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

SAMUEL SADEK • 3 years ago

Hello,
Thanks for the great insight!
I have problems deploying a library inside deploy_contracts.ts file, namely UniswapV2Library.
Both the SafeMath and UniswapV2Library.json files exist under build/contracts directory but no accompanying .ts file for them under types\truffle-contracts directory when I generate the typefiles. What´s seem to be the issue as I´m struggling on this last point.

Thank you!

type Network = "development" | "kovan" | "mainnet";

module.exports = (artifacts: Truffle.Artifacts) => {
return async (
deployer: Truffle.Deployer,
network: Network,
accounts: string[]
) => {
const SafeMath = require("@openzeppelin/contracts/utils/math/SafeMath.sol");
const UniswapV2Library = artifacts.require("UniswapV2Library");
const FlashloanArbitrage = artifacts.require("FlashloanArbitrage");

deployer.deploy(SafeMath);
deployer.link(SafeMath, UniswapV2Library);
deployer.deploy(UniswapV2Library);
deployer.link(UniswapV2Library, FlashloanArbitrage);
deployer.deploy(FlashloanArbitrage,
// sushiFactory flashloaner
web3.utils.toChecksumAddress("0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac"),
// uniswap Router
web3.utils.toChecksumAddress("0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D"))

const flashloanArbitrage = await FlashloanArbitrage.deployed();
console.log(
`FlashloanArbitrage deployed at ${flashloanArbitrage.address} in network: ${network}.`
);
}
}

Markus Waas • 3 years ago

Hello Samuel, have you looked at https://github.com/dethcryp... ?