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

feat(deployments): deploy RNGChainlinkV2 on Avalanche #19

Merged
merged 3 commits into from
Dec 1, 2022

Conversation

PierrickGT
Copy link
Contributor

No description provided.

@linear
Copy link

linear bot commented Dec 1, 2022

POOL-2139 Avalanche: Deploy RNG Chainlink 2.0 on Avalanche

Chainlink VRF 2.0 Docs: https://docs.chain.link/docs/vrf-contracts/

Interface: https://vrf.chain.link/

BLOCKERS

Chainlink VRF 2.0 needs to be deployed on Avalanche.

The Chainlink VRF interface need to be available for the Avalanche network.

TODO

  • Create a subscription through the Chainlink VRF interface

    Screen Shot 2022-02-23 at 5.43.10 PM.png

  • Fund this subscription with LINK tokens

    Screen Shot 2022-02-23 at 5.44.43 PM.png

  • Update the v4-mainnet deployment scripts to deploy the RNG Chainlink v2.0 contract: https://github.com/pooltogether/pooltogether-rng-contracts/blob/master/contracts/RNGChainlinkV2.sol

    • add the following code to deploy/v1.3.0/avalanche.ts

      await deployAndLog('RNGChainlinkV2', {
          from: deployer,
          args: [
      	  deployer,
            0x6168499c0cFfCaCD319c818142124B7A15E857ab, // VRF Coordinator address on Rinkeby
            1, // Id of the subscription that was created through the interface
            0xd89b2bf150e3b9e13446986e571fb9cab24b13cea0a43ea20a6049a85cc807cc, // 30 gwei key hash gas lane for Rinkeby
      		],
          skipIfAlreadyDeployed: true,
        });
      
      await setManager('RNGChainlinkV2', null, drawBeaconResult.address);
      
  • Update the v4-mainnet deployment scripts to deploy the DrawBeacon contract:

    • add the following code to deploy/v1.3.0/avalanche.ts

      const rngService = await ethers.getContract('RNGChainlinkV2');
      
      // Should be in sync with DrawBeacon on Mainnet
      const drawBeaconResult = await deployAndLog('DrawBeacon', {
          from: deployer,
          args: [
            deployer,
            drawBuffer.address,
            rngService.address,
      	  // We can call the getNextDrawId on DrawBeacon Mainnet contract to determine this value.
            1, // Starting DrawID
            // We can call the calculateNextBeaconPeriodStartTimeFromCurrentTime on DrawBeacon Mainnet contract to determine this value.
            BEACON_START_TIME,
            BEACON_PERIOD_SECONDS, // 86400 = one day
            RNG_TIMEOUT_SECONDS // 2 * 3600 = 2 hours
          ],
          skipIfAlreadyDeployed: true,
        });
      
  • Add v1.3.0 commands to test, deploy and verify

  • Test the deployment script: test:v1.3.0.avalanche

  • Run the deployment script: deploy:v1.3.0.avalanche

  • Verify the contract on Snowtrace: avalanche

  • Update the manager on the DrawBuffer contract to be the DrawBeacon contract

  • Set the newly deployed RNG Chainlink V2 contract as a consumer of the Chainlink VRF subscription

    Screen Shot 2022-02-23 at 5.45.31 PM.png

  • Don't forget to release a new version of v4-mainnet package afterwards, this package should include the new deployment artifacts

@PierrickGT PierrickGT merged commit 1a9b3bf into main Dec 1, 2022
@PierrickGT PierrickGT deleted the pool-2139-avalanche-deploy-rng-chainlink-20-on branch December 1, 2022 22:03
@PierrickGT PierrickGT restored the pool-2139-avalanche-deploy-rng-chainlink-20-on branch December 2, 2022 20:06
@PierrickGT PierrickGT deleted the pool-2139-avalanche-deploy-rng-chainlink-20-on branch January 27, 2023 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant