Skip to content

Instantly share code, notes, and snippets.

@tomclose
Last active July 6, 2019 21:21
Show Gist options
  • Save tomclose/925cb038928656e1fbfbf1fb57bdc8b1 to your computer and use it in GitHub Desktop.
Save tomclose/925cb038928656e1fbfbf1fb57bdc8b1 to your computer and use it in GitHub Desktop.
module Adjudicator {
// the adjudicator explicitly declares the apps it supports
import 0x32.Payments;
import 0x34.Poker;
// etc.
public respond(adj: &mut R#Self.T, s1: &V#State, s2: &V#State) {
  // framework checks 
  // … (not shown) …
// app-specific checks
  let appDef = getAppDefinition(copy(s1))
  if (appDef == '0x32.Payments') {
  Payments.validTransition(copy(s1), copy(s2))
  } else if (appDef == '0x34.Poker') {
Poker.validTransition(copy(s1), copy(s2))
  } // etc.
 
  // if all check pass, cancel the challenge
  cancel_challenge(move(adjudicator));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment