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 (rebased) #964

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
be3241d
feat: interfaces for the arbitrator, arbitrables and evidence v2
jaybuidl Jan 27, 2023
8e7a51b
docs: examples of metaevidence and dispute templates
jaybuidl Apr 17, 2023
7abaef4
docs: wip specs
jaybuidl Apr 18, 2023
4010c15
docs: interfaces docs update
jaybuidl Apr 18, 2023
5956b77
docs: added curate, improved the schema
jaybuidl Apr 18, 2023
c121c0e
docs: added poh, removed type to rely on default
jaybuidl Apr 18, 2023
6f97dad
docs: new dispute template schema improvement
jaybuidl Apr 18, 2023
e556b20
docs: added the datetime type
jaybuidl Apr 19, 2023
fc25dd4
feat: interfaces wip
jaybuidl Jun 13, 2023
da0724e
docs: CrossChainDisputeRequest event
jaybuidl Jun 13, 2023
5860c9d
refactor: example folder
jaybuidl Jun 13, 2023
dd04122
fix: natspec
jaybuidl Jun 13, 2023
21adc28
feat: migrated DisputeResolver
jaybuidl Jun 13, 2023
0580c13
docs: removed comments
jaybuidl Jun 13, 2023
3c2019e
feat: deploy scripts improvements
jaybuidl Jun 13, 2023
c5db655
feat: resolver migrated and deployed to chiado, interfaces natspec im…
jaybuidl Jun 14, 2023
76c46b8
fix: forge doc assumes the top-level folder when linking to the githu…
jaybuidl Jun 14, 2023
697546c
fix: bsd vs gnu compatibility
jaybuidl Jun 14, 2023
1eae1d7
docs: minor parameter rename
jaybuidl Jun 14, 2023
a402d0b
refactor: moved crosschain event to the gateway interface
jaybuidl Jun 15, 2023
6a280d9
feat: migrated all the interfaces to the new v2 ones)
jaybuidl Jun 19, 2023
8fa0abe
feat: added a simple dispute template, moved IMetaEvidence to the v1 …
jaybuidl Jun 19, 2023
6f51026
fix: adding missing files for the dispute resolver
jaybuidl Jun 20, 2023
c716852
fix: manual fixes after rebasing onto feat/erc20-fees-on-arbitrator
jaybuidl Jun 20, 2023
dfccbf2
refactor: folder structure
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
14 changes: 8 additions & 6 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 @@ -21,12 +22,13 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment)

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

await deploy("DisputeResolver", {
from: deployer,
args: [klerosCore.address],
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 @@ -49,13 +50,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
5 changes: 2 additions & 3 deletions contracts/deploy/03-vea-mock.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";

const HARDHAT_NETWORK = 31337;

Expand Down Expand Up @@ -51,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("ArbitrableExample", {
from: deployer,
args: [foreignGateway.address, 0, metaEvidenceUri, ethers.constants.AddressZero],
args: [foreignGateway.address, disputeTemplate, ethers.constants.AddressZero],
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 @@ -98,29 +99,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;
Loading