0

I reviewed the other questions that had a similar error and they didn't help with my problem.

On my main net contract, with my MetaMask on main net, I am getting this error when processing transactions. I was trying to send funds to my escrow contract and the dapp only uses DAI. It is saying there is no DAI contract on main net??

Error:

Uncaught in promise error: DAI has not been deployed to detected network, network artifact mismatch

Here is my migration deploy contract js file. I used Truffle:

const Escrow = artifacts.require("./Escrow.sol");
const DAI = artifacts.require("./DAI.sol");

const DAI_COIN_ADDRESS = "0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359";

const ARBITRATOR = "0x000000000000etc...";

 module.exports = (deployer, network, accounts) => {
   console.log(accounts[0]);
   deployer.deploy(Escrow, DAI_COIN_ADDRESS, ARBITRATOR, {from: accounts[0]});
 };

2 Answers 2

1

This is usually confusion between truffle and the deployment history (./contracts/build) and the interpretation of the setting (truffle.js).

Confirm the contract is deployed on mainnet and truffle knows about it.

$ truffle networks
contract ... address

If this is the case (you can see it plainly) then your dapp should by using

var contract;
Contract.deployed().then(function(instance) { contract = instance; }

If not, but you know the address on mainnet, you can monkey-hammer it with

var contract = Contract.at(<address>);

Deep down, it's not always the best idea to deploy from a dev machine that usually has a lot of noise in the ./contract/build/Contract.json and it can be better to move contracts to a staging server that will run "official release" migrations and generate official abstraction builds.

Hope it helps.

0
0

After running truffle networks per the above I did see that my main network deployment didn't have a DAI contract associated with it. But my other networks did, like Ropsten.

To solve the issue I updated my DAI.json file with the mainnet DAI address and changed the network from 3 to 1. For some odd reason the build folder that was generated did update the dai.json with the correct network, but still managed to successfully deploy to the main net.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.