- use account A to deploy Dice contract
- use account A to deploy DiceToken contract
- use account A to deploy DiceTokenMarket contract with arg (Dice contract address, DiceToken contract address, 2)
- use account A to execute Dice function add dice with arg (1,2) and value 1 ETH, becomes dice 0
- use account A to execute Dice function transfer dice with arg (0, DiceTokenMarket address)
- use account A to execute DiceTokenMarket function list dice with arg (0, 3)
- use account B to execute DiceToken function getCredit with value 1 ETH
- use account B to execute DiceTokenMarket function buy with arg (0)
- use any account to check Dice variable dices with arg (0). Prev owner of dice should be DiceTokenMarket contract address and owner of dice should be account B address
- use account A to execute DiceToken checkCredit function to see that balance has increased by 3 DT
- use account B to execute DiceToken checkCredit function to see that balance has reduced by 5 DT to 95 DT
- 2 DT was commission fee for DiceMarketToken)
- use account A to deploy Dice contract
- use account A to deploy DiceBattle contract with arg (Dice contract address)
- use account B to execute Dice function add dice with arg (1,2) and value 1 ether, becomes dice 0
- use account B to execute Dice function transfer dice with arg (0, DiceBattle address)
- use account B to execute DiceBattle function setBattlePair with arg (account C address, 0)
- use account C to execute Dice function add dice with arg (3,4) and value 3 ether, becomes dice 1
- use account C to execute Dice function transfer dice with arg (1, DiceBattle address)
- use account C to execute DiceBattle function setBattlePair with arg (account B address, 1)
- use account C to execute DiceBattle function battle with arg (1, 0, account C address, account B address)
- use any account to execute DiceBattle function battleResults with arg (0) to see battle results, including dice1, dice2, player1, player2, winner, and if tie result
- use any account to check Dice variable dices with arg (0), and with arg (1). The prev owner of both dice 0 and dice 1 should be the DiceBattle address, and the new owner should be the winner in step 10 or original owner if tie.
- in console can also see the diceId, newNumber and result event type (winResult, loseResult, tieResult)
- result event is relative to the account that executed battle function, as account C executed the battle, hence
- winResult - account C is owner of dice 0 and dice 1
- loseResult - account B is owner of dice 0 and dice 1
- tieResult - account B is owner of dice 0 and account C is owner of dice 1