game-proposal: verify

This commit is contained in:
djmil 2023-11-28 18:19:45 +01:00
parent 69b05dd1d1
commit e7a2996234

View File

@ -14,31 +14,34 @@ public class GameProposalContract implements net.corda.v5.ledger.utxo.Contract {
@Override @Override
public void verify(UtxoLedgerTransaction trx) { public void verify(UtxoLedgerTransaction trx) {
log.info("GameProposalContract.verify() called"); log.info("--> GameProposalContract.verify() called");
requireThat(trx.getCommands().size() == 1, GameCommand.REQUIRE_SINGLE_COMMAND);
final GameCommand command = getSingleCommand(trx, GameCommand.class);
switch (command.getAction()) { // requireThat(trx.getCommands().size() == 1, GameCommand.REQUIRE_SINGLE_COMMAND);
case GAME_PROPOSAL_CREATE: // final GameCommand command = getSingleCommand(trx, GameCommand.class);
command.validateGameProposalCreate(trx);
break;
case GAME_PROPOSAL_ACCEPT: // log.info("--> GameProposalContract.verify: command "+command.getAction());
command.validateGameProposalAccept(trx);
break;
case GAME_PROPOSAL_REJECT: // switch (command.getAction()) {
command.validateGameProposalReject(trx); // case GAME_PROPOSAL_CREATE:
break; // command.validateGameProposalCreate(trx);
// break;
case GAME_PROPOSAL_CANCEL: // case GAME_PROPOSAL_ACCEPT:
command.validateGameProposalCancel(trx); // command.validateGameProposalAccept(trx);
break; // break;
default: // case GAME_PROPOSAL_REJECT:
throw new GameCommand.ActionException(); // command.validateGameProposalReject(trx);
} // break;
// case GAME_PROPOSAL_CANCEL:
// command.validateGameProposalCancel(trx);
// break;
// default:
// throw new GameCommand.ActionException();
// }
} }
} }