Skip to content

Commit

Permalink
Merge pull request #19 from pooltogether/pool-2139-avalanche-deploy-r…
Browse files Browse the repository at this point in the history
…ng-chainlink-20-on

feat(deployments): deploy RNGChainlinkV2 on Avalanche
  • Loading branch information
PierrickGT authored Dec 1, 2022
2 parents 04038d9 + e28c76b commit 1a9b3bf
Show file tree
Hide file tree
Showing 9 changed files with 2,877 additions and 2 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,16 @@ Executive team needs to claim ownership of the following contracts:
- RNGChainlinkV2
- DrawBeacon
- BeaconTimelockTrigger

## v1.8.0

Deploy RNGChainlinkV2 on Avalanche and setup DrawBeacon to compute draw onchain.

### Post-Deploy Configuration Changes

#### Avalanche

Executive team needs to claim ownership of the following contracts:
- RNGChainlinkV2
- DrawBeacon
- BeaconTimelockTrigger
2 changes: 1 addition & 1 deletion contracts.json

Large diffs are not rendered by default.

71 changes: 71 additions & 0 deletions deploy/v1.8.0/avalanche.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import { dim } from 'chalk';
import { HardhatRuntimeEnvironment } from 'hardhat/types';

import {
BEACON_PERIOD_SECONDS,
RNG_TIMEOUT_SECONDS,
} from '../../src/constants';
import { deployAndLog } from '../../src/deployAndLog';
import { setManager } from '../../src/setManager';
import { transferOwnership } from '../../src/transferOwnership';

export default async function deployToEthereumMainnet(hardhat: HardhatRuntimeEnvironment){
if (process.env.DEPLOY === 'v1.8.0.avalanche') {
dim(`Deploying: DrawBeacon, RNGChainlinkV2, BeaconTimelockTrigger on Avalanche`)
dim(`Version: 1.8.0`)
} else { return }

const { getNamedAccounts, ethers } = hardhat;
const { getContract } = ethers;

const { deployer, defenderRelayer, executiveTeam } = await getNamedAccounts();

const drawBuffer = await getContract('DrawBuffer');
const drawCalculatorTimelock = await getContract('DrawCalculatorTimelock')
const prizeDistributionFactory = await getContract('PrizeDistributionFactory');

// ===================================================
// Deploy Contracts
// ===================================================

const rngServiceResult = await deployAndLog('RNGChainlinkV2', {
from: deployer,
args: [
deployer,
'0xd5D517aBE5cF79B7e95eC98dB0f0277788aFF634', // VRF Coordinator address
97, // Subscription id
'0x89630569c9567e43c4fe7b1633258df9f2531b62f2352fa721cf3162ee4ecb46', // 500 gwei key hash gas lane
],
skipIfAlreadyDeployed: true,
});

const drawBeaconResult = await deployAndLog('DrawBeacon', {
from: deployer,
args: [
deployer,
drawBuffer.address,
rngServiceResult.address,
413, // Starting DrawID
1669921200, // Dec 1, 2022, 7:00:00 PM UTC
BEACON_PERIOD_SECONDS, // 86400 = one day
RNG_TIMEOUT_SECONDS // 2 * 3600 = 2 hours
],
skipIfAlreadyDeployed: true,
});

await deployAndLog('BeaconTimelockTrigger', {
from: deployer,
args: [
deployer,
prizeDistributionFactory.address,
drawCalculatorTimelock.address
]
});

await setManager('RNGChainlinkV2', null, drawBeaconResult.address);
await setManager('BeaconTimelockTrigger', null, defenderRelayer);

await transferOwnership('RNGChainlinkV2', null, executiveTeam);
await transferOwnership('DrawBeacon', null, executiveTeam);
await transferOwnership('BeaconTimelockTrigger', null, executiveTeam);
}
Loading

0 comments on commit 1a9b3bf

Please sign in to comment.