Skip to content

Commit

Permalink
Merge pull request #37 from pooltogether/pool-2386-deploy-to-ethereum…
Browse files Browse the repository at this point in the history
…-goerli

chore(deployments): deploy on Goerli
  • Loading branch information
PierrickGT authored Aug 17, 2022
2 parents 594b278 + 1acf841 commit f251e3f
Show file tree
Hide file tree
Showing 53 changed files with 12,301 additions and 17,061 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
!/.yarn/plugins
!/.yarn/sdks

yarn-error.log

# Swap the comments on the following lines if you don't wish to use zero-installs
# Documentation here: https://yarnpkg.com/features/zero-installs
#!/.yarn/cache
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ yarn

## New Deployments
```.sh
yarn deploy:rinkeby
yarn deploy:goerli
```

```.sh
Expand All @@ -46,7 +46,7 @@ yarn deploy:optimismkovan
## Acquire Tokens & Tickets

```.sh
yarn disburse rinkeby
yarn disburse goerli
```

```sh
Expand All @@ -62,7 +62,7 @@ yarn disburse optimismkovan
```

```sh
yarn deposit rinkeby
yarn deposit goerli
```

```sh
Expand All @@ -80,7 +80,7 @@ yarn deposit optimismkovan
## Test Deployment Scripts

```.sh
yarn node:rinkeby
yarn node:goerli
```

```.sh
Expand Down
2 changes: 1 addition & 1 deletion contracts.json

Large diffs are not rendered by default.

61 changes: 34 additions & 27 deletions deploy/rinkeby.ts → deploy/goerli.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { dim } from 'chalk';
import { Contract } from 'ethers';
import { DeployResult } from 'hardhat-deploy/types';
import { HardhatRuntimeEnvironment } from 'hardhat/types';

import {
DRAW_BUFFER_CARDINALITY,
PRIZE_DISTRIBUTION_BUFFER_CARDINALITY,
Expand All @@ -10,24 +13,27 @@ import {
import { deployAndLog } from '../src/deployAndLog';
import { setPrizeStrategy } from '../src/setPrizeStrategy';
import { setTicket } from '../src/setTicket';
import { transferOwnership } from '../src/transferOwnership';
import { setManager } from '../src/setManager';
import { initPrizeSplit } from '../src/initPrizeSplit';
import { pushDraw1 } from '../src/pushDraw1';
import { Contract, } from 'ethers';
import { DeployResult } from 'hardhat-deploy/types';
import pushDraw from '../src/pushDraw';

export default async function deployToRinkeby(hardhat: HardhatRuntimeEnvironment) {
if (process.env.DEPLOY === 'v1.1.0.rinkeby') {
dim(`Deploying: Beacon Ethereum Rinkeby`);
export default async function deployToGoerli(hardhat: HardhatRuntimeEnvironment) {
if (process.env.DEPLOY === 'v1.1.0.goerli') {
dim(`Deploying: Ethereum Goerli`);
dim(`Version: 1.1.0`);
} else {
return;
}

const { getNamedAccounts, ethers } = hardhat;

const { deployer, defenderRelayer } = await getNamedAccounts();
const {
deployer,
defenderRelayer,
aUSDC,
aaveIncentivesController,
aaveLendingPoolAddressesProviderRegistry,
} = await getNamedAccounts();

// ===================================================
// Deploy Contracts
Expand All @@ -37,22 +43,30 @@ export default async function deployToRinkeby(hardhat: HardhatRuntimeEnvironment
from: deployer,
args: [
deployer,
'0x6168499c0cFfCaCD319c818142124B7A15E857ab', // VRF Coordinator address
73, // Subscription id
'0xd89b2bf150e3b9e13446986e571fb9cab24b13cea0a43ea20a6049a85cc807cc', // 30 gwei key hash gas lane
'0x2Ca8E0C643bDe4C2E08ab1fA0da3401AdAD7734D', // VRF Coordinator address
10, // Subscription id
'0x79d3d8832d904592c0bf9818b621522c988bb8b0c05cdc3b15aea1b6e8db0c15', // 30 gwei key hash gas lane
],
skipIfAlreadyDeployed: true,
});

const mockYieldSourceResult = await deployAndLog('MockYieldSource', {
const aaveUsdcYieldSourceResult = await deployAndLog('AaveV3YieldSource', {
from: deployer,
args: ['Token', 'TOK', TOKEN_DECIMALS],
args: [
aUSDC,
aaveIncentivesController,
aaveLendingPoolAddressesProviderRegistry,
'PoolTogether aEthUSDC Yield',
'PTaEthUSDCY',
TOKEN_DECIMALS,
deployer,
],
skipIfAlreadyDeployed: true,
});

const yieldSourcePrizePoolResult = await deployAndLog('YieldSourcePrizePool', {
from: deployer,
args: [deployer, mockYieldSourceResult.address],
args: [deployer, aaveUsdcYieldSourceResult.address],
skipIfAlreadyDeployed: true,
});

Expand Down Expand Up @@ -139,7 +153,7 @@ export default async function deployToRinkeby(hardhat: HardhatRuntimeEnvironment
deployer,
drawBufferResult.address,
rngServiceResult.address,
1,
1065, // DrawID, should be 1 if deploying a new pool
parseInt('' + (new Date().getTime() / 1000 - calculatedBeaconPeriodSeconds)),
calculatedBeaconPeriodSeconds,
RNG_TIMEOUT_SECONDS,
Expand Down Expand Up @@ -181,7 +195,11 @@ export default async function deployToRinkeby(hardhat: HardhatRuntimeEnvironment
// Configure Contracts
// ===================================================

await pushDraw1();
await pushDraw(
1065, // DrawID, should be 1 if deploying a new pool
['210329030', 0, '789670970', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
);

await initPrizeSplit();
await setTicket(ticketResult.address);
await setPrizeStrategy(prizeSplitStrategyResult.address);
Expand All @@ -193,15 +211,4 @@ export default async function deployToRinkeby(hardhat: HardhatRuntimeEnvironment
await setManager('DrawCalculatorTimelock', null, beaconTimelockTriggerResult.address);
await setManager('PrizeDistributionFactory', null, beaconTimelockTriggerResult.address);
await setManager('PrizeDistributionBuffer', null, prizeDistributionFactoryResult.address);

await transferOwnership('PrizeDistributionFactory', null, deployer);
await transferOwnership('DrawCalculatorTimelock', null, deployer);
await transferOwnership('PrizeFlush', null, deployer);
await transferOwnership('Reserve', null, deployer);
await transferOwnership('YieldSourcePrizePool', null, deployer);
await transferOwnership('PrizeTierHistory', null, deployer)
await transferOwnership('PrizeSplitStrategy', null, deployer);
await transferOwnership('DrawBuffer', null, deployer);
await transferOwnership('PrizeDistributionBuffer', null, deployer);
await transferOwnership('BeaconTimelockTrigger', null, deployer);
}
1 change: 1 addition & 0 deletions deployments/goerli/.chainId
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5
Loading

0 comments on commit f251e3f

Please sign in to comment.