Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions contracts/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PRIVATE_KEY=
MAINNET_PRIVATE_KEY=
INFURA_API_KEY=
ETHERSCAN_API_KEY=
GNOSISSCAN_API_KEY=
3 changes: 2 additions & 1 deletion contracts/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -184,4 +184,5 @@ tags
!.env.project
.env.vault

!.env.vault
!.env.vault
!.env.example
7 changes: 3 additions & 4 deletions contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ Refresh the list of deployed contracts by running `./scripts/generateDeployments

#### Arbitrum Sepolia

- [CurateFactory](https://sepolia.arbiscan.io/address/0x6f824A72d67bcF76f6F55C12F6E8FcAF531818bD)
- [CurateV2](https://sepolia.arbiscan.io/address/0xed1f06a9963D2B2D5f2176b2dFFaaf03FC909531)
- [CurateView](https://sepolia.arbiscan.io/address/0x61DAadc87f1e0889407d2Fd725eAEB79E2B5cF80)
- [CurateFactory](https://sepolia.arbiscan.io/address/0x24597B8918acA259337AdD2D2C2F07eafeaAf68e)
- [CurateV2](https://sepolia.arbiscan.io/address/0xD48fbC8B5149CBA5c7Ab6bfd37e7a04481475B59)
- [CurateView](https://sepolia.arbiscan.io/address/0xcB42d940a3c84e8d18dC45be8Fd93a1715bb0b81)

#### Sepolia

Expand Down Expand Up @@ -75,7 +75,6 @@ The following env vars are required:
The ones below are optional:

- `ETHERSCAN_API_KEY`: to verify the source of the newly deployed contracts on **Etherscan**.
- `ARBISCAN_API_KEY`: to verify the source of the newly deployed contracts on **Arbitrum**.
- `GNOSISSCAN_API_KEY`: to verify the source of the newly deployed contracts on **Gnosis chain**.

#### 1. Deploy to a Local Network
Expand Down
1 change: 0 additions & 1 deletion contracts/README.md.template
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ The following env vars are required:
The ones below are optional:

- `ETHERSCAN_API_KEY`: to verify the source of the newly deployed contracts on **Etherscan**.
- `ARBISCAN_API_KEY`: to verify the source of the newly deployed contracts on **Arbitrum**.
- `GNOSISSCAN_API_KEY`: to verify the source of the newly deployed contracts on **Gnosis chain**.

#### 1. Deploy to a Local Network
Expand Down
13 changes: 6 additions & 7 deletions contracts/deploy/00-curate-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ const listMetadata = `{

// General court, 3 jurors
const extraData =
"0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003";
"0x000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001";

const NETWORK_TO_DEPLOYMENT: Record<string, DeploymentName> = {
arbitrumSepoliaDevnet: "devnet",
arbitrumSepolia: "testnet",
arbitrum: "mainnetNeo",
arbitrum: "mainnet",
} as const;

const deploy: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
Expand All @@ -50,7 +50,7 @@ const deploy: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
`Unsupported network: ${networkName}. Supported networks: ${Object.keys(NETWORK_TO_DEPLOYMENT).join(", ")}`
);

const { klerosCore, evidence, disputeTemplateRegistry } = await getContractsEthers(ethers.provider, deploymentName);
const { klerosCore, disputeTemplateRegistry } = await getContractsEthers(ethers.provider, deploymentName);
const fee = ethers.parseEther("0.00001");
const timeout = 600; // 10 minutes

Expand All @@ -66,7 +66,6 @@ const deploy: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
deployer,
klerosCore.target,
extraData,
evidence.target,
ethers.ZeroAddress, // _connectedTCR
{
templateRegistry: disputeTemplateRegistry.target,
Expand All @@ -86,16 +85,16 @@ const deploy: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
});

const curateFactory = (await ethers.getContract("CurateFactory")) as CurateFactory;
// main curate
await curateFactory.deploy(
deployer,
klerosCore.target,
extraData,
evidence.target,
ethers.ZeroAddress, // _connectedTCR
{
templateRegistry: disputeTemplateRegistry.target,
registrationTemplateParameters: [registrationTemplate, ""],
removalTemplateParameters: [removalTemplate, ""],
registrationTemplateParameters: [registrationTemplate, dataMappings],
removalTemplateParameters: [removalTemplate, dataMappings],
},
[fee, fee, fee, fee],
timeout,
Expand Down
52 changes: 23 additions & 29 deletions contracts/deployments/arbitrumSepoliaDevnet/CurateFactory.json

Large diffs are not rendered by default.

256 changes: 129 additions & 127 deletions contracts/deployments/arbitrumSepoliaDevnet/CurateV2.json

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions contracts/deployments/arbitrumSepoliaDevnet/CurateView.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ const config: HardhatUserConfig = {
tags: ["staging", "home", "layer2"],
verify: {
etherscan: {
apiUrl: "https://api-sepolia.arbiscan.io",
apiKey: process.env.ARBISCAN_API_KEY,
apiUrl: "https://api.etherscan.io/v2/api",
apiKey: process.env.ETHERSCAN_API_KEY,
},
},
},
Expand All @@ -81,8 +81,8 @@ const config: HardhatUserConfig = {
tags: ["staging", "home", "layer2"],
verify: {
etherscan: {
apiUrl: "https://api-sepolia.arbiscan.io",
apiKey: process.env.ARBISCAN_API_KEY,
apiUrl: "https://api.etherscan.io/v2/api",
apiKey: process.env.ETHERSCAN_API_KEY,
},
},
},
Expand All @@ -95,7 +95,7 @@ const config: HardhatUserConfig = {
tags: ["production", "home", "layer2"],
verify: {
etherscan: {
apiKey: process.env.ARBISCAN_API_KEY,
apiKey: process.env.ETHERSCAN_API_KEY,
},
},
},
Expand Down Expand Up @@ -149,7 +149,7 @@ const config: HardhatUserConfig = {
},
verify: {
etherscan: {
apiKey: process.env.ETHERSCAN_API_KEY_FIX,
apiKey: process.env.ETHERSCAN_API_KEY,
},
},
watcher: {
Expand Down
4 changes: 2 additions & 2 deletions contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"graphql": "^16.8.1",
"graphql-request": "^6.1.0",
"hardhat": "^2.23.0",
"hardhat-deploy": "^1.0.2",
"hardhat-deploy": "^1.0.4",
"hardhat-deploy-ethers": "^0.4.2",
"hardhat-docgen": "^1.3.0",
"hardhat-gas-reporter": "^1.0.10",
Expand All @@ -86,6 +86,6 @@
},
"dependencies": {
"@kleros/curate-v2-templates": "workspace:^",
"@kleros/kleros-v2-contracts": "^0.10.0"
"@kleros/kleros-v2-contracts": "^2.0.0-rc.1"
}
}
15 changes: 15 additions & 0 deletions contracts/scripts/dotenv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

varKey=$1

if [ -z "$varKey" ]; then
echo "Env variable name not provided. Exiting..." >&2
exit 1
fi

node -e "
require('dotenv').config({ path: '"$SCRIPT_DIR"/../.env' })
console.log(process.env.$varKey)
"
19 changes: 12 additions & 7 deletions contracts/scripts/verifyProxies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,33 @@

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

# Etherscan docs: https://docs.etherscan.io/api-endpoints/contracts#verifying-proxy-contract-using-curl
# Etherscan docs: https://docs.etherscan.io/etherscan-v2/api-endpoints/contracts#verifying-proxy-contract-using-curl

function verify() { #deploymentDir #explorerApiUrl #apiKey
function verify() { #deploymentDir #explorerApiUrl #apiKey #chainId
deploymentDir=$1
explorerApiUrl=$2
apiKey=$3
chainId=$4
echo "verifying proxies on $(basename $deploymentDir)"
for f in $(ls -1 $deploymentDir/*_Proxy.json 2>/dev/null); do
contractName=$(basename $f .json)
address=$(cat $f | jq -r .address)
echo -n "verifying $contractName as a proxy at $address... "
curl -s \
-d "address=$address" \
"$explorerApiUrl?module=contract&action=verifyproxycontract&apikey=$apiKey"
"$explorerApiUrl?chainid=${chainId}&module=contract&action=verifyproxycontract&apikey=${apiKey}"
echo
done
}

apiKey=$($SCRIPT_DIR/dotenv.sh ARBISCAN_API_KEY)
apiKey=$($SCRIPT_DIR/dotenv.sh ETHERSCAN_API_KEY)
if [ -z "$apiKey" ]; then
echo "API key missing"
exit 1
fi

verify "$SCRIPT_DIR/../deployments/arbitrumSepoliaDevnet" "https://api-sepolia.arbiscan.io/api" $apiKey
verify "$SCRIPT_DIR/../deployments/arbitrumSepoliaDevnet" "https://api.etherscan.io/v2/api" $apiKey 421614
echo
verify "$SCRIPT_DIR/../deployments/arbitrumSepolia" "https://api-sepolia.arbiscan.io/api" $apiKey
verify "$SCRIPT_DIR/../deployments/arbitrumSepolia" "https://api.etherscan.io/v2/api" $apiKey 421614
echo
verify "$SCRIPT_DIR/../deployments/arbitrum" "https://api.arbiscan.io/api" $apiKey
verify "$SCRIPT_DIR/../deployments/arbitrum" "https://api.etherscan.io/v2/api" $apiKey 42161
5 changes: 1 addition & 4 deletions contracts/src/CurateFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

pragma solidity 0.8.24;

import {CurateV2, IArbitratorV2, EvidenceModule} from "./CurateV2.sol";
import {CurateV2, IArbitratorV2} from "./CurateV2.sol";

/// @title CurateFactory
/// This contract acts as a registry for Curate instances.
Expand Down Expand Up @@ -46,7 +46,6 @@ contract CurateFactory {
/// @param _governor The trusted governor of this contract.
/// @param _arbitrator Arbitrator to resolve potential disputes. The arbitrator is trusted to support appeal periods and not reenter.
/// @param _arbitratorExtraData Extra data for the trusted arbitrator contract.
/// @param _evidenceModule The evidence contract for the arbitrator.
/// @param _connectedList The address of the Curate contract that stores related Curate addresses. This parameter can be left empty.
/// @param _templateRegistryParams The dispute template registry.
/// - templateRegistry : The dispute template registry.
Expand All @@ -64,7 +63,6 @@ contract CurateFactory {
address _governor,
IArbitratorV2 _arbitrator,
bytes calldata _arbitratorExtraData,
EvidenceModule _evidenceModule,
address _connectedList,
CurateV2.TemplateRegistryParams calldata _templateRegistryParams,
uint256[4] calldata _baseDeposits,
Expand All @@ -77,7 +75,6 @@ contract CurateFactory {
_governor,
_arbitrator,
_arbitratorExtraData,
_evidenceModule,
_connectedList,
CurateV2.TemplateRegistryParams(
_templateRegistryParams.templateRegistry,
Expand Down
47 changes: 16 additions & 31 deletions contracts/src/CurateV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
pragma solidity 0.8.24;

import {IArbitrableV2, IArbitratorV2} from "@kleros/kleros-v2-contracts/arbitration/interfaces/IArbitrableV2.sol";
import {EvidenceModule} from "@kleros/kleros-v2-contracts/arbitration/evidence/EvidenceModule.sol";
import "@kleros/kleros-v2-contracts/arbitration/interfaces/IDisputeTemplateRegistry.sol";

/// @title Curate
Expand Down Expand Up @@ -69,7 +68,6 @@ contract CurateV2 is IArbitrableV2 {
struct ArbitrationParams {
IArbitratorV2 arbitrator; // The arbitrator trusted to solve disputes for this request.
bytes arbitratorExtraData; // The extra data for the trusted arbitrator of this request.
EvidenceModule evidenceModule; // The evidence module for the arbitrator.
}

struct TemplateRegistryParams {
Expand Down Expand Up @@ -132,7 +130,14 @@ contract CurateV2 is IArbitrableV2 {
/// @dev Emitted when someone submits a request.
/// @param _itemID The ID of the affected item.
/// @param _requestID Unique dispute identifier within this contract.
event RequestSubmitted(bytes32 indexed _itemID, uint256 _requestID);
/// @param _evidence Stringified evidence object, example: '{"name" : "Justification", "description" : "Description", "fileURI" : "/ipfs/QmWQV5ZFFhEJiW8Lm7ay2zLxC2XS4wx1b2W7FfdrLMyQQc"}'.
event RequestSubmitted(bytes32 indexed _itemID, uint256 _requestID, string _evidence);

/// @dev Emitted when someone challenges a request.
/// @param _itemID The ID of the affected item.
/// @param _requestID Unique dispute identifier within this contract.
/// @param _evidence Stringified evidence object, example: '{"name" : "Justification", "description" : "Description", "fileURI" : "/ipfs/QmWQV5ZFFhEJiW8Lm7ay2zLxC2XS4wx1b2W7FfdrLMyQQc"}'.
event RequestChallenged(bytes32 indexed _itemID, uint256 _requestID, string _evidence);

/// @dev Emitted when the address of the connected Curate contract is set. The Curate is an instance of the Curate contract where each item is the address of a Curate contract related to this one.
/// @param _connectedList The address of the connected Curate.
Expand All @@ -150,7 +155,6 @@ contract CurateV2 is IArbitrableV2 {
/// @param _governor The trusted governor of this contract.
/// @param _arbitrator Arbitrator to resolve potential disputes. The arbitrator is trusted to support appeal periods and not reenter.
/// @param _arbitratorExtraData Extra data for the trusted arbitrator contract.
/// @param _evidenceModule The evidence contract for the arbitrator.
/// @param _connectedList The address of the Curate contract that stores related Curate addresses. This parameter can be left empty.
/// @param _templateRegistryParams The dispute template registry.
/// - templateRegistry : The dispute template registry.
Expand All @@ -168,7 +172,6 @@ contract CurateV2 is IArbitrableV2 {
address _governor,
IArbitratorV2 _arbitrator,
bytes calldata _arbitratorExtraData,
EvidenceModule _evidenceModule,
address _connectedList,
TemplateRegistryParams calldata _templateRegistryParams,
uint256[4] calldata _baseDeposits,
Expand Down Expand Up @@ -200,11 +203,7 @@ contract CurateV2 is IArbitrableV2 {
);

arbitrationParamsChanges.push(
ArbitrationParams({
arbitrator: _arbitrator,
arbitratorExtraData: _arbitratorExtraData,
evidenceModule: _evidenceModule
})
ArbitrationParams({arbitrator: _arbitrator, arbitratorExtraData: _arbitratorExtraData})
);

if (_connectedList != address(0)) {
Expand Down Expand Up @@ -306,18 +305,12 @@ contract CurateV2 is IArbitrableV2 {
/// @notice Changes the params related to arbitration.
/// @param _arbitrator Arbitrator to resolve potential disputes. The arbitrator is trusted to support appeal periods and not reenter.
/// @param _arbitratorExtraData Extra data for the trusted arbitrator contract.
/// @param _evidenceModule The evidence module for the arbitrator.
function changeArbitrationParams(
IArbitratorV2 _arbitrator,
bytes calldata _arbitratorExtraData,
EvidenceModule _evidenceModule
bytes calldata _arbitratorExtraData
) external onlyGovernor {
arbitrationParamsChanges.push(
ArbitrationParams({
arbitrator: _arbitrator,
arbitratorExtraData: _arbitratorExtraData,
evidenceModule: _evidenceModule
})
ArbitrationParams({arbitrator: _arbitrator, arbitratorExtraData: _arbitratorExtraData})
);
}

Expand Down Expand Up @@ -383,7 +376,7 @@ contract CurateV2 is IArbitrableV2 {
request.arbitrationParamsIndex = uint24(arbitrationParamsIndex);
request.requester = payable(msg.sender);

emit RequestSubmitted(itemID, getRequestID(itemID, item.requestCount - 1));
emit RequestSubmitted(itemID, getRequestID(itemID, item.requestCount - 1), "");

if (msg.value > totalCost) {
payable(msg.sender).send(msg.value - totalCost);
Expand Down Expand Up @@ -416,12 +409,7 @@ contract CurateV2 is IArbitrableV2 {
request.requestType = RequestType.Clearing;

uint256 requestID = getRequestID(_itemID, item.requestCount - 1);
emit RequestSubmitted(_itemID, requestID);

// Emit evidence if it was provided.
if (bytes(_evidence).length > 0) {
arbitrationParams.evidenceModule.submitEvidence(requestID, _evidence); // TODO: add a msg.sender parameter to submitEvidence.
}
emit RequestSubmitted(_itemID, requestID, _evidence);

if (msg.value > totalCost) {
payable(msg.sender).send(msg.value - totalCost);
Expand Down Expand Up @@ -472,15 +460,12 @@ contract CurateV2 is IArbitrableV2 {
arbitratorDisputeIDToItemID[address(arbitrator)][disputeData.disputeID] = _itemID;

uint256 requestID = getRequestID(_itemID, lastRequestIndex);
emit RequestChallenged(_itemID, requestID, _evidence);

uint256 templateId = request.requestType == RequestType.Registration
? templateIdRegistration
: templateIdRemoval;
emit DisputeRequest(arbitrator, disputeData.disputeID, requestID, templateId, "");

// Emit evidence if it was provided.
if (bytes(_evidence).length > 0) {
arbitrationParams.evidenceModule.submitEvidence(requestID, _evidence); // TODO: add a msg.sender parameter to submitEvidence.
}
emit DisputeRequest(arbitrator, disputeData.disputeID, templateId);

if (msg.value > totalCost) {
payable(msg.sender).send(msg.value - totalCost);
Expand Down
2 changes: 1 addition & 1 deletion subgraph/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kleros/curate-v2-subgraph",
"version": "0.2.5",
"version": "0.3.5",
"license": "MIT",
"scripts": {
"update:arbitrum-sepolia-devnet": "./scripts/update.sh arbitrumSepoliaDevnet arbitrum-sepolia",
Expand Down
6 changes: 4 additions & 2 deletions subgraph/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -164,16 +164,18 @@ type Request @entity {
disputed: Boolean!
"ID of the dispute, if any."
disputeID: BigInt
"External ID of the dispute, this is always there since it's just requestID. Please use disputed field to check if the dispute was created."
externalDisputeID: BigInt!
"Time when the request was made. Used to track when the challenge period ends."
submissionTime: BigInt!
"True if the request was executed and/or any raised disputes were resolved."
resolved: Boolean!
"The party that made a request"
requester: User!
"Evidence submitted by requester while submitting/removing"
requesterEvidence: String
"The party that challenged the request"
challenger: User
"Evidence submitted by challenger while challenging request"
challengerEvidence: String
"Time when the request was challenged."
challengeTime: BigInt
"The arbitrator trusted to solve disputes for this request."
Expand Down
Loading