0

I would like to test the smart contract of hashdice using remix IDE, and using truffle. I wonder how to give the arguments for testing.

function placeBet(uint _betMask, uint _modulo, uint _commit, bytes32 _r, bytes32 _s)

and for

  function settleBet(uint _reveal, bytes32 _txHash)

As per documentation, It is to be noted that betMask is bet outcomes bit mask for modulo <= 40 (in this case), modulo is the game modulo, commitLastBlock - number of the maximum block where "commit" is still considered valid, commit is the Keccak256 hash of some secret "reveal" random number, to be supplied by the dice croupier bot in the settleBet transaction. Supplying "commit" ensures that "reveal" cannot be changed behind the scenes after placeBet have been mined. The r, s are the components of ECDSA signature of (commitLastBlock, commit). In settleBet, settleBet should supply a "reveal" number that would Keccak256-hash to "commit" along with "blockHash" that is the block hash of placeBet block as seen by croupier according to the contract.

I am currently struggling with the parameter passing to the functions, for testing.

Could you please advice me on the testing, and it would be helpful if anyone refer me some links for the test scripts to run the tests using truffle? Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.