Ethereum coinflip dapp discussion

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


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

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

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/

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

I am going to do the metamask setup again… XD

Ok, let me know how it goes :slight_smile:

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?

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

Could you send me it in text?

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 {

}
}

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!

1 Like

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.

1 Like

Thanks! i will do your recommendation!

1 Like

Done!!! Hurray!!! xdxdxd

1 Like

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

1 Like

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.

1 Like

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

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.