Skip to content
Merged
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
4 changes: 2 additions & 2 deletions contracts/deploy/00-escrow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { HardhatRuntimeEnvironment } from "hardhat/types";
import { DeployFunction } from "hardhat-deploy/types";
import { HomeChains, isSkipped } from "./utils";
import { EscrowUniversal } from "../typechain-types";
import { getContracts } from "./utils/getContracts";
import { getArbitratorContracts } from "./utils/getContracts";

const config = {
arbitrumSepoliaDevnet: {
Expand All @@ -28,7 +28,7 @@ const deploy: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const chainId = Number(await getChainId());
console.log("deploying to %s with deployer %s", HomeChains[chainId], deployer);

const { disputeTemplateRegistry, klerosCore } = await getContracts(hre);
const { disputeTemplateRegistry, klerosCore } = await getArbitratorContracts(hre);
const { feeTimeout, settlementTimeout, jurors, courtId } = config[network.name];
const extraData = ethers.AbiCoder.defaultAbiCoder().encode(["uint96", "uint96"], [courtId, jurors]);

Expand Down
58 changes: 20 additions & 38 deletions contracts/deploy/utils/getContracts.ts
Original file line number Diff line number Diff line change
@@ -1,46 +1,28 @@
import { HardhatRuntimeEnvironment } from "hardhat/types";
import {
disputeTemplateRegistryConfig as devnetDtrConfig,
klerosCoreConfig as devnetCoreConfig,
} from "@kleros/kleros-v2-contracts/deployments/devnet.viem";
import {
disputeTemplateRegistryConfig as mainnetDtrConfig,
klerosCoreNeoConfig as mainnetCoreConfig,
} from "@kleros/kleros-v2-contracts/deployments/mainnet.viem";
import {
KlerosCore,
DisputeTemplateRegistry__factory,
KlerosCore__factory,
KlerosCoreNeo__factory,
KlerosCoreNeo,
DisputeTemplateRegistry,
} from "@kleros/kleros-v2-contracts/typechain-types";
import { DeploymentName, getContractsEthers as _getArbitratorContracts } from "@kleros/kleros-v2-contracts";
import { EscrowView, EscrowUniversal } from "../../typechain-types";

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

export const getArbitratorContracts = async (hre: HardhatRuntimeEnvironment) => {
const { ethers, deployments } = hre;
const networkName = deployments.getNetworkName();
const deploymentName = NETWORK_TO_DEPLOYMENT[networkName];
if (!deploymentName)
throw new Error(
`Unsupported network: ${networkName}. Supported networks: ${Object.keys(NETWORK_TO_DEPLOYMENT).join(", ")}`
);
return await _getArbitratorContracts(ethers.provider, deploymentName);
};

export const getContracts = async (hre: HardhatRuntimeEnvironment) => {
const { getChainId, ethers, config } = hre;
const chainId = Number(await getChainId());
const { ethers } = hre;
const { klerosCore, disputeTemplateRegistry } = await getArbitratorContracts(hre);
const escrow = await ethers.getContract<EscrowUniversal>("EscrowUniversal");
const view = await ethers.getContract<EscrowView>("EscrowView");
let disputeTemplateRegistry: DisputeTemplateRegistry;
let klerosCore: KlerosCore | KlerosCoreNeo;
switch (chainId) {
case config.networks.arbitrum.chainId:
disputeTemplateRegistry = DisputeTemplateRegistry__factory.connect(
mainnetDtrConfig.address[chainId],
ethers.provider
);
klerosCore = KlerosCoreNeo__factory.connect(mainnetCoreConfig.address[chainId], ethers.provider);
break;
case config.networks.arbitrumSepolia.chainId:
disputeTemplateRegistry = DisputeTemplateRegistry__factory.connect(
devnetDtrConfig.address[chainId],
ethers.provider
);
klerosCore = KlerosCore__factory.connect(devnetCoreConfig.address[chainId], ethers.provider);
break;
default:
throw new Error(`Unsupported chainId: ${chainId}`);
}
return { escrow, view, disputeTemplateRegistry, klerosCore };
};
11 changes: 0 additions & 11 deletions contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,17 +187,6 @@ const config: HardhatUserConfig = {
mocha: {
timeout: 20000,
},
external: {
// https://github.com/wighawag/hardhat-deploy#importing-deployment-from-other-projects-with-truffle-support
deployments: {
localhost: process.env.HARDHAT_FORK
? ["../node_modules/@kleros/kleros-v2-contracts/deployments/" + process.env.HARDHAT_FORK]
: [],
arbitrumSepoliaDevnet: ["../node_modules/@kleros/kleros-v2-contracts/deployments/arbitrumSepoliaDevnet"],
arbitrumSepolia: ["../node_modules/@kleros/kleros-v2-contracts/deployments/arbitrumSepolia"],
arbitrum: ["../node_modules/@kleros/kleros-v2-contracts/deployments/arbitrum"],
},
},
};

export default config;
22 changes: 11 additions & 11 deletions contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,22 @@
"@nomiclabs/hardhat-solhint": "^4.0.1",
"@typechain/ethers-v6": "^0.5.1",
"@typechain/hardhat": "^9.1.0",
"@types/chai": "^4.3.20",
"@types/chai": "^5.2.1",
"@types/mocha": "^10.0.10",
"@types/node": "^18.0.0",
"@wagmi/cli": "^2.0.3",
"abitype": "^0.10.3",
"chai": "^4.5.0",
"@types/node": "^18.19.86",
"@wagmi/cli": "^2.2.1",
"abitype": "^1.0.8",
"chai": "^5.2.0",
"dotenv": "^16.4.5",
"ethereumjs-util": "^7.1.5",
"ethers": "^6.13.5",
"ethers": "^6.13.6",
"graphql": "^16.10.0",
"graphql-request": "^6.1.0",
"hardhat": "2.22.18",
"hardhat-deploy": "^0.14.0",
"hardhat": "2.23.0",
"hardhat-deploy": "^1.0.2",
"hardhat-deploy-ethers": "^0.4.2",
"hardhat-docgen": "^1.3.0",
"hardhat-gas-reporter": "^2.2.2",
"hardhat-gas-reporter": "^2.2.3",
"hardhat-watcher": "^2.5.0",
"pino": "^8.17.0",
"pino-pretty": "^10.2.3",
Expand All @@ -83,7 +83,7 @@
"typescript": "^5.7.3"
},
"dependencies": {
"@kleros/kleros-v2-contracts": "^0.8.1",
"@openzeppelin/contracts": "^5.2.0"
"@kleros/kleros-v2-contracts": "^0.9.2",
"@openzeppelin/contracts": "^5.3.0"
}
}
4 changes: 2 additions & 2 deletions subgraph/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kleros/escrow-v2-subgraph",
"version": "2.0.8",
"version": "2.1.0",
"license": "MIT",
"scripts": {
"update:arbitrum-sepolia-devnet": "./scripts/update.sh arbitrumSepoliaDevnet arbitrum-sepolia",
Expand Down Expand Up @@ -30,7 +30,7 @@
"@graphprotocol/graph-cli": "0.95.0",
"@kleros/escrow-v2-eslint-config": "workspace:^",
"@kleros/escrow-v2-prettier-config": "workspace:^",
"gluegun": "^5.1.2",
"gluegun": "^5.2.0",
"matchstick-as": "0.6.0"
},
"dependenciesComments": {
Expand Down
8 changes: 4 additions & 4 deletions subgraph/subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ schema:
dataSources:
- kind: ethereum
name: EscrowUniversal
network: arbitrum-one
network: arbitrum-sepolia
source:
address: '0x79530E7Bb3950A3a4b5a167816154715681F2f6c'
address: '0x5ef185810BCe41c03c9E5ca271B8C91F1024F953'
abi: EscrowUniversal
startBlock: 305434342
startBlock: 123526741
mapping:
kind: ethereum/events
apiVersion: 0.0.6
Expand All @@ -22,7 +22,7 @@ dataSources:
- SettlementProposal
abis:
- name: EscrowUniversal
file: ../contracts/deployments/arbitrum/EscrowUniversal.json
file: ../contracts/deployments/arbitrumSepoliaDevnet/EscrowUniversal.json
eventHandlers:
- event: Payment(indexed uint256,uint256,address)
handler: handlePayment
Expand Down
7 changes: 3 additions & 4 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"@typescript-eslint/utils": "^5.62.0",
"@wagmi/cli": "^2.1.15",
"@wagmi/cli": "^2.2.1",
"eslint": "^8.56.0",
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-react": "^7.33.2",
Expand All @@ -78,7 +78,6 @@
"chart.js": "^3.9.1",
"chartjs-adapter-moment": "^1.0.1",
"core-js": "^3.35.0",
"ethers": "^5.7.2",
"graphql": "^16.9.0",
"graphql-request": "^7.1.2",
"moment": "^2.30.1",
Expand All @@ -99,7 +98,7 @@
"react-use": "^17.4.3",
"styled-components": "^5.3.11",
"subgraph-status": "^1.2.4",
"viem": "^2.22.22",
"wagmi": "^2.14.10"
"viem": "^2.27.2",
"wagmi": "^2.14.16"
}
}
Loading