0

I am following the Crypto Zombies learning project. It is a multipage project, where one file imports from the other and i am attempting to test it locally using hardhat. Now my issue is when i try to test my

await contractInstance.transferFrom(alice, bob, id, {from: alice});

function, i get this error

TypeError: contractInstance.transferFrom is not a function

I require the first (entry) contract in the project like this

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

And the function i need to test on that file works. The functions on all the other files that form the project fails and i dont know why. On the Crypto zombies website, they only require that entry ZombieFactory file also.

I pushed the entire project structure on github here

Git hub link

1 Answer 1

0

There is no transferFrom function in your ZombieFactory.sol contract, there are only two public / external functions which are:

function createRandomZombie(string memory _name) public;

function kill() public;

You should deploy ZombieOwnership.sol so your contract will have all of the functions, including transferFrom

ZombieInheritence

3
  • Not meaning to go back and forth but i literally followed the tutorial step by step, and here is their finished project. cryptozombies.io/en/lesson/5/chapter/13. Their ZombieFactory only inherits directly from Ownable. I am trying to follow same project structure. The order of their inheritance is ZombieFactory > ZombieFeeding > ZombieHelper > ZombieAttack > ZombieOwnership Commented Mar 23, 2022 at 17:43
  • Ok, I checked the whole project, you deploy your contract partially, that's why you don't have all the functions, I edited my response and added a schematic hoping that it will be more comprehensible
    – Adam Boudj
    Commented Mar 23, 2022 at 18:48
  • Thanks a lot. I realized that as soon as I listed the order of inheritance in my last reply and it works now! Commented Mar 23, 2022 at 20:18

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.