function getCstValue(){
contractInstance.methods.readCustomerBalance().call().then(function(res){
displayAmount(res);
});
}
function displayAmount(res){
console.log(res);
$("#customer_balance").text(res);
}
function getCstValue(){
contractInstance.methods.readCustomerBalance().call().then(function(res){
displayAmount(res);
});
}
function displayAmount(res){
console.log(res);
$("#customer_balance").text(res);
}
Solved, apparently there is a web3 function that returns the value and my getter function was useless:
function getCstValue(){
web3.eth.getBalance(â0x4d262D94ea943524795Eea00588aD5CB8dd5F17bâ, function(error, result) {
if(error) {
console.log(error);
} else {
console.log(web3.utils.fromWei(result));
}
})};
thank you! I have tried to follow your steps again, and I still get same errorâŚ
So I moved on to next lessons, where I am again stucked at âtesting for errorsâ. I will open a new post about thisâŚ
Hi @filip, I have finish the Solidity programming course. Thanks for the tutorials. I have a question. I donât know if I missed anything, but I didnât see anywhere explaining how to deploy the solidity course to the testnet, then " Verify & Publish Contract". I built a Dapp(Solidity+React.js), and want to publish to testnet as a demo. Is there tutorial I can watch? thanks.
FYI, here is my contract. https://rinkeby.etherscan.io/address/0x01e98b517529a116dcd229791ace864e736a1a8a
Here is my source code.
Good job! Your contract is already on the testnet. So I assume you are asking how you can deploy a react app? So the frontend is actually on a domain. We donât have a course on this since this is not unique to dapps, itâs the same procedure for every web application. You could probably use a tutorial like this: https://medium.com/jeremy-gottfrieds-tech-blog/tutorial-how-to-deploy-a-production-react-app-to-heroku-c4831dfcfa08
We are however working on a course that covers frontend deployment as well, including decentralizing parts of it.
pragma solidity 0.5.1;
contract DogContract2 {
function addDog(string memory _name, uint _age) public payable returns (uint);
function getBalance() public view returns (uint);
}
contract ExternalContract {
DogContract2 dcInstance = DogContract2(0xdC04977a2078C8FFDf086D618d1f961B6C546222);
function addExternalDog(string memory _name, uint _age) public payable returns (uint) {
return dcInstance.addDog.value(msg.value)(_name,_age);
}
function getExternalBalance() public view returns (uint) {
return dcInstance.getBalance();
}
}
Hi guys ,how are you ? Need a litle help .
How can i Console.log or print a function return number ?
//qwerty() return a number betwen 0 and 1 .
// i need to get this number from return.
$("#thebutton").click(async function(){
let result=await contractInstance.methods.qwerty().send(config); console.log(result);
});
SOLVED
Hello,
Iâm having issues with running the program.
When I try to run the code, the box to choose the contract is grayed out and under it, it says âNo compiled contractsâ. When I try to compile the program I get this error:
Internal exception in StandardCompiler::compileInternal: /root/project/libevmasm/ExpressionClasses.cpp(187): Throw in function ExpressionClasses::Id dev::eth::ExpressionClasses::tryToSimplify(const dev::eth::ExpressionClasses::Expression &)
Dynamic exception type: boost::exception_detail::clone_impl<dev::eth::OptimizerException>
std::exception::what: Rule list not properly initialized.
[dev::tag_comment*] = Rule list not properly initialized.
If you get this error you are most likely using Firefox, try switching it to Chrome. It worked for me
Take care guys.
Perfect. Congratulations on handling the bug like a proâŚ
Thanks for sharing your solution.
Happy coding!
Ivo
Hi, Sanji94m.
Please support our community by subscribing to our courses and attend our classes.
You will get the help and learn all you need, if you just subscribe to Ivan On Tech Academy like the rest of us.
We would appreciate it if you follow this link to go to the subscription page and subscribe. You cant learn programming by just visiting us in the forum, the forum is just a small part of Ivan On Tech Academy. We hope to see you back here in the near future as a fellow student.
If you have any questions, feel free to send me a DM and we can sort things out.
Ivo
Would be nice if you showed what getdog returns. For me it shows the correct index in the array, and the first string but leaves the three last values unshown. Im sure this will be more clear as I move further, but kind of bummer I could not see in the video what result you got for getdog function.
Mine looks like this:
Hi @Kraken
There is two possibilities your first object doesnât fit completely inside the array because it is too BIG
or more seriously because you canât return 4 times in the same function, but you can try to return 4 elements at once
return (vibrators[_id].name, vibrators[_id].color,vibrators[_id].length, vibrators[_id].diameter);
Hi @gabba,
Thanks Buddy, will give it a try. Thatâs exactly what I wanted to know. The syntax for returning several strings. I donât know if my code was saved in remix or not, started on the new ethereum smart contract programming 101. It seems clearer as Felix goes through the basics more thoroughly in that one. Thanks again!
Does anybody else have the problem with the right hand menu(compile, run, analisis, testing etc) in remix being absent?
I get directed to the new version, and when I click the button for access to the old version there is no right hand menu. I donât seem to find a button for it to view either?
@filip
Iâm stuck on inheritance. I wasnât sure if there was a typo somewhere but after copy+pasting the animalcontract and dogcontract straight off Filipâs github I still canât deploy my dog contract.
Thereâs an i with a red warning x next to where contract should be showing but isnât and it doesnât tell me why or what is wrong.
Anyone knows whatâs up or have experienced the same problem?
Hi Filip and everyone,
I have a question about Payable Functions, specifically when you talk about a refund if we transfer a greater amount of wei.
Is there any way we could see how much is returned anywhere? In the transaction it showing still 10000 wei but nothing that was returned. Do you know what I mean?
Cheers
Hey Chakingo,
I had simular problem. Have you tied changing your version in compile bar to 0.5.1+commit.c8a2cb62.Emscripten.clang ?
Hi. Sorry, I am stuck with this:
while I try to reach: https://remix.ethereum.org/
I donât understand what I have to do to reach the browser/ballot.sol build tool
@filip Hi Filip
I try to deploy a smart contract on remix but I got the error message "Unable to import â@openzeppelin/contracts/token/ERC20/IERC20.sol: File not foundâ. Here you can see my import statements:
Do you have an idea what went wrong with my code?
Thank you for your help.
Best regards Henning