1
I deployed my contract sent my decentralized application to Github pages.

(GH.pages) here is the link to see it, it will say error not deployed to the detected network if you want to see the application you click "ok" a couple of times, on here https://nmlm99.github.io/new-dapp/ I have verified it and even made sure it worked in the test net first and even did it in ropsten, kovan rinkeby and I was able to swap it and all, I have neglected to launch the "ethswap" contract in fear of wasting Ethereum, I just want to know what I am doing wrong, can someone please have a look here's the contract address to "Moore", code to my contract. I have tried all test nets. and even tried on the main net, I can send the token to another address granted, the fee is 30 $ which is pointless I feel if I risk the chance of it still not fixing my issue I have checked into everything it was compiled on the remix and verified with a perfect match on MAIN-NET.

` '0xd3798b9db4e8850fe6090a7b9fa0bd41d0e3d21f' is my token contract address. any help would be great. Also when I go to deploy the "ethswap" contract in remix it asks at the bottom "_token address" to put into it before I can launch, would that be my 'MOORE' contract address? Is it one of ethereal? here is my main "MOORE Token contract address"

0

Launch the ethswap one and I'm sure it will work, but have you checked your truffle config file?

1

this is a common error where you don't link your contracts when deploying with truffle. normally in a standard non-truffle deployment. you will need to copy the code of the dependency contracts to the same file as your main contract. and then deploy that contract.

with truffle you can use the link in the deployment js configuration in order to implicitly import the dependency contracts code when deploying while having it separate when developing.

in the migrations/2_deploy_contract.js you can use the link method like follows.

module.exports = function(deployer, networks, accounts) {
  deployer.deploy(tokenONe, accounts[0], 200000).then((tokenOneDeployed)=>{
    deployer.link(tokenONe,tokenTWO);
    return deployer.deploy(tokenTWO)
  });
};

from the comments your deployment code should look like this :

const Token = artifacts.require("Token");
const EthSwap = artifacts.require("EthSwap");
module.exports = async function (deployer) {
    await deployer.deploy(Token);
    const token = await Token.deployed()
    deployer.link(token,EthSwap);
    await deployer.deploy(EthSwap, token.address);
    const ethSwap = await EthSwap.deployed()
    await token.transfer(ethSwap.address, '100000000000000')
};
3
  • token two was to be "eth" i thought?
    – MOORETOKEN
    May 14 at 2:07
  • this is my` migrations/2_deploy_contracts const Token = artifacts.require("Token"); const EthSwap = artifacts.require("EthSwap"); module.exports = async function(deployer) { - //Deploy Token - await deployer.deploy(Token); - const token = await Token.deployed() - //Deploy EthSwap - await deployer.deploy(EthSwap, token.address); - const ethSwap = await EthSwap.deployed() - //Transfer tokens to EthSwap contract - await token.transfer(ethSwap.address, '100000000000000') };
    – MOORETOKEN
    May 14 at 2:09
  • @MOORETOKEN before deploying the second contract just add a .link call between the already deployed token and the token to be deployed next. i edited my answer May 14 at 19:46

Your Answer

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

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