import "fmg-core/contracts/State.sol"; contract PaymentGame { using State for bytes; // The core State library contains all attributes needed for a payment game state! function validTransition(bytes _old, bytes _new) public pure returns (bool) { uint[] oldResolution = State.resolution(_old); uint[] newResolution = State.resolution(_new); // conserve total balance require(oldResolution[0] + oldResolution[1] == newResolution[0] + newResolution[1]) // can't take someone else's funds by moving uint8 i = _new.indexOfMover(); require(newResolution[i] <= oldResolution[i]); return true; } }
0.4.18