3

I'm trying to wrap my brain around how to effectively test multi "projects" in Truffle, assume a simple ganache setup, also assume that these contracts seem to work, in remix, and in unit tests, but, i'm paranoid, and i really need more comprehensive functional testing. Assume you will run out of gas if you combine the projects. The Admin contract deploy is similar, so it wasn't included to safe space.

Use the following contracts, in different directories, etc, add others if illustration needed:
a) Admin Contract Project
b) Coin Contract Project

is there a good way to:
1. deploy, migrate, and test project A
2. deploy, migrate, and test project B, and after the deploy of B make calls to A, and test A and B's interactions

Effectively, I want to 'wire' it all up for testing, and then TEST it.

The key here is multiple projects and referencing previous project deploys (which will be on the local dev ganache blockchain). There seems like there should be an easy way to adapt the following structure to meet that need, specifically to reference another projects Admin contract, this will allow wire up and functional testing.

var CoinID = artifacts.require("CoinID");  

module.exports = async function(deployer, accounts) {
  let coinID;

  await Promise.all([
    deployer.deploy(CoinID)
  ]);

  instances = await Promise.all([
      CoinID.deployed()
  ])

  coinID = instances[0];

  results = await Promise.all([
  console.log("Addresses for Contracts:"),
  console.log("CoinID: " + coinID.address),
  coinID.setAdminContractAddress("Admin", "0x39F57B1E3D8cA0b10cD3b8a339d57C6160103b87")
  ]);

};

Note: i have the above working in a 2 project assembly, but i'm REALLY looking at even bigger pictures. How do you EASILY stage a series, say > 5 projects in truffle?

Deploying such all by hand is a bit error prone.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.