Skip to content

Commit a25d849

Browse files
Merge pull request #221 from Azure-Samples/evan-update-workbench-sample
Update PingPong and BazaarListing for compatibility with solc 0.5 (WorkBench)
2 parents 4ce94d4 + 30ce242 commit a25d849

File tree

3 files changed

+15
-18
lines changed

3 files changed

+15
-18
lines changed

blockchain-workbench/application-and-smart-contract-samples/ping-pong-game/ethereum/PingPongGame.sol

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pragma solidity ^0.4.25;
1+
pragma solidity >=0.4.25 <0.6.0;
22

33
contract Starter
44
{
@@ -8,10 +8,10 @@ contract Starter
88

99
string public PingPongGameName;
1010
address public GameStarter;
11-
address public GamePlayer;
11+
Player public GamePlayer;
1212
int public PingPongTimes;
1313

14-
constructor (string gameName) public{
14+
constructor (string memory gameName) public{
1515
PingPongGameName = gameName;
1616
GameStarter = msg.sender;
1717

@@ -20,30 +20,28 @@ contract Starter
2020
State = StateType.GameProvisioned;
2121
}
2222

23-
function StartPingPong(int pingPongTimes) public
23+
function StartPingPong(int pingPongTimes) public
2424
{
2525
PingPongTimes = pingPongTimes;
2626

27-
Player player = Player(GamePlayer);
2827
State = StateType.Pingponging;
2928

30-
player.Ping(pingPongTimes);
29+
GamePlayer.Ping(pingPongTimes);
3130
}
3231

33-
function Pong(int currentPingPongTimes) public
32+
function Pong(int currentPingPongTimes) public
3433
{
35-
currentPingPongTimes = currentPingPongTimes - 1;
34+
int remainingPingPongTimes = currentPingPongTimes - 1;
3635

37-
Player player = Player(GamePlayer);
38-
if(currentPingPongTimes > 0)
36+
if(remainingPingPongTimes > 0)
3937
{
4038
State = StateType.Pingponging;
41-
player.Ping(currentPingPongTimes);
39+
GamePlayer.Ping(remainingPingPongTimes);
4240
}
4341
else
4442
{
4543
State = StateType.GameFinished;
46-
player.FinishGame();
44+
GamePlayer.FinishGame();
4745
}
4846
}
4947

@@ -62,22 +60,22 @@ contract Player
6260
address public GameStarter;
6361
string public PingPongGameName;
6462

65-
constructor (string pingPongGameName) public {
63+
constructor (string memory pingPongGameName) public {
6664
GameStarter = msg.sender;
6765
PingPongGameName = pingPongGameName;
6866

6967
State = StateType.PingpongPlayerCreated;
7068
}
7169

72-
function Ping(int currentPingPongTimes) public
70+
function Ping(int currentPingPongTimes) public
7371
{
74-
currentPingPongTimes = currentPingPongTimes - 1;
72+
int remainingPingPongTimes = currentPingPongTimes - 1;
7573

7674
Starter starter = Starter(msg.sender);
77-
if(currentPingPongTimes > 0)
75+
if(remainingPingPongTimes > 0)
7876
{
7977
State = StateType.PingPonging;
80-
starter.Pong(currentPingPongTimes);
78+
starter.Pong(remainingPingPongTimes);
8179
}
8280
else
8381
{

blockchain-workbench/application-and-smart-contract-samples/ping-pong-game/media/readme.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)