scaffold-eth-challenges
scaffold-eth-challenges copied to clipboard
TypeError: `transferOwnership` is not a function in challenge 2
I was doint the challenge-2 and following the instructions. I came to transfer ownership step and uncommented the code at this line. I have provided my frontend address but somehow it's giving me this error:
yarn run v1.22.19
$ yarn workspace @scaffold-eth/hardhat deploy --reset
$ hardhat deploy --export-all ../react-app/src/contracts/hardhat_contracts.json --reset
Nothing to compile
deploying "YourToken" (tx: 0xe5375d58ee48aa8b33b3b97b79d503eb3d7a3c92b90ac312a2d386209a16ff1b)...: deployed at 0x5FbDB2315678afecb367f032d93F642f64180aa3 with 637479 gas
deploying "Vendor" (tx: 0x2df0779ea222307500ecc0e0201255f2bf84c3f53e9810c588b3aeb5b3b92ec0)...: deployed at 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512 with 331303 gas
๐ต Sending all 1000 tokens to the vendor...
โ
confirming...
๐คน Sending ownership to frontend address...
An unexpected error occurred:
Error: ERROR processing /home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat/deploy/01_deploy_vendor.js:
TypeError: vendor.transferOwnership is not a function
at Object.module.exports [as func] (/home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat/deploy/01_deploy_vendor.js:33:45)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at DeploymentsManager.executeDeployScripts (/home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1055:22)
at DeploymentsManager.runDeploy (/home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat/node_modules/hardhat-deploy/src/DeploymentsManager.ts:891:5)
at Environment._runTaskDefinition (/home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat/node_modules/hardhat/src/internal/core/runtime-environment.ts:217:14)
at Environment.run (/home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat/node_modules/hardhat/src/internal/core/runtime-environment.ts:129:14)
at SimpleTaskDefinition.action (/home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat/node_modules/hardhat-deploy/src/index.ts:528:32)
at Environment._runTaskDefinition (/home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat/node_modules/hardhat/src/internal/core/runtime-environment.ts:217:14)
at Environment.run (/home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat/node_modules/hardhat/src/internal/core/runtime-environment.ts:129:14)
at SimpleTaskDefinition.action (/home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat/node_modules/hardhat-deploy/src/index.ts:605:5)
at DeploymentsManager.executeDeployScripts (/home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1058:19)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at DeploymentsManager.runDeploy (/home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat/node_modules/hardhat-deploy/src/DeploymentsManager.ts:891:5)
at Environment._runTaskDefinition (/home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat/node_modules/hardhat/src/internal/core/runtime-environment.ts:217:14)
at Environment.run (/home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat/node_modules/hardhat/src/internal/core/runtime-environment.ts:129:14)
at SimpleTaskDefinition.action (/home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat/node_modules/hardhat-deploy/src/index.ts:528:32)
at Environment._runTaskDefinition (/home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat/node_modules/hardhat/src/internal/core/runtime-environment.ts:217:14)
at Environment.run (/home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat/node_modules/hardhat/src/internal/core/runtime-environment.ts:129:14)
at SimpleTaskDefinition.action (/home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat/node_modules/hardhat-deploy/src/index.ts:605:5)
at Environment._runTaskDefinition (/home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat/node_modules/hardhat/src/internal/core/runtime-environment.ts:217:14)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed.
Exit code: 1
Command: /usr/bin/node
Arguments: /usr/lib/node_modules/yarn/lib/cli.js deploy --reset
Directory: /home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat
Output:
info Visit https://yarnpkg.com/en/docs/cli/workspace for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I am struggling for two days to solve this issue but can't find any solution. May anyone look into this what's the issue. The Vendor contract is inheriting Ownable
from openzepplin.