PacktPublishing / Blockchain-By-Example

Blockchain By Example published by Packt
MIT License
76 stars 57 forks source link

Chapter 5 when clicking 'Join Game' no ether is showing up, failed transaction; #3

Closed walter-grace closed 3 years ago

walter-grace commented 4 years ago

Getting failed transactions for joining game, no ether is showing up to accept the contract. Hope the pics help My first contract went through but it wasn't showing a larger number of eth.

Screen Shot 2019-08-09 at 10 44 04 AM Screen Shot 2019-08-09 at 10 45 44 AM
bellaj commented 4 years ago

If you're using ganache you should import one of the accounts provided (private key). Once correctly done you should have enough ethers to join the game.

As you know Join method has 2 conditions

require(Tplayer.exist(msg.sender), "player doesn't exist");
require(msg.value >= 1 ether && Tpension[msg.sender] == 0, "send higher pension");

which means that

Hint : Try to use remix to get back the message thrown by require