Skip to content

Commit

Permalink
define arbiter interface #1
Browse files Browse the repository at this point in the history
  • Loading branch information
utgarda committed Dec 2, 2022
1 parent d1c44bb commit 0acbfec
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# gamejutsu-tezos-contracts
GameJutsu framework helps you create on-chain arbiters for state channel based games

## Deployed contracts
### Ghostnet
* [arbiter](https://ghostnet.tzkt.io/KT1UZzu4ar6STUj2Mxde2hKH8LncCmY2vfjt)
42 changes: 42 additions & 0 deletions arbiter.jsligo
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
type game = {
rules : address,
started : bool,
finished: bool,
key_hash_to_player_id: map<key_hash, nat>,
players: [key, key]
} ;

type storage = map<nat, game>;

type game_move = {
game_id: nat,
nonce: nat,
player: key,
old_state: bytes,
new_state: bytes,
move: bytes
}

type signed_game_move = {
game_move: game_move,
signatures: map<key_hash, signature>
}

type parameter =
| ["DisputeMove", signed_game_move]
| ["ProposeGame", address]
| ["AcceptGame", nat];

const dispute_move = ([store, signed_game_move] : [storage, signed_game_move]) => store; //TODO
const propose_game = ([store, rules] : [storage, address]) => store;
const accept_game = ([store, game_id] : [storage, nat]) => store;

const main = ([action, store] : [parameter, storage]) : [list <operation>, storage] => {
return [
list([]),
(match (action, {
DisputeMove: sgm => dispute_move ([store, sgm]),
ProposeGame: rules => propose_game ([store, rules]),
AcceptGame: game_id => accept_game ([store, game_id])}))
]
};

0 comments on commit 0acbfec

Please sign in to comment.