1

I am writing a few contracts and I'm all good to go until I migrate and hit this bump in the road, it has tormented me for 3 days I can't seem to figure out the issue I am thinking it is a camel case but I change it and try to fix the more I mess the code up, can anyone indicate to me what to do to correct this error in my contract I will post it attached to here. the error reads as follows "the type error: Type contract MOOREToken is not implicitly convertible to expected type (contract MOOREToken).

lvalue`
       ``` MOOREToken = _MOOREToken;
       ^--------^
,/C/Users/Noahm/Lastchance3/src/contracts/TokenFarm.sol:18:22: TypeError: Type contract MOOREToken is not implicitly convertible to expected type type(contract MOOREToken).
        MOOREToken = _MOOREToken;
                     ^---------^
,/C/Users/Noahm/Lastchance3/src/contracts/TokenFarm.sol:71:17: TypeError: Member "transfer" not found or not visible after argument-dependent lookup in type(contract MOOREToken).
                MOOREToken.transfer(recipient, balance);
                ^-----------------^

    fixed and now my error is this:
    truffle(development)> truffle migrate
    
    Compiling your contracts...
    ===========================
    > Compiling .\src\contracts\DaiToken.sol
    > Compiling .\src\contracts\MOOREToken.sol
    > Compiling .\src\contracts\Migrations.sol
    > Compiling .\src\contracts\TokenFarm.sol
    > Compiling .\src\contracts\DaiToken.sol
    > Compiling .\src\contracts\MOOREToken.sol
    
    /C/Users/Nmlm99/MOORETokenFarm/src/contracts/TokenFarm.sol:9:5: DeclarationError: Identifier not found or not unique.
        ERC20 public MOOREToken;
        ^---^
    ,/C/Users/Nmlm99/MOORETokenFarm/src/contracts/TokenFarm.sol:10:5: DeclarationError: Identifier not found or not unique.
        ERC20 public daiToken;
        ^---^

3
  • 2
    i think you are declaring a variable with the same name as your type. something like MOOREToken MOOREToken; as it expects the type of your variable to be a type of the type of your contract. try to separate the terms with generic names like _token instead of the exact name. May 15 at 16:05
  • can you reproduce for me?
    – MOORETOKEN
    May 16 at 15:30
  • Please. i would very much appreciate also i will accept it as the asnwer.
    – MOORETOKEN
    May 16 at 15:30

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.