-
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.
Merge pull request #44 from OptimizorClub/update_docs
update docs
- Loading branch information
Showing
2 changed files
with
18 additions
and
24 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
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,19 +1,16 @@ | ||
# Challenger submission workflow | ||
|
||
You can commit your contract as a challenger during the `Commit` stage of the | ||
main contract. You can check in what state the contract is by calling function | ||
`period()`. | ||
You can commit your contract as a challenger at any time. | ||
|
||
In order to commit your contract, call function `commit(bytes32 codehash)` with | ||
the code hash of your contract. This will make sure that you (hopefully) do not | ||
know the challenge inputs in advance, and that only you can use your contract. | ||
In order to commit your contract, call function `commit(bytes32 key)` where | ||
`key = keccak256(abi.encode(sender, codehash, salt))`, `sender` is the address | ||
you intend to use when performin the challenge, `codehash` is the code hash of | ||
your solution contract, and `salt` is any number of your choice. This will | ||
(hopefully) make sure that you do not know the challenge inputs in advance, and | ||
that only you can use your contract. | ||
|
||
When the main contract is in state `Challenge`, you can call function | ||
`challenge(uint256 id, bytes32 codehash, address target, address recipient)` | ||
where `id` is the challenge id; `codehash` is the codehash of your contract | ||
that you have committed in the first stage; `target` is the address of your | ||
contract; `recipient` is the address that should be the owner of the newly | ||
minted NFT, in case you become the leader. | ||
|
||
When the `Challenge` phase is done the whole cycle repeats and you can, for | ||
example, commit new challenger contracts. | ||
At least 256 blocks later, you can call function `challenge(uint256 id, address | ||
target, address recipient, uint salt)` where `id` is the challenge id; `target` | ||
is the address of your solution contract; `recipient` is the address that | ||
should be the owner of the newly minted NFT, in case you become the leader; and | ||
`salt` must be the same you passed when committing. |