Skip to content

Instantly share code, notes, and snippets.

@tomclose
Created July 4, 2019 13:56
Show Gist options
  • Save tomclose/1db6e1d376a921189a128cb1567916d3 to your computer and use it in GitHub Desktop.
Save tomclose/1db6e1d376a921189a128cb1567916d3 to your computer and use it in GitHub Desktop.
// in the adjudicator contract:
function respond(State memory s1, State memory s2) public {
// check that the first state matches the stored challenge
assertHashMatches(s1, stored_challenge_hash);
// framework checks
  assertValidSignature(s2);
  assertSameAppDefinition(s1, s2);
  assertTurnNumIncrements(s1, s2);
  // … etc.
// app-specific checks
 app = NitroApp(s2.AppDefinition);
  assert(app.validTransition(s1, s2));
 
 // once all checks have passed, cancel the challenge
  cancel_challenge();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment