Skip to content

Commit b25bfca

Browse files
guangmiangitbook-bot
authored andcommitted
GitBook: [#284] docs: Added page for transaction guide
1 parent f264442 commit b25bfca

6 files changed

+99
-0
lines changed
113 KB
Loading
115 KB
Loading
12.2 KB
Loading
31.6 KB
Loading

SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
* [Curate Classic: Integration for Devs](developer/classic.md)
6363
* [Light Curate: Integration for Devs](developer/light-curate.md)
6464
* [Deployment Addresses](developer/deployment-addresses.md)
65+
* [Guide for Preparing Transactions](developer/guide-for-preparing-transactions.md)
6566

6667
## Contribution Guidelines
6768

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Guide for Preparing Transactions
2+
3+
### How To: createSubcourt
4+
5+
* When a request comes in to create a new subcourt, start by checking the final Snapshot voting results to see the parameters of the new court.
6+
* Example [https://snapshot.org/#/kleros.eth/proposal/0x19f0c1de5af192c1f12350f110abd84b4cd8512fcfdb241aa04e0323d316abab](https://snapshot.org/#/kleros.eth/proposal/0x19f0c1de5af192c1f12350f110abd84b4cd8512fcfdb241aa04e0323d316abab)
7+
* To prepare the transaction itself, head over to the respective block explorer of the court deployment.
8+
* See links to contract deployments here [deployment-addresses.md](deployment-addresses.md "mention")
9+
* Then connect your wallet and navigate to the write contract section of the block explorer.
10+
11+
<figure><img src="../.gitbook/assets/8EB7B80D-8500-42B2-AAA7-A3B09B14B805.jpeg" alt=""><figcaption></figcaption></figure>
12+
13+
* Fill in the parameters of the createSubcourt function like so 👇
14+
15+
<figure><img src="../.gitbook/assets/BB418DD2-050C-49AC-AA0A-66F948FD0A48_4_5005_c.jpeg" alt=""><figcaption></figcaption></figure>
16+
17+
* Before writing to the contract, make sure your wallet is connected to the network of the deployment you’re trying to write to. In the example above, we’ll need to be connected to Gnosis Chain.
18+
19+
**Note:** It’s best practice to take a screenshot of the input parameters so that whoever executes the transaction can double check.
20+
21+
* Click on Write and navigate to the hex section on your wallet. From there, copy the raw transaction data and paste it somewhere safe.
22+
23+
<figure><img src="../.gitbook/assets/7DE1A782-7CB0-4C4B-A7F5-4348EB41BB35.jpeg" alt=""><figcaption></figcaption></figure>
24+
25+
### How To: PolicyRegistry
26+
27+
* The first step of preparing a PolicyRegistry transaction is writing and pinning the policy JSON. To make this easy, we use the file-to-ipfs package.
28+
29+
```shell
30+
mkdir policy
31+
//
32+
cd policy
33+
//
34+
yarn init -y
35+
//
36+
npm i @kleros/file-to-ipfs
37+
```
38+
39+
* Create a json file and write the policy according to what was specified in the snapshot proposal.
40+
41+
```json
42+
{
43+
"name": "xDai Solidity Court",
44+
"description": "**Court purpose** \n\n If the disputed code is of significant size (> 500 code lines), parties in the dispute should point out specific parts of the content which are being disputed. Otherwise, jurors should refuse to arbitrate.",
45+
"summary": "",
46+
"requiredSkills": "This court requires a good level of solidity. Jurors who are not solidity intermediate developers are advised to stake into this court only if they also know how to make relatively simple contracts, know the main solidity hacks and can compute the complexity of simple functions."
47+
}
48+
```
49+
50+
* In the index.js file, run the following script to pin whichever policies you’ve written.
51+
52+
```javascript
53+
const ftIpfs = require("@kleros/file-to-ipfs");
54+
55+
async function pinSol() {
56+
const solPath = await ftIpfs("./files/xDai-Solidity-Court-Policy.json");
57+
console.log(`Solidity Court: ${solPath}`);
58+
}
59+
60+
async function pinJs() {
61+
const jsPath = await ftIpfs("./files/xDai-Javascript-Court-Policy.json");
62+
console.log(`Javascript Court: ${jsPath}`);
63+
}
64+
65+
async function pinDev() {
66+
const devPath = await ftIpfs("./files/xDai-Development-Court-Policy.json");
67+
console.log(`Development Court: ${devPath}`);
68+
}
69+
70+
async function main() {
71+
pinSol();
72+
pinJs();
73+
pinDev();
74+
}
75+
76+
main();
77+
78+
/* Output
79+
Development Court: /ipfs/QmbgUL2iv9XH3jui7xdLBXp2Hqe4VqGnNkK7PnAorJ8XQa/xDai-Development-Court-Policy.json
80+
Solidity Court: /ipfs/QmQbyk1qnD4e4MQrwSr6a21w2t82YJEMxU3F7QTYKkxuNS/xDai-Solidity-Court-Policy.json
81+
Javascript Court: /ipfs/Qme15AUfpvLX3iwEtqswe26PQHMmKnF4eWGywBPqbkdqcD/xDai-Javascript-Court-Policy.json
82+
*/
83+
```
84+
85+
* Copy + Paste the output somewhere safe before closing terminal.
86+
* Go to the PolicyRegistry deployment [deployment-addresses.md](deployment-addresses.md "mention")
87+
* Write the inputs into the setPolicy function (subcourtID and URI string).
88+
89+
<figure><img src="../.gitbook/assets/909D69E6-D779-4D65-B096-05C064EA8305_4_5005_c.jpeg" alt=""><figcaption></figcaption></figure>
90+
91+
* Follow the same steps outlined in the createSubcourt guide to get the raw transaction data.
92+
93+
### Presenting Transactions:
94+
95+
* Make a copy of this [template](https://docs.google.com/document/d/1av-IU5aKwRFzKhktdVNAlkt12sozows6uBapj1T-lq8/edit?usp=sharing) and fill in the necessary informaton.
96+
* If submitting through **Discord** tag @xpriment626 and share the link to your doc.
97+
* If submitting through **Telegram** tag @clesaege and share the link to your doc.
98+
* If submitting through **Slack** share the link to your doc on the public #dev channel.

0 commit comments

Comments
 (0)