Hi there,
I’m also experiencing a similar issue (but using the truffle-upgrades) and would really appreciate some assistance on what the issue is and how to resolve. In my case, my contract code in my original local environment successfully migrates (to ganache-cli) and executes fine. The code is in my GitHub repo: https://github.com/msuscens/Kitty-Masters
However, when I (or someone else) git clones my repo, and then follows the install steps:
$ npm i
$ npm install @truffle/hdwallet-provider --save
Creates a file: 'secrets.json' (required by my truffle-config.js), containing:
{
"projectId": "a78925685d7246ef89300dd57aee7c14",
"mnemonic": "<Insert your MetaMask seed phrase here>"
}
$ ganache-cli -h 127.0.0.1 -p 8545 -m "<your chosen mneumonic seed phrase>"
$ truffle migrate --reset --network development
The following error is thrown:
3_market_migration.js
=====================
***DEBUG : About to deployProxy
Error: The requested contract was not found. Make sure the source code is available for compilation
at getContractNameAndRunValidation (/Users/Mark/Documents/BlockChain/IvanOnTechAcademy/Bootcamp/Test-Repo-Pull/Kitty-Masters/node_modules/@openzeppelin/upgrades-core/src/validate/query.ts:46:11)
at Object.getStorageLayout (/Users/Mark/Documents/BlockChain/IvanOnTechAcademy/Bootcamp/Test-Repo-Pull/Kitty-Masters/node_modules/@openzeppelin/upgrades-core/src/validate/query.ts:54:41)
at Object.deployImpl (/Users/Mark/Documents/BlockChain/IvanOnTechAcademy/Bootcamp/Test-Repo-Pull/Kitty-Masters/node_modules/@openzeppelin/truffle-upgrades/src/utils/deploy-impl.ts:32:18)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at deployProxy (/Users/Mark/Documents/BlockChain/IvanOnTechAcademy/Bootcamp/Test-Repo-Pull/Kitty-Masters/node_modules/@openzeppelin/truffle-upgrades/src/deploy-proxy.ts:46:16)
at module.exports (/Users/Mark/Documents/BlockChain/IvanOnTechAcademy/Bootcamp/Test-Repo-Pull/Kitty-Masters/migrations/3_market_migration.js:11:20)
at Migration._deploy (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:80:1)
at Migration._load (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:61:1)
at Migration.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:218:1)
at Object.runMigrations (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:150:1)
at Object.runFrom (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:110:1)
at Object.runAll (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:114:1)
at Object.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:79:1)
at runMigrations (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:258:1)
at Object.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:223:1)
at Command.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/command.js:147:1)
Truffle v5.3.9 (core: 5.3.9)
Node v14.15.5
[ Note: I added a console.log("***DEBUG: About to deployProxy") to the repo pulled migration script in order to confirm that the error is thrown upon executing the deployProxy() function ]
Interesting I/they also get a preceding compile warning (that doesn’t occur in my original local environment upon compile or migrate) of:
> Compiled successfully using:
- solc: 0.8.6+commit.11564f7e.Emscripten.clang
> Duplicate contract names found for KittyContract.
> This can cause errors and unknown behavior. Please rename one of your contracts.
3_market_migration.js file
const { deployProxy } = require('@openzeppelin/truffle-upgrades')
const KittyContract = artifacts.require("KittyContract")
const Marketplace = artifacts.require("KittyMarketplace")
let marketInstance
module.exports = async function (deployer, network, accounts) {
console.log("***DEBUG : About to deployProxy")
// Deploy the Logic contract and initialize (with associated proxy)
marketInstance = await deployProxy(
Marketplace,
[KittyContract.address],
{ deployer, initializer: 'init_KittyMarketplace', from: accounts[0]}
)
console.log("***DEBUG:Done deployProxy")
}
My preceding migration script for the referenced KittyContract, executes successfully:
2_token_migration.js file
const { deployProxy } = require('@openzeppelin/truffle-upgrades')
const KittyContract = artifacts.require("KittyContract")
const tokenName = "Mark-Crypto-Kitty"
const tokenSymbol = "MCK"
let kittyInstance
module.exports = async function (deployer, network, accounts) {
// Deploy the Logic contract and initialize (with associated proxy)
kittyInstance = await deployProxy(
KittyContract,
[tokenName, tokenSymbol],
{ deployer, initializer: 'init_KittyContract', from: accounts[0]}
)
}
Both in my original local version and in the new directory with the pulled repo from gitHub, I have the following:
Truffle v5.3.9 (core: 5.3.9)
Solidity - 0.8.6 (solc-js)
Node v14.15.5
Web3.js v1.3.6
Ganache CLI v6.12.2 (ganache-core: 2.13.2)
Note: I originally hit this issue using Solidity 0.8.5. I updated the code to use 0.8.6 thinking that the compiler version my be an issue. However, I get the same migration error with 0.8.6.