thank you man it helped but the course got updated lol
yup all good now thanks!
Hi all, I love this course but I think I downloaded the wrong truffle version. The Truffle version Iām working with is v5.2.2 and the Soldity version is v0.5.16.
When I wanted to compile my contract it said this
Compiling your contracts...
===========================
> Compiling ./contracts/Functional.sol
> Compiling ./contracts/Storage.sol
> Compilation warnings encountered:
/Users/sk/proxyContract/contracts/Functional.sol:1:1: Warning: Source file does not specify required compiler version! Consider adding "pragma solidity ^0.5.16;"
^
,/Users/sk/proxyContract/contracts/Storage.sol:1:1: Warning: Source file does not specify required compiler version! Consider adding "pragma solidity ^0.5.16;"
^
> Everything is up to date, there is nothing to compile.
I donāt know what Iāve to do to fix this, or is it good?
Tried to change the pragma solidity to
pragma solidity ^0.5.16;
but still the same error. Does anyone know what Iāve to do?
I thought I fixed it by updating Truffle, but after that was done both the Storage.sol and Function.sol was gone. Had to make the contracts again, but it still gives me the same error.
I tried searching the web for the answer, but didnāt find anything that can help meā¦
Hi @Sil
Post your contracts here and I will take a look, it seems like youāre missing the pragma statement.
These are warnings anyway so you should still be able to proceed.
Regards,
Dani
I think I know what went wrong. Is it possible that I have to save the contract before compiling it?
It now compiles the contract without any errors. Thanks again for helping me!!
anyway hereās the contracts!
pragma solidity ^0.5.16;
contract Storage {
mapping (string => uint) _uintStorage;
mapping (string => bool) _boolStorage;
mapping (string => string) _stringStorage;
mapping (string => bytes4) _bytesStorage;
mapping (string => address) _addressStorage;
address public owner;
bool public _initialized;
}
pragma solidity ^0.5.2;
import "./Storage.sol";
contract Proxy is Storage {
address currentAddress;
constructor(address _currentAddress) public{
currentAddress = _currentAddress;
}
function upgrade(address _newAddress) public{
currentAddress = _newAddress;
}
//FALLBACK FUNCTION.
function () payable external {
}
}
pragma solidity ^0.5.2;
import "./Storage.sol";
contract Functional is Storage {
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
constructor() public{
owner = msg.sender;
}
function getNumberOfDogs() public view returns (uint) {
return _uintStorage["Dogs"];
}
function setNumberOfDogs(uint toSet) public{
_uintStorage["Dogs"] = toSet;
}
}
Hey @Sil
If you made changes to your contract but you did not save, then Truffle was compiling the older version
Cheers,
Dani
When ever I want to link my truffle project to ganache
Whenever I click save and restart my ganache keep loading forever it not even saving it wat should I do. ?
I saved the file whenever I make changes but it still loading
The address in ganache after deployment,
Can we send fund to that address to fund the contract
Hey @beloved
It is not compiling due to a syntax error, I am not sure if thatās in the code that you wrote or in a npm pkg.
Please follow this faq first and retry: FAQ - How to downgrade Node.Js
If that did not solve post your project on GitHub and share the link.
Cheers,
Dani
pragma solidity 0.5.12;
contract Hello {
string message = āhiā;
function get()public view returns(string memory){
return message;
}
function set(string memory newMessage) public{
message = newMessage;
}
}
here is the code it just a simple hello contract quiet similar to ur example
Hey @beloved,
Change the quotation marks in your string hi
from ā
to "
and try again.
Cheers,
Dani
done that but still giving me error
but i think the error is coming from the javascript file pls check this out if it correct
const Hello = artifacts.require(āHelloā);
module.exports = function(deployer) {
deployer.deploy(Hello).then(function(instance){
instance.set(āgoodā).then(function(){
instance.get().then(function(message){
console.log(ācurrent messageā + message);
});
});
});
});
the quote is change in atom
You can use the āPreformatted Textā Button to encapsulate any kind of code you want to show.
function formatText(){
let words = āIām a preformatted Text box, Please use me wisely!ā
}
Carlos Z.
Hi @beloved
By copy / pasting your migration file in a text editor it tells me that the past parenthesis should not be there.
const Hello = artifacts.require(āHelloā);
module.exports = function(deployer) {
deployer.deploy(Hello).then(function(instance){
instance.set(āgoodā).then(function(){
instance.get().then(function(message){
console.log(ācurrent messageā + message);
});
});
});
} -->>>>>>) ;
Delete it and compile.
You should also get this error from your editor, is atom showing it?
Also please follow the advise of @thecil so that you will be able to post a clear and formatted code
Happy coding and keep us posted!
Dani
Good morning sir it still giving me the synax error pls wat should I do I really need this knowledge
No error is being shown by atom