Skip to content

Commit 5cbb2d0

Browse files
committed
feat: dispute fees payable in erc20
1 parent 00b01f2 commit 5cbb2d0

File tree

9 files changed

+850
-103
lines changed

9 files changed

+850
-103
lines changed

contracts/deploy/00-home-chain-arbitration.ts

Lines changed: 54 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ const randomizerByChain = new Map<HomeChains, string>([
2020
[HomeChains.ARBITRUM_GOERLI, "0x923096Da90a3b60eb7E12723fA2E1547BA9236Bc"],
2121
]);
2222

23+
const daiByChain = new Map<HomeChains, string>([[HomeChains.ARBITRUM_ONE, "??"]]);
24+
const wethByChain = new Map<HomeChains, string>([[HomeChains.ARBITRUM_ONE, "??"]]);
25+
2326
const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
2427
const { ethers, deployments, getNamedAccounts, getChainId } = hre;
2528
const { deploy, execute } = deployments;
@@ -31,26 +34,26 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment)
3134
const chainId = Number(await getChainId());
3235
console.log("Deploying to %s with deployer %s", HomeChains[chainId], deployer);
3336

34-
if (chainId === HomeChains.HARDHAT) {
35-
pnkByChain.set(
36-
HomeChains.HARDHAT,
37-
(
38-
await deploy("PNK", {
39-
from: deployer,
40-
log: true,
41-
})
42-
).address
43-
);
44-
randomizerByChain.set(
45-
HomeChains.HARDHAT,
46-
(
47-
await deploy("RandomizerMock", {
48-
from: deployer,
49-
args: [],
50-
log: true,
51-
})
52-
).address
53-
);
37+
if (!pnkByChain.get(chainId)) {
38+
const erc20Address = await deployERC20(hre, deployer, "PNK");
39+
pnkByChain.set(HomeChains[HomeChains[chainId]], erc20Address);
40+
}
41+
if (!daiByChain.get(chainId)) {
42+
const erc20Address = await deployERC20(hre, deployer, "DAI");
43+
daiByChain.set(HomeChains[HomeChains[chainId]], erc20Address);
44+
}
45+
if (!wethByChain.get(chainId)) {
46+
const erc20Address = await deployERC20(hre, deployer, "WETH");
47+
wethByChain.set(HomeChains[HomeChains[chainId]], erc20Address);
48+
}
49+
50+
if (!randomizerByChain.get(chainId)) {
51+
const randomizerMock = await deploy("RandomizerMock", {
52+
from: deployer,
53+
args: [],
54+
log: true,
55+
});
56+
randomizerByChain.set(HomeChains[HomeChains[chainId]], randomizerMock.address);
5457
}
5558

5659
await deploy("PolicyRegistry", {
@@ -83,6 +86,8 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment)
8386
});
8487

8588
const pnk = pnkByChain.get(chainId) ?? AddressZero;
89+
const dai = daiByChain.get(chainId) ?? AddressZero;
90+
const weth = wethByChain.get(chainId) ?? AddressZero;
8691
const minStake = BigNumber.from(10).pow(20).mul(2);
8792
const alpha = 10000;
8893
const feeForJuror = BigNumber.from(10).pow(17);
@@ -108,6 +113,23 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment)
108113
await execute("DisputeKitClassic", { from: deployer, log: true }, "changeCore", klerosCore.address);
109114
}
110115

116+
await execute(
117+
"KlerosCore",
118+
{ from: deployer, log: true },
119+
"changeAcceptedFeeTokens",
120+
[pnk, dai, weth],
121+
[true, true, true]
122+
);
123+
124+
await execute(
125+
"KlerosCore",
126+
{ from: deployer, log: true },
127+
"changeCurrencyRates",
128+
[pnk, dai, weth],
129+
[12225583, 60327783, 1],
130+
[12, 11, 1]
131+
);
132+
111133
await deploy("DisputeResolver", {
112134
from: deployer,
113135
args: [klerosCore.address],
@@ -121,4 +143,16 @@ deployArbitration.skip = async ({ getChainId }) => {
121143
return !HomeChains[chainId];
122144
};
123145

146+
const deployERC20 = async (hre: HardhatRuntimeEnvironment, deployer: string, ticker: string) => {
147+
const { deploy } = hre.deployments;
148+
const erc20 = await deploy(ticker, {
149+
from: deployer,
150+
contract: "TestERC20",
151+
args: [ticker, ticker],
152+
log: true,
153+
});
154+
console.log("Deployed %s at %s", ticker, erc20.address);
155+
return erc20.address;
156+
};
157+
124158
export default deployArbitration;

0 commit comments

Comments
 (0)