Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interfaces v2 #541

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
587764c
feat: interfaces for the arbitrator, arbitrables and evidence v2
jaybuidl Jan 27, 2023
3f08def
docs: examples of metaevidence and dispute templates
jaybuidl Apr 17, 2023
0db1d54
docs: wip specs
jaybuidl Apr 18, 2023
474c143
docs: interfaces docs update
jaybuidl Apr 18, 2023
cf278ce
docs: added curate, improved the schema
jaybuidl Apr 18, 2023
ad24340
docs: added poh, removed type to rely on default
jaybuidl Apr 18, 2023
4b5951f
docs: new dispute template schema improvement
jaybuidl Apr 18, 2023
45a51c0
docs: added the datetime type
jaybuidl Apr 19, 2023
6a2f70c
feat: interfaces wip
jaybuidl Jun 13, 2023
4f59a62
docs: CrossChainDisputeRequest event
jaybuidl Jun 13, 2023
327a32e
refactor: example folder
jaybuidl Jun 13, 2023
d6c3623
fix: natspec
jaybuidl Jun 13, 2023
17c857f
feat: migrated DisputeResolver
jaybuidl Jun 13, 2023
651def6
docs: removed comments
jaybuidl Jun 13, 2023
ef6e263
feat: deploy scripts improvements
jaybuidl Jun 13, 2023
77cb6ed
feat: resolver migrated and deployed to chiado, interfaces natspec im…
jaybuidl Jun 14, 2023
ab7fb79
fix: forge doc assumes the top-level folder when linking to the githu…
jaybuidl Jun 14, 2023
5efb307
fix: bsd vs gnu compatibility
jaybuidl Jun 14, 2023
4078d04
docs: minor parameter rename
jaybuidl Jun 14, 2023
d66cf9d
refactor: moved crosschain event to the gateway interface
jaybuidl Jun 15, 2023
4c25bfe
feat: migrated all the interfaces to the new v2 ones)
jaybuidl Jun 19, 2023
c5a4846
feat: added a simple dispute template, moved IMetaEvidence to the v1 …
jaybuidl Jun 19, 2023
3fe7121
fix: adding missing files for the dispute resolver
jaybuidl Jun 20, 2023
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
7 changes: 3 additions & 4 deletions contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ Smart contracts for Kleros v2

Refresh the list of deployed contracts by running `./scripts/generateDeploymentsMarkdown.sh`.

### v2-alpha-1

#### Chiado

- [ArbitrableExample](https://blockscout.com/gnosis/chiado/address/0xc0fcc96BFd78e36550FCaB434A9EE1210B57225b)
- [DisputeResolver](https://blockscout.com/gnosis/chiado/address/0x433eD78895df1df7668C40b3e82d54410331F942)
- [ForeignGatewayOnGnosis](https://blockscout.com/gnosis/chiado/address/0x573bcD6ee4aEe152eCC9Cafd2c0820Dc548AF6cC)
- [SortitionSumTreeFactory](https://blockscout.com/gnosis/chiado/address/0xc7e3BF90299f6BD9FA7c3703837A9CAbB5743636)
- [TokenBridge](https://blockscout.com/gnosis/chiado/address/0xbb3c86f9918C3C1d83668fA84e79E876d147fFf2)
Expand All @@ -28,10 +27,10 @@ Refresh the list of deployed contracts by running `./scripts/generateDeployments
#### Arbitrum Goerli

- [PNK](https://goerli.arbiscan.io/token/0x4DEeeFD054434bf6721eF39Aa18EfB3fd0D12610/token-transfers)
- [ArbitrableExampleEthFee](https://goerli.arbiscan.io/address/0x1fF31be1924f55804350ADe4945f3B3a6a2e15d2)
- [ArbitrableExampleEthFee](https://goerli.arbiscan.io/address/0x1d533481cCD1402f83Df3D9Ba7496B5e5b602875)
- [BlockHashRNG](https://goerli.arbiscan.io/address/0x68eE49dfD9d76f3386257a3D0e0A85c0A5519bBD)
- [DisputeKitClassic](https://goerli.arbiscan.io/address/0xcBE3aD699919Cf59efDF715e4B41AF30A0E4c92d)
- [DisputeResolver](https://goerli.arbiscan.io/address/0x3B4edEFd12a467D1C71506ae2eE88828145202b1)
- [DisputeResolver](https://goerli.arbiscan.io/address/0xF6652c10c4D3f5bA6066254B78c57A468d9b9606)
- [HomeGatewayToGnosis](https://goerli.arbiscan.io/address/0xD60CD2151e118Dd796efcb1ceFFcF892226F9b3a)
- [KlerosCore](https://goerli.arbiscan.io/address/0xA429667Abb1A6c530BAd1083df4C69FBce86D696)
- [PolicyRegistry](https://goerli.arbiscan.io/address/0xED503aBA65B28D81444294D1eAa5d84CeFdC2C58)
Expand Down
12 changes: 8 additions & 4 deletions contracts/deploy/00-home-chain-arbitrable.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { DeployFunction } from "hardhat-deploy/types";
import disputeTemplate from "../../kleros-sdk/config/v2-disputetemplate/simple/NewDisputeTemplate.simple.json";

enum HomeChains {
ARBITRUM_ONE = 42161,
Expand All @@ -20,10 +21,13 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment)

await deploy("ArbitrableExampleEthFee", {
from: deployer,
args: [
klerosCore.address,
"https://cloudflare-ipfs.com/ipfs/bafkreifteme6tusnjwyzajk75fyvzdmtyycxctf7yhfijb6rfigz3n4lvq",
],
args: [klerosCore.address, disputeTemplate],
log: true,
});

await deploy("DisputeResolver", {
from: deployer,
args: [klerosCore.address],
log: true,
});
};
Expand Down
6 changes: 0 additions & 6 deletions contracts/deploy/00-home-chain-arbitration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,6 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment)
if (currentCore !== klerosCore.address) {
await execute("DisputeKitClassic", { from: deployer, log: true }, "changeCore", klerosCore.address);
}

await deploy("DisputeResolver", {
from: deployer,
args: [klerosCore.address],
log: true,
});
};

deployArbitration.tags = ["Arbitration"];
Expand Down
6 changes: 3 additions & 3 deletions contracts/deploy/01-foreign-gateway-on-ethereum.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { DeployFunction } from "hardhat-deploy/types";
import getContractAddress from "../deploy-helpers/getContractAddress";
import disputeTemplate from "../../kleros-sdk/config/v2-disputetemplate/simple/NewDisputeTemplate.simple.json";

enum ForeignChains {
ETHEREUM_MAINNET = 1,
Expand Down Expand Up @@ -52,11 +53,10 @@ const deployForeignGateway: DeployFunction = async (hre: HardhatRuntimeEnvironme
ethers.BigNumber.from(10).pow(17)
);

const metaEvidenceUri = `https://raw.githubusercontent.com/kleros/kleros-v2/master/contracts/deployments/${hre.network.name}/MetaEvidence_ArbitrableExample.json`;

await deploy("ArbitrableExample", {
from: deployer,
args: [foreignGateway.address, metaEvidenceUri],
contract: "ArbitrableExampleEthFee",
args: [foreignGateway.address, disputeTemplate],
log: true,
});
};
Expand Down
15 changes: 8 additions & 7 deletions contracts/deploy/01-foreign-gateway-on-gnosis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { parseUnits } from "ethers/lib/utils";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { DeployFunction } from "hardhat-deploy/types";
import getContractAddress from "../deploy-helpers/getContractAddress";
import { KlerosCore__factory } from "../typechain-types";

enum ForeignChains {
GNOSIS_MAINNET = 100,
Expand Down Expand Up @@ -75,13 +76,13 @@ const deployForeignGateway: DeployFunction = async (hre: HardhatRuntimeEnvironme
});

// TODO: disable the gateway until fully initialized with the correct fees OR allow disputeCreators to add funds again if necessary.
await execute(
"ForeignGatewayOnGnosis",
{ from: deployer, log: true },
"changeCourtJurorFee",
0,
ethers.utils.parseEther("0.00001")
);
const coreDeployment = await hre.companionNetworks.home.deployments.get("KlerosCore");
const core = await KlerosCore__factory.connect(coreDeployment.address, homeChainProvider);
// TODO: set up the correct fees for the FORKING_COURT
const courtId = await core.GENERAL_COURT();
const fee = (await core.courts(courtId)).feeForJuror;
await execute("ForeignGatewayOnGnosis", { from: deployer, log: true }, "changeCourtJurorFee", courtId, fee);
// TODO: set up the correct fees for the lower courts
};

deployForeignGateway.tags = ["ForeignGatewayOnGnosis"];
Expand Down
6 changes: 2 additions & 4 deletions contracts/deploy/03-vea-mock.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { DeployFunction } from "hardhat-deploy/types";
import { ethers } from "hardhat";
import getContractAddress from "../deploy-helpers/getContractAddress";
import disputeTemplate from "../../kleros-sdk/config/v2-disputetemplate/simple/NewDisputeTemplate.simple.json";

const HARDHAT_NETWORK = 31337;

Expand Down Expand Up @@ -52,11 +52,9 @@ const deployHomeGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment)
ethers.BigNumber.from(10).pow(17)
);

const metaEvidenceUri = `https://raw.githubusercontent.com/kleros/kleros-v2/master/contracts/deployments/goerli/MetaEvidence_ArbitrableExample.json`;

await deploy("ArbitrableExampleEthFee", {
from: deployer,
args: [foreignGateway.address, metaEvidenceUri],
args: [foreignGateway.address, disputeTemplate],
log: true,
});
};
Expand Down
21 changes: 2 additions & 19 deletions contracts/deploy/04-klerosliquid-to-v2-gnosis.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { parseUnits, parseEther } from "ethers/lib/utils";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { DeployFunction } from "hardhat-deploy/types";
import disputeTemplate from "../../kleros-sdk/config/v2-disputetemplate/simple/NewDisputeTemplate.simple.json";

enum ForeignChains {
GNOSIS_MAINNET = 100,
Expand Down Expand Up @@ -104,29 +105,11 @@ const deployKlerosLiquid: DeployFunction = async (hre: HardhatRuntimeEnvironment
// const xKlerosLiquidV2 = await deployments.get("xKlerosLiquidV2");
await deploy("ArbitrableExample", {
from: deployer,
args: [
xKlerosLiquidV2.address,
0,
"/ipfs/bafkreifteme6tusnjwyzajk75fyvzdmtyycxctf7yhfijb6rfigz3n4lvq", // PoH registration
weth.address,
],
args: [xKlerosLiquidV2.address, 0, disputeTemplate, weth.address],
log: true,
maxFeePerGas: ONE_GWEI,
maxPriorityFeePerGas: ONE_GWEI,
});

await execute(
"ArbitrableExample",
{
from: deployer,
log: true,
maxFeePerGas: ONE_GWEI,
maxPriorityFeePerGas: ONE_GWEI,
},
"changeMetaEvidence",
1,
"/ipfs/bafkreibiuxwejijwg4pxco7fqszawcwmpt26itbdxeqgh7cvpeuwtmlhoa" // PoH clearing
);
};

// TODO: mock deployment on the hardhat network
Expand Down
39 changes: 39 additions & 0 deletions contracts/deploy/04-resolver-to-v2-gnosis.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { parseUnits } from "ethers/lib/utils";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { DeployFunction } from "hardhat-deploy/types";

enum ForeignChains {
GNOSIS_MAINNET = 100,
GNOSIS_CHIADO = 10200,
HARDHAT = 31337,
}

const ONE_GWEI = parseUnits("1", "gwei");

const deployResolver: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { deployments, getNamedAccounts, getChainId } = hre;
const { deploy } = deployments;

// fallback to hardhat node signers on local network
const deployer = (await getNamedAccounts()).deployer ?? (await hre.ethers.getSigners())[0].address;
const chainId = Number(await getChainId());
console.log("Deploying to chainId %s with deployer %s", chainId, deployer);

const foreignGateway = await deployments.get("ForeignGatewayOnGnosis");

await deploy("DisputeResolver", {
from: deployer,
args: [foreignGateway.address],
log: true,
maxFeePerGas: ONE_GWEI,
maxPriorityFeePerGas: ONE_GWEI,
});
};

deployResolver.tags = ["ResolverOnGnosis"];
deployResolver.skip = async ({ getChainId }) => {
const chainId = Number(await getChainId());
return !ForeignChains[chainId];
};

export default deployResolver;
90 changes: 58 additions & 32 deletions contracts/deployments/arbitrumGoerli/ArbitrableExampleEthFee.json

Large diffs are not rendered by default.

Loading