Learning Truffle

@dan-i
I had everything working fine with Visual Studio Pro but when I try to use the Cmder shell for compiling, it says that truffle is using solc 0.5.16 to compile. Even though I change this to 0.8.3 in the config file, it still errors. I guess I could not use the Cmder shell but any thoughts on why this is happening?

Error: Truffle is currently using solc 0.5.16, but one or more of your contracts specify “pragma solidity 0.8.3”.
Please update your truffle config or pragma statement(s).
(See https://trufflesuite.com/docs/truffle/reference/configuration#compiler-configuration for information on
configuring Truffle to use a specific solc compiler version.)

I copied this into the truffle - config.js file and it works now


“path”: “soljson-v0.8.3+commit.8d00100c.js”,
“version”: “0.8.3”,
“build”: “commit.8d00100c”,
“longVersion”: “0.8.3+commit.8d00100c”,
“keccak256”: “0x51777116af58223a41aa3016d0bf733bbb0f78ad9ba4bcc36487eba175f65015”,
“sha256”: “0xb5cedfa8de5f9421fbdaccf9fd5038652c2632344b3b68e5278de81e9aeac210”,
“urls”: [
“bzzr://c7d43da1bc5529d2cc311e00579c36dcff258c42b8ed240b6c4e97bd85492a64”,
“dweb:/ipfs/QmWbNMzJryhiZmyifLDQteGPwN4aTgXQB6barBvXYVw975”
]


http://solc-bin.ethereum.org/bin/list.json

…but I have not tried using this with the Cmder shell yet - just with Visual Studio Pro cmd

…also, I was forgetting to remove the comment out lines // on the truffle-config file

…another mistake I might have made…In Cmder shell, I did not use the truffle develop command – not sure if that was the reason why it failed when I switched over to the Cmder shell.

1 Like

Hey @SYN

Make sure that all the inherited contracts have the right solidity version specified.
If you cannot fix, please push your code on Github and share the link so that I can deploy and check.

Regards,
Dani

1 Like

Solved. I don´t know how, but solved. Thanks :slight_smile:

Hello,

I’m working on the Truffle assignment to deploy the multisig wallet. Unfortunately, the contract will not deploy and I keep getting this error. Can anyone help? Is there something that needs to be changed in the contract code to properly deploy this contract in Truffle?
issue_wallet_cannot_deploy_04.05.2021

Hi @MrSeven

Your constructor requires two params but you are sending 0.
Please check my posts above: Learning Truffle

Cheers,
Dani

Hey guys, I need help, I don’t know if truffle was installed or not but I have these errors

image
image
image
image

Many Thanks!!

Hello everyone,

Why can’t I transfer value when I follow Filip’s instruction on the “Value” part of the Truffle category? It shows an error like this

image
image

Thank you!

1 Like

@dan-i
Hello Dan, I managed to deploy the multisig wallet project using truffle but I am sure something is not right. I have repeated code and who know what else. Here is my migration settings:

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

module.exports = function (deployer, accounts) {
  address = ["0xdc6bbc41d7ff0accd096969921067c07cd3b0d37", "0xe8b2ef888b7059907fe4eeed19892aac95c7e961", "0x87710DfA8D5210d21A44bCB9947755DA22f3A707"];
  uint = 2;
  const userAddress = accounts[0,1,2];
  deployer.deploy(Wallet, ["0xdc6bbc41d7ff0accd096969921067c07cd3b0d37", "0xe8b2ef888b7059907fe4eeed19892aac95c7e961", "0x87710DfA8D5210d21A44bCB9947755DA22f3A707"], 2);
  
};

I can apparently deposit into the account but this is what I get when I try to call the get balance functions:

truffle(develop)> await instance.deposit({value: web3.utils.toWei('1', 'ether') } )
{
  tx: '0x82824e27e85b1992eb10e98c1ec2ff7956341b782ef36e23c0982f464908ba42',
  receipt: {
    transactionHash: '0x82824e27e85b1992eb10e98c1ec2ff7956341b782ef36e23c0982f464908ba42',
    transactionIndex: 0,
    blockHash: '0xdf0d85b1bb8e1f035a644706f0f3b6f0ba36bb2155a4db845bba6fa27f642536',
    blockNumber: 10,
    from: '0xdc6bbc41d7ff0accd096969921067c07cd3b0d37',
    to: '0x400b40ab748e0df47ead115e8ac6cb7d6d8e767d',
    gasUsed: 28441,
    cumulativeGasUsed: 28441,
    contractAddress: null,
    logs: [],
    status: true,
    logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
    rawLogs: []
  },
  logs: []
}
truffle(develop)> instance.getWalletBalance()
BN {
  negative: 0,
  words: [ 46661632, 5986771, 444, <1 empty item> ],
  length: 3,
  red: null
}
1 Like

HI ,

I run truffle on windows power shell I get all sorts of errors, but when I run it on command prompt it states that its installed . Is there an issue here or not?

I use a separate computer for Smart contract programming and ReactJS (Visual Studio). So I guess my question is also which terminal do I use for truffle?

Thank you

Hello, I’m having trouble when migrating my contract and this is what appears on my terminal:

Capture

I’m stuck and Ive tried what I can on my end.

Hi @CryptoXyz

Value should be a number not a string.

instance.setMessage("Hello", {value: 1000})

Keep me posted.
Dani

1 Like

Hey @bjamRez

Can I please see your contract?
What you get from the function getWalletBalance() is a big number and it is not wrong.
However I want to check the function myself to see exactly what you are returning.
Please push your code to GitHub and share the link :slight_smile:

Cheers,
Dani

1 Like

Hey @Javier_Flores

Would be interesting to know which errors you get.

Cheers,
Dani

1 Like

Hey @cecilia

Your constructor requires two params but you are sending 0.
Please check my posts above: Learning Truffle

Cheers,
Dani

Thanks, @dan-i! I really need to get better at reading error messages :sweat_smile:

thaks Dani, I will do that asap

Hello Dani, let me know if this link works:
https://github.com/brlojam4932/multiSigWallet/blob/main/multisigWallet/contracts/multiSigW.sol

1 Like

Hi!
So I’m having a problem since two days and just cant work it out. I cant compile, my terminal says command “truffle” can’t be found.
I had all sorts of error msgs when installing truffle, which I first ignored as it seems like I was still able to install truffle. However I uninstalled and reinstalled everything and then forced an audit fix and it came back with 0 vulnerabilities, but that didn’t work either. Compiler version is on same version as the contract too.
The terminal highlights one problem which is

{
	"resource": "/c:/Users/karla/Documents/Ethereum201/HelloWorld/contracts/Hello.sol",
	"owner": "_generated_diagnostic_collection_name_#0",
	"severity": 4,
	"message": "SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing \"SPDX-License-Identifier: <SPDX-License>\" to each source file. Use \"SPDX-License-Identifier: UNLICENSED\" for non-open-source code. Please see https://spdx.org for more information.",
	"startLineNumber": 1,
	"startColumn": 1,
	"endLineNumber": 1,
	"endColumn": 1
}

Can I get some help please?

I’m still learning like you but I don’t know if this helps any…the SPDX license can be inserted below your pragma solidity 0.8.0 contract:
// SPDX-License-Identifier: GPL-3.0
or
// SPDX-License-Identifier: MIT

2 Likes