Modifier triggers an error when migrating

modifier tokenExist(bytes32 ticker){
require(tokenMapping[ticker].tokenAddress != address(0));
“Token does not exist”;
_;
}

DeclarationError: Identifier not found or not unique.
–> /C/Users/vexah/Documents/Dex/contracts/wallet.sol:24:47:
|
24 | function deposit(uint amount, bytes32 ticker) tokenExist {
| ^^^^^^^^^^

Please help?

1 Like

Hey @VEXAHEDRON

Can you share the whole contract?
Follow this FAQ to post readable code in the forum: FAQ - How to post code in the forum

Thanks,
Dani

Hey Dani,

Thank you for all your help! I managed to solve the above on my own phew…
Now i am facing another hoop to jump through, another error message after migrating, check this out:

const Link = artifacts.require("Link");

const Wallet = artifacts.require("Wallet");

module.exports = async function (deployer, network, accounts) {

  await deployer.deploy(Link);

  let wallet = Wallet.deployed();

  let link = await Link.deployed();

  await link.approve(wallet.address, 500);

  wallet.addToken(web3.utils.fromUtf8("LINK"), link.address);

  await wallet.deposit(100, web3utils.fromUtf8("LINK"));

  let balanceOfLink = await wallet.balances(accounts[0], web3.utils.fromUtf8("LINK"));

  console.log(balanceOfLink);

};

Error: invalid address (argument="address", value=undefined, code=INVALID_ARGUMENT, version=address/5.0.5) (argument="spender", value=undefined, code=INVALID_ARGUMENT, version=abi/5.0.7)
1 Like

Try with accounts[0].address

Carlos Z

1 Like