@mcgrane5 can you help me fix this, without this I can’t continue on with the course.
Your Migrations
contract apparently does not have a solidity version.
It should look like this:
Migrations.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
contract Migrations {
address public owner = msg.sender;
uint public last_completed_migration;
modifier restricted() {
require(
msg.sender == owner,
"This function is restricted to the contract's owner"
);
_;
}
function setCompleted(uint completed) public restricted {
last_completed_migration = completed;
}
}
Then, the 1_initial_migration.js
should just looks like this:
const Migrations = artifacts.require("Migrations");
module.exports = function (deployer) {
deployer.deploy(Migrations);
};
Carlos Z
Thanks Carloz , it’s working now.
Hi, I have a problem with the goerli testnet since ropsten is no longer available.
I followed part of Philip’s tutorial on how to migrate our smart contract to ropsten testnet.
Everything works fine as far as the address is concerned and I get some ETH from Alchemy’s FAUCET but I still get this error.
I understand the problem is with the truffle configuration file but I don’t know what I’m missing.
If anyone can help me figure out the problem, I would appreciate it.
Hi i’m trying to install truffle. I have installed the npm but it says there is some issue that needs to be reviewed. Please find the attached file , I look forward to your solution thanks
Your truffle installation looks OK, those warning messages are just for the module developers to update their packages, but does not interfere with the usage of truffle, you should be able to use it without any problem
Try running truffle -v
and it should return the version you installed and the list of commands of truffle.
Carlos Z
Hi, I am following the instructions on installing Truffle and everything works quite fine and it looks same as on Filips screen, but in HelloWorld project I do not have Migrations.sol file in contract folder, nor 1_initial_migration.js file in migration folder? But I have those same 3 folders: contracts, migrations and test, but in them I only have .gitkeep files and that is it, so I am not sure why is that and what to do?
You might need to manually add those files to be able to deploy your contracts.
Check this answer which contains the default template for both files.
Carlos Z
Apparently you have to use truffle unbox
instead of truffle init
. Using unbox
will give you the migration files, but the truffle-config,js fie will be extremely minimalistic
Hi,
I’m trying to use the multisig wallet from remix in truffle, but I don’t know how to deposit ETH into the contract. How is that done?
tnx
There are 2 ways, create a deposit function, or use the receive
function.
Creating a deposit function will need the account to trigger that method to deposit ETH.
The receive
function will allow you to send funds to the contract in the same way you send funds to a wallet.
Receive example:
event Received(address, uint);
receive() external payable {
emit Received(msg.sender, msg.value);
}
You can read more about that here:
https://blog.soliditylang.org/2020/03/26/fallback-receive-split/
Carlos Z
Hello, I followed the instructions that Filip said in the “truffle hello world” video and put in the npm init and truffle init commands into the terminal while on the hello world folder, but when i opened the folder in vsc i saw this in my folders that truffle made.
i tried running the commands again from the integrated terminal in vsc and the same result occurred, can someone help?
Hi @empty_nutella,
Hope you are doing well.
It seems like the latest version of truffle doesn’t generate the sample Migration.sol or .js files.
These files are just sample files and are not used in the tutorial, so you can proceed to create a hello.sol
as shown in the tutorial.
ok cool, thanks for the help man, have a good day
Hello, i tried running the truffle compile
command on the terminal during the first migrations video and this error popped up, i tried restarting my laptop and even quit VSC and reopened everything and it still wont work, i know that i am connected to the internet so im not sure why this is happening.
You can get that error when you have used a compiler version in truffle-config.js
that is not available or wrong.
Can you once verify your compiler version in truffle-config.js
file?
It should look something like this with your required version number.
// Configure your compilers
compilers: {
solc: {
version: "0.8.13", // Fetch exact version from solc-bin
},
},
Hi @JohnVersus, thanks for reaching out to help me again.
The compiler version in truffle-config.js
was set to “0.8.17” before, and after i changed it the same issue came up.
// Configure your compilers
compilers: {
solc: {
version: "0.8.13" // Fetch exact version from solc-bin (default: truffle's version)
// docker: true, // Use "0.5.1" you've installed locally with docker (default: false)
// settings: { // See the solidity docs for advice about optimization and evmVersion
// optimizer: {
// enabled: false,
// runs: 200
// },
// evmVersion: "byzantium"
// }
}
}
i went back to the pragma in the .sol file to change it to the same version and this error popped up.
Now if you run truffle compile
again it will download the new compiler version mentioned in the truffle-config.js
. That should fix the error.