Hi again Guys!
Yesterday I had to switch into a new computer and start all the Dex from scratch and I ran into a new problem.
Here is my code: (for token migration)
const Link = artifacts.require("Link");
const Dex = artifacts.require("Dex");
module.exports = async function (deployer, network, accounts) {
await deployer.deploy(Link);
let dex = await Dex.deployed()
let link = await Link.deployed()
await link.approve(dex.address, 500)
dex.addToken(web3.utils.fromUtf8("LINK"), link.address)
await dex.deposit(100, web3.utils.fromUtf8("LINK"))
let balanceOfLink = await dex.balances(accounts[0], web3.utils.fromUtf8("LINK"));
console.log(balanceOfLink);
};
And for the wallettest(same as Philip is having on the video):
const Dex = artifacts.require("Dex")
const Link = artifacts.require("LINK")
const truffleAssert = require('truffle-assertions');
contract("Dex", accounts =>{
it("should only be possible for the owner to add tokens", async() =>{
let dex = await Dex.deployed()
let link = await Link.deployed()
await truffleAssert.passes(
dex.addToken(web3.utils.fromUtf8("LINK"), link.address, {from: accounts[0]})
)
await truffleAssert.reverts(
dex.addToken(web3.utils.fromUtf8("LINK"), link.address, {from: accounts[1]})
)
})
})
When I do truffle test I get following error:
Error: Dex has not been deployed to detected network (network/artifact mismatch)
at Object.checkNetworkArtifactMatch (C:\Users\Riki\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\contract\lib\utils\index.js:245:1)
at Function.deployed (C:\Users\Riki\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\contract\lib\contract\constructorMethods.js:88:1)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
Anyone can point me somewhere?