From 7774cac835e63e15961c1a01fa5e2b0866d092b2 Mon Sep 17 00:00:00 2001 From: Leo Alt Date: Thu, 20 Oct 2022 22:01:23 +0200 Subject: [PATCH] update docs --- README.md | 15 ++++++--------- docs/README.md | 27 ++++++++++++--------------- 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 7921d1a..4c0a0ca 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Optimizoooor Gas Golfing NFTs +# Optimizor Club Gas Golfing NFTs -The `Optimizor` NFT collection rewards gas efficient people and machines by +The `Optimizor Club` NFT collection rewards gas efficient people and machines by minting new items whenever a cheaper solution is submitted for a certain challenge. @@ -9,15 +9,12 @@ See [the list]() of challenges, their ids and interfaces. In order to try to beat a challenge, your contract must receive inputs and return outputs in the form specified for that challenge. If your contract spends less gas than the current leader, you receive a fresh NFT that -represents the top of the leader board for that challenge. The previous leader +represents the top of the leaderboard for that challenge. The previous leader keeps their NFT, but they lose the leader status. -The main NFT contract is always in one of three states: `Commit`, `Wait`, or -`Challenge`. Each state lasts 256 blocks. Challenger contracts can only be -committed during the first stage. The second stage makes it harder for -challengers to manipulate the pseudo-random input generation which relies on -the `blockhash` of the last block of the `wait` stage as seed. Finally, -in the third stage challengers can try to claim the lead. +The inputs for the challenges are generated pseudo-randomly using `prevrandao`. +A challenger must first submit the hash of their solution contract. The +challenge itself can be performed after at least 256 blocks. If you are an optimizooor who wants to show your skills please see the [docs](docs). \ No newline at end of file diff --git a/docs/README.md b/docs/README.md index 6ff4f1c..aa44222 100644 --- a/docs/README.md +++ b/docs/README.md @@ -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.