Ethereum coinflip dapp discussion


#83

I found the issue now, and I want to apologize for the trouble it caused. It was a simple typo in my github code. I have corrected it and you can see the new app.js file in the github repo under part5. I’m sorry for the trouble. Good luck with the rest @Brad


#84


Nothing Happend, What did i did wrong?
Thank you!


#85

What didn’t happen? You will have to explain more.


#86

I did the excersice but… i did somthing wrong cuz when a click the bottom there’s nothing happened. Thank you! it stayed in the same page in the browser in https://iot-academy.superblocks.com/


#87

You didn’t get the metamask window? Could you post a link to your code?


#88

I am going to do the metamask setup again… XD


#89

Ok, let me know how it goes :slight_smile:


#90

Well… mmmm it is worst :tired_face:

Contract0 is the contract i type from your Github source. Thanks

What do you think i need to review? the contract or the External configuration?


#91

I need to look at your contract. Doesn’t seem to compile.


#92


#93

Could you send me it in text?


#94

pragma solidity ^0.4.17;

contract Coinflip {
address owner;

function Coinflip() public{
owner = msg.sender;
}

function getBalance() constant public returns (uint){
return address(this).balance;
}

function flip() payable public{
uint time = block.timestamp;
uint bet = msg.value;

if(time % 2 == 0){
  msg.sender.transfer(bet*2);
}

}

function deposit() payable public {

}
}


#95

READY BRO!

But my view is not like the contract is deployed: " Missing contract javascript file, have you deployed all contracts?" what i did wrong? The Environment and the Account are OK…Thank you!


#96

Awesome dude. What was wrong? Because the code compiled for me.

But even though the contract is compiling now, I see another error that prevents you from deploying it, which is why you are getting that “missing contract file” error.

There is a red text down in the right in your image. It says something about the constructor arguments. You need to reduce the arguments under the configure menu to zero. Just like I did in the video. Do that and try to deploy once again.


#97

Thanks! i will do your recommendation!


#98

Done!!! Hurray!!! xdxdxd


#99

Why does the deposit function doesn’t need any implementation again? Why is just it enough for it to work accordingly?


#100

When we have an empty payable function, it is a fallback. That means it is a function that is executed whenever someone sends money to the contract, without executing a specific function. When that happens, we don’t want to do any additional logic in this contract. You could if you want have code in that function and execute certain code whenever someone sends money to the contract, maybe throw an event for example.

But if you google for payable function solidity you should be able to find more details about this.


#101

how to download and publish that dapp on a normal website?


#102

If you have deployed your contract to a public network (rinkeby for example), you can click the checkbox “View source” in the Web view tab. You can simply copy all of the HTML and host it wherever you see fit.