Skip to content

Commit 9afac7c

Browse files
authored
Merge branch 'dev' into fix(web)/skeletons-styling-dark-and-light-modes
2 parents cbd5b6f + f6c2582 commit 9afac7c

File tree

6 files changed

+104
-0
lines changed

6 files changed

+104
-0
lines changed

contracts/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"bot:relayer-from-chiado": "NODE_NO_WARNINGS=1 NODE_OPTIONS=--experimental-fetch hardhat run ./scripts/disputeRelayerBotFromChiado.ts",
3030
"bot:relayer-from-goerli": "NODE_NO_WARNINGS=1 NODE_OPTIONS=--experimental-fetch hardhat run ./scripts/disputeRelayerBotFromGoerli.ts",
3131
"bot:relayer-from-hardhat": "NODE_NO_WARNINGS=1 NODE_OPTIONS=--experimental-fetch hardhat run ./scripts/disputeRelayerBotFromHardhat.ts",
32+
"bot:disputor": "NODE_NO_WARNINGS=1 yarn hardhat run ./scripts/disputeCreatorBot.ts",
3233
"etherscan-verify": "hardhat etherscan-verify",
3334
"sourcify": "hardhat sourcify --write-failing-metadata",
3435
"size": "hardhat size-contracts --no-compile",
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
import env from "./utils/env";
2+
import loggerFactory from "./utils/logger";
3+
import hre = require("hardhat");
4+
import { KlerosCore, DisputeResolver } from "../typechain-types";
5+
import { BigNumber } from "ethers";
6+
const { ethers } = hre;
7+
8+
const HEARTBEAT_URL = env.optionalNoDefault("HEARTBEAT_URL_DISPUTOR_BOT");
9+
const loggerOptions = env.optionalNoDefault("LOGTAIL_TOKEN_DISPUTOR_BOT")
10+
? {
11+
transportTargetOptions: {
12+
target: "@logtail/pino",
13+
options: { sourceToken: env.require("LOGTAIL_TOKEN_DISPUTOR_BOT") },
14+
level: env.optional("LOG_LEVEL", "info"),
15+
},
16+
level: env.optional("LOG_LEVEL", "info"), // for pino-pretty
17+
}
18+
: {};
19+
const logger = loggerFactory.createLogger(loggerOptions);
20+
21+
export default async function main() {
22+
logger.info("Starting up");
23+
24+
const core = (await ethers.getContract("KlerosCore")) as KlerosCore;
25+
const resolver = (await ethers.getContract("DisputeResolver")) as DisputeResolver;
26+
27+
if (HEARTBEAT_URL) {
28+
logger.debug("Sending heartbeat");
29+
fetch(HEARTBEAT_URL);
30+
} else {
31+
logger.debug("Heartbeat not set up, skipping");
32+
}
33+
const extraData =
34+
"0x" +
35+
"0000000000000000000000000000000000000000000000000000000000000001" + // courtId 1
36+
"000000000000000000000000000000000000000000000000000000000000000B" + // minJurors 11
37+
"0000000000000000000000000000000000000000000000000000000000000002"; // disputeKitId 2
38+
const templates = [
39+
`{"title":"A reality.eth question","description":"A reality.eth question has been raised to arbitration.","question":"**Kleros Moderate:** Did the user, **degenape6** (ID: 1554345080), break the Telegram group, ***[Kleros Trading Group]()*** (ID: -1001151472172), ***[rules](https://ipfs.kleros.io/ipfs/Qme3Qbj9rKUNHUe9vj9rqCLnTVUCWKy2YfveQF8HiuWQSu/Kleros%20Moderate%20Community%20Rules.pdf)*** due to conduct related to the ***[message](https://t.me/c/1151472172/116662)*** (***[backup](https://ipfs.kleros.io/ipfs/QmVbFrZR1bcyQzZjvLyXwL9ekDxrqHERykdreRxXrw4nqg/animations_file_23.mp4)***)?","answers":[{"id":"0x01","title":"Yes","reserved":false},{"id":"0x02","title":"No","reserved":false},{"id":"0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF","title":"Answered Too Soon","reserved":true}],"policyURI":"/ipfs/QmZ5XaV2RVgBADq5qMpbuEwgCuPZdRgCeu8rhGtJWLV6yz","frontendUrl":"https://reality.eth.limo/app/#!/question/0xe78996a233895be74a66f451f1019ca9734205cc-0xe2a3bd38e3ad4e22336ac35b221bbbdd808d716209f84014c7bc3bf62f8e3b39","arbitrableChainID":"100","arbitrableAddress":"0x2e39b8f43d0870ba896f516f78f57cde773cf805","arbitratorChainID":"421613","arbitratorAddress":"0xD08Ab99480d02bf9C092828043f611BcDFEA917b","category":"Oracle","lang":"en_US","specification":"KIP99"}`,
40+
`{"title":"Add an entry to Ledger Contract Domain Name registry v2","description":"Someone requested to add an entry to Ledger Contract Domain Name registry v2","question":"Does the entry comply with the required criteria?","answers":[{"title":"Yes, Add It","description":"Select this if you think the entry complies with the required criteria and should be added."},{"title":"No, Don't Add It","description":"Select this if you think the entry does not comply with the required criteria and should not be added."}],"policyURI":"/ipfs/QmW3nQcMW2adyqe6TujRTYkyq26PiDqcmmTjdgKiz9ynPV","frontendUrl":"https://curate.kleros.io/tcr/100/0x957a53a994860be4750810131d9c876b2f52d6e1/0xc2c1aa705632f53051f22a9f65967c0944370020a7489aba608bd0d755ca1234","arbitratorChainID":"421613","arbitratorAddress":"0x791812B0B9f2ba260B2DA432BB02Ee23BC1bB509","category":"Curation","specification":"KIP0X","lang":"en_US"}`,
41+
`{"title":"Omen Question: News & Politics","description":"This reality dispute has been created by Omen, we advise you to read [the Omen Rules](https://cdn.kleros.link/ipfs/QmU1oZzsduGwtC7vCUQPw1QcBP6BDNDkg4t6zkowPucVcx) and consult the evidence provided in [the Market Comments](https://omen.eth.limo/#/0x95b2271039b020aba31b933039e042b60b063800).","question":"**Assuming that today is December 20th 2020, will Joe Biden win the 2020 United States presidential election?**","answers":[{"title":"Yes"},{"title":"No"}],"policyURI":"/ipfs/QmU1oZzsduGwtC7vCUQPw1QcBP6BDNDkg4t6zkowPucVcx","frontendUrl":"https://omen.eth.limo/#/0x95b2271039b020aba31b933039e042b60b063800","arbitratorChainID":"421613","arbitratorAddress":"0x791812B0B9f2ba260B2DA432BB02Ee23BC1bB509","category":"Oracle","specification":"KIP0X","lang":"en_US"}`,
42+
`{"title":"Proof of Humanity Registration Request","description":"A request to register the specified entry to a list of provable humans.","question":"Should the request to register be accepted?","answers":[{"title":"Yes","description":"Accept the request to register the entry."},{"title":"No","description":"Deny the request."}],"policyURI":"/ipfs/QmYPf2fdSyr9BiSy6pJFUmB1oTUPwg6dhEuFqL1n4ZosgH","frontendUrl":"https://app.proofofhumanity.id/profile/0x00de4b13153673bcae2616b67bf822500d325fc3?network=mainnet","arbitratorChainID":"421613","arbitratorAddress":"0x791812B0B9f2ba260B2DA432BB02Ee23BC1bB509","category":"Curated List","specification":"KIP0X","lang":"en_US"}`,
43+
];
44+
const randomTemplate = templates[Math.floor(Math.random() * templates.length)];
45+
const nbOfChoices = 2;
46+
const cost = (await core.functions["arbitrationCost(bytes)"](extraData)).cost;
47+
const tx = await resolver.createDisputeForTemplate(
48+
extraData,
49+
randomTemplate,
50+
"disputeTemplateMapping: TODO",
51+
nbOfChoices,
52+
{
53+
value: cost,
54+
}
55+
);
56+
57+
logger.info(`Dispute creation tx: ${tx.hash}`);
58+
const blockNumber = await tx.wait().then((receipt) => receipt.blockNumber);
59+
const disputeId = await resolver
60+
.queryFilter(resolver.filters.DisputeRequest(), blockNumber, blockNumber)
61+
.then((events) => BigNumber.from(events[0].args[1]));
62+
logger.info(`Dispute created with disputeId ${disputeId.toString()}`);
63+
64+
logger.info("Shutting down");
65+
await delay(2000); // Some log messages may be lost otherwise
66+
}
67+
68+
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
69+
70+
main()
71+
.then(() => process.exit(0))
72+
.catch((error) => {
73+
console.error(error);
74+
process.exit(1);
75+
})
76+
.finally(() => {
77+
logger.flush();
78+
});

cspell.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"datetime",
2020
"devnet",
2121
"Devnet",
22+
"DISPUTOR",
2223
"dockerhost",
2324
"Ethfinex",
2425
"gluegun",

services/bots/testnet/bots.env.testnet.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ SUBGRAPH_URL=https://api.thegraph.com/subgraphs/name/alcercu/kleroscoretest
88
LOG_LEVEL=debug
99
LOGTAIL_TOKEN_KEEPER_BOT=<optional token>
1010
LOGTAIL_TOKEN_RELAYER_BOT=<optional token>
11+
LOGTAIL_TOKEN_DISPUTOR_BOT=<optional token>
1112

1213
# Heartbeat
1314
HEARTBEAT_URL_KEEPER_BOT=<optional url>
1415
HEARTBEAT_URL_RELAYER_BOT=<optional url>
16+
HEARTBEAT_URL_DISPUTOR_BOT=<optional url>
1517

1618
DISPUTES_TO_SKIP=

services/bots/testnet/compose.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@ services:
99
- type: bind
1010
source: ./pm2.config.keeper-bot.${DEPLOYMENT}.js
1111
target: /usr/src/app/contracts/ecosystem.config.js
12+
13+
disputor-bot:
14+
container_name: disputor-bot-${DEPLOYMENT:?error}
15+
extends:
16+
file: ../base/bot-pm2.yml
17+
service: bot-pm2
18+
volumes:
19+
- type: bind
20+
source: ./pm2.config.disputor-bot.${DEPLOYMENT}.js
21+
target: /usr/src/app/contracts/ecosystem.config.js
1222

1323
relayer-bot-from-chiado:
1424
container_name: relayer-bot-from-chiado-${DEPLOYMENT:?error}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module.exports = {
2+
apps: [
3+
{
4+
name: "disputor-bot-testnet",
5+
interpreter: "sh",
6+
script: "yarn",
7+
args: "bot:disputor --network arbitrumGoerli",
8+
restart_delay: 43200000, // 12 hours
9+
autorestart: true,
10+
},
11+
],
12+
};

0 commit comments

Comments
 (0)