Last active
July 6, 2019 21:21
-
-
Save tomclose/925cb038928656e1fbfbf1fb57bdc8b1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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