MirrorgateFeeLibraryV02.js 994 B

12345678910111213141516171819202122232425262728
  1. module.exports = async function ({ ethers, deployments, getNamedAccounts }) {
  2. const { deploy } = deployments
  3. const { deployer } = await getNamedAccounts()
  4. const factory = await ethers.getContract("Factory")
  5. const { address } = await deploy("MirrorgateFeeLibraryV02", {
  6. from: deployer,
  7. args: [factory.address],
  8. log: true,
  9. waitConfirmations: 1,
  10. })
  11. let tx
  12. let currFeeLibrary = await factory.defaultFeeLibrary()
  13. if (address !== currFeeLibrary) {
  14. tx = await (await factory.setDefaultFeeLibrary(address)).wait()
  15. if (hre.network.name !== "hardhat") {
  16. console.log(`factory.setDefaultFeeLibrary(${address}) | tx: ${tx.transactionHash}`)
  17. }
  18. } else {
  19. if (hre.network.name !== "hardhat") {
  20. console.log(`factory.setDefaultFeeLibrary(${address}) | *already set*`)
  21. }
  22. }
  23. }
  24. module.exports.tags = ["MirrorgateFeeLibraryV02", "test"]
  25. module.exports.dependencies = ["Factory"]