-
Notifications
You must be signed in to change notification settings - Fork 46
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 #1848 from kleros/feat/court-configs
Court configs: new oracle court, edited spanish non-technical court
- Loading branch information
Showing
15 changed files
with
387 additions
and
162 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,47 +1,82 @@ | ||
[ | ||
{ | ||
"name": "General Court", | ||
"id": 1, | ||
"parent": 0, | ||
"hiddenVotes": true, | ||
"minStake": "520000000000000000000", | ||
"minStake": "1500000000000000000", | ||
"alpha": "5000", | ||
"feeForJuror": "15000000000000000000", | ||
"feeForJuror": "100000000000", | ||
"jurorsForCourtJump": "511", | ||
"timesPerPeriod": [ | ||
280800, | ||
583200, | ||
583200, | ||
388800 | ||
120, | ||
240, | ||
240, | ||
600 | ||
] | ||
}, | ||
{ | ||
"name": "Curation", | ||
"id": 2, | ||
"parent": 1, | ||
"hiddenVotes": false, | ||
"minStake": "520000000000000000000", | ||
"minStake": "2000000000000000000", | ||
"alpha": "3100", | ||
"feeForJuror": "6900000000000000000", | ||
"jurorsForCourtJump": "30", | ||
"feeForJuror": "100000000000", | ||
"jurorsForCourtJump": "31", | ||
"timesPerPeriod": [ | ||
140400, | ||
291600, | ||
291600, | ||
194400 | ||
120, | ||
240, | ||
240, | ||
600 | ||
] | ||
}, | ||
{ | ||
"name": "English Language", | ||
"id": 3, | ||
"parent": 1, | ||
"hiddenVotes": false, | ||
"minStake": "1200000000000000000000", | ||
"minStake": "2000000000000000000", | ||
"alpha": "5000", | ||
"feeForJuror": "22000000000000000000", | ||
"feeForJuror": "100000000000", | ||
"jurorsForCourtJump": "63", | ||
"timesPerPeriod": [ | ||
280800, | ||
437400, | ||
437400, | ||
291600 | ||
120, | ||
240, | ||
240, | ||
600 | ||
] | ||
}, | ||
{ | ||
"name": "Corte de Disputas de Consumo y Vecindad", | ||
"id": 4, | ||
"parent": 1, | ||
"hiddenVotes": false, | ||
"minStake": "2000000000000000000", | ||
"alpha": "5000", | ||
"feeForJuror": "100000000000", | ||
"jurorsForCourtJump": "63", | ||
"timesPerPeriod": [ | ||
120, | ||
240, | ||
240, | ||
600 | ||
] | ||
}, | ||
{ | ||
"name": "Oracle Court", | ||
"id": 5, | ||
"parent": 1, | ||
"hiddenVotes": false, | ||
"minStake": "2000000000000000000", | ||
"alpha": "5000", | ||
"feeForJuror": "100000000000", | ||
"jurorsForCourtJump": "31", | ||
"timesPerPeriod": [ | ||
120, | ||
240, | ||
240, | ||
600 | ||
] | ||
} | ||
] |
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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
contracts/config/policies.v2/English-Language-Court-Policy.json
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#!/bin/bash | ||
|
||
# Check if at least one input file is provided | ||
if [ "$#" -lt 1 ]; then | ||
echo "Usage: $0 <input_policies_file1> [input_policies_file2 ...]" | ||
exit 1 | ||
fi | ||
|
||
# Process each input file | ||
for INPUT_FILE in "$@"; do | ||
# Validate file extension | ||
if [[ ! "$INPUT_FILE" =~ \.json$ ]]; then | ||
echo "Error: Input file $INPUT_FILE must have a .json extension" | ||
continue | ||
fi | ||
|
||
echo "Processing $INPUT_FILE..." | ||
|
||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
INPUT_FILE_WITHOUT_EXTENSION="${INPUT_FILE%.json}" | ||
POLICIES_DIR="$SCRIPT_DIR/../$INPUT_FILE_WITHOUT_EXTENSION" | ||
HASHES_FILE=$(mktemp) | ||
|
||
echo "Creating $POLICIES_DIR directory..." | ||
mkdir -p $POLICIES_DIR | ||
|
||
# Step 1: Create individual policy files and collect their hashes | ||
echo "Creating individual policy files..." | ||
echo "{" > "$HASHES_FILE" | ||
first=true | ||
|
||
jq -c '.[]' "$INPUT_FILE" | while read -r policy; do | ||
name=$(echo "$policy" | jq -r '.name' | tr ' ' '-') | ||
court=$(echo "$policy" | jq -r '.court') | ||
policy_filepath="$POLICIES_DIR/${name}-Policy.json" | ||
|
||
# Remove the uri field if it exists and save to a temporary file | ||
echo "$policy" | jq 'del(.uri)' > "$policy_filepath" | ||
|
||
# Get IPFS hash | ||
ipfs_hash=$(ipfs add -Q "$policy_filepath") | ||
if [ -n "$ipfs_hash" ]; then | ||
echo "Preparing $name Court ($court): ${name}-Policy.json" | ||
# Add comma for all but the first entry | ||
if [ "$first" = true ]; then | ||
first=false | ||
else | ||
echo "," >> "$HASHES_FILE" | ||
fi | ||
# Store the hash with court as key | ||
echo "\"$court\": \"$ipfs_hash\"" >> "$HASHES_FILE" | ||
else | ||
echo "Failed to get IPFS hash for ${name}-Policy.json" | ||
rm "$HASHES_FILE" | ||
continue 2 | ||
fi | ||
done | ||
|
||
echo "}" >> "$HASHES_FILE" | ||
|
||
# Step 2: Update the input file with URIs | ||
echo "Updating URIs in $INPUT_FILE..." | ||
jq --slurpfile hashes "$HASHES_FILE" ' | ||
map(. + {uri: ("/ipfs/" + ($hashes[0][.court | tostring]))}) | ||
' "$INPUT_FILE" > "${INPUT_FILE}.tmp" && mv "${INPUT_FILE}.tmp" "$INPUT_FILE" | ||
|
||
rm "$HASHES_FILE" | ||
echo "Done! URIs updated in $INPUT_FILE" | ||
echo "----------------------------------------" | ||
done |
Oops, something went wrong.