-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
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
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) |
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
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])})) | ||
] | ||
}; |