Skip to content

Commit 03749f3

Browse files
committed
fix: rng deploy script
1 parent a5944f5 commit 03749f3

File tree

5 files changed

+1780
-9
lines changed

5 files changed

+1780
-9
lines changed

contracts/README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ Refresh the list of deployed contracts by running `./scripts/generateDeployments
1212

1313
- [BlockHashRNG](https://arbiscan.io/address/0x39D123fc4cFD24EA5bB76195f9ecFE1f0DF35b0B)
1414
- [ChainlinkRNG](https://arbiscan.io/address/0x897d83a7d5F23555eFA15e1BE297d5503522cbA3)
15-
- [ChainlinkVRFCoordinator](https://arbiscan.io/address/0xf97f4df75117a78c1A5a0DBb814Af92458539FB4)
1615
- [DisputeKitClassicNeo: proxy](https://arbiscan.io/address/0x70B464be85A547144C72485eBa2577E5D3A45421), [implementation](https://arbiscan.io/address/0xAF0325dbBFa812a574743Bb5A085266D31e3e03a)
1716
- [DisputeResolverNeo](https://arbiscan.io/address/0xb5526D022962A1fFf6eD32C93e8b714c901F4323)
1817
- [DisputeTemplateRegistry: proxy](https://arbiscan.io/address/0x0cFBaCA5C72e7Ca5fFABE768E135654fB3F2a5A2), [implementation](https://arbiscan.io/address/0x57EfD43DAfCeb6C58Df57932b2B299f46fef5c87)
@@ -31,7 +30,6 @@ Refresh the list of deployed contracts by running `./scripts/generateDeployments
3130

3231
- [BlockHashRNG](https://sepolia.arbiscan.io/address/0x0298a3EFa6Faf90865725E2b48Cf0F66e5d52754)
3332
- [ChainlinkRNG](https://sepolia.arbiscan.io/address/0xAd5cCc93429e3A977c273cEeD106Ef16A69EAf79)
34-
- [ChainlinkVRFCoordinator](https://sepolia.arbiscan.io/address/0x5CE8D5A2BC84beb22a398CCA51996F7930313D61)
3533
- [DAI](https://sepolia.arbiscan.io/address/0xc34aeFEa232956542C5b2f2EE55fD5c378B35c03)
3634
- [DAIFaucet](https://sepolia.arbiscan.io/address/0x1Fa58B52326488D62A406E71DBaD839560e810fF)
3735
- [DisputeKitClassic: proxy](https://sepolia.arbiscan.io/address/0x0c38f115D001d3b5bBec5e8D44f78C7B61A27D94), [implementation](https://sepolia.arbiscan.io/address/0xDb0B7908C46E2Bb08459bf9b3155b9bb8F8713E1)
@@ -73,7 +71,6 @@ Refresh the list of deployed contracts by running `./scripts/generateDeployments
7371
- [ArbitrableExample](https://sepolia.arbiscan.io/address/0x3Eae72F076c68F5c354C73abC33EAA291ef1b2Fa)
7472
- [BlockHashRNG](https://sepolia.arbiscan.io/address/0x56d6d65Fe202232714794B5D5e4ed9894466Ee01)
7573
- [ChainlinkRNG](https://sepolia.arbiscan.io/address/0x6c40D7F5d5bE3492fe9EF70e4eCb2BD773c12AF8)
76-
- [ChainlinkVRFCoordinator](https://sepolia.arbiscan.io/address/0x5CE8D5A2BC84beb22a398CCA51996F7930313D61)
7774
- [DAI](https://sepolia.arbiscan.io/address/0x593e89704D285B0c3fbF157c7CF2537456CE64b5)
7875
- [DAIFaucet](https://sepolia.arbiscan.io/address/0xB5b39A1bcD2D7097A8824B3cC18Ebd2dFb0D9B5E)
7976
- [DisputeKitClassic: proxy](https://sepolia.arbiscan.io/address/0x9426F127116C3652A262AE1eA48391AC8F44D35b), [implementation](https://sepolia.arbiscan.io/address/0x692CC78F2570181FFB99297965FeAA8352ab12E8)

contracts/deploy/00-chainlink-rng.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const deployRng: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
4848
log: true,
4949
});
5050

51-
const keyHash = getKeyHash({ gasPrice: 150 });
51+
const keyHash = getKeyHash({ gasPrice: 30 });
5252
const subscriptionId = SUBSCRIPTION_ID[chainId];
5353
const requestConfirmations = 200; // between 1 and 200 L2 blocks
5454
const callbackGasLimit = 100000;
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { HardhatRuntimeEnvironment } from "hardhat/types";
2+
import { DeployFunction } from "hardhat-deploy/types";
3+
import { HomeChains, isMainnet, isSkipped } from "./utils";
4+
import { ethers } from "hardhat";
5+
import { ChainlinkRNG, SortitionModule, SortitionModuleNeo } from "../typechain-types";
6+
7+
const task: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
8+
const { getNamedAccounts, getChainId } = hre;
9+
10+
// fallback to hardhat node signers on local network
11+
const deployer = (await getNamedAccounts()).deployer ?? (await hre.ethers.getSigners())[0].address;
12+
const chainId = Number(await getChainId()) as unknown as HomeChains; // Checked at runtime by skip()
13+
console.log("deploying to %s with deployer %s", HomeChains[chainId], deployer);
14+
15+
const chainlinkRng = await ethers.getContract<ChainlinkRNG>("ChainlinkRNG");
16+
17+
let sortitionModule: SortitionModule | SortitionModuleNeo;
18+
if (isMainnet(hre.network)) {
19+
console.log("Using SortitionModuleNeo");
20+
sortitionModule = await ethers.getContract<SortitionModuleNeo>("SortitionModuleNeo");
21+
} else {
22+
console.log("Using SortitionModule");
23+
sortitionModule = await ethers.getContract<SortitionModule>("SortitionModule");
24+
}
25+
26+
console.log(`chainlinkRng.changeSortitionModule(${sortitionModule.target})`);
27+
await chainlinkRng.changeSortitionModule(sortitionModule.target);
28+
29+
console.log(`sortitionModule.changeRandomNumberGenerator(${chainlinkRng.target}, 0)`);
30+
await sortitionModule.changeRandomNumberGenerator(chainlinkRng.target, 0);
31+
};
32+
33+
task.tags = ["ChangeSortitionModuleRNG"];
34+
task.skip = async ({ network }) => {
35+
return isSkipped(network, !HomeChains[network.config.chainId ?? 0]);
36+
};
37+
38+
export default task;

0 commit comments

Comments
 (0)