Skip to content

Latest commit

 

History

History
308 lines (237 loc) · 8.91 KB

DEPLOY_STEPS.md

File metadata and controls

308 lines (237 loc) · 8.91 KB

Networks

The project has been configured to support the following networks. All the deploy scripts will expect network param to know which network the contract deployment / interaction should take place

network
goerli
optimism-mainnet
fantom-mainnet
fantom-testnet
mainnet
fuji-testnet
avalanche-mainnet
mumbai
polygon
zksync-mainnet
zksync-testnet
base
scroll
scroll-sepolia

Project Registry

The section here shows how to set up the project registry for the first time on a given network. Ideally these steps would be done once per chain. In this example, we would be deploying on goerli

  1. Create an .env file
cp ../.env.example ../.env
  1. Create an .env file and fill out

    • INFURA_ID : Infura ID for deploying contract (Get one here)
    • DEPLOYER_PRIVATE_KEY : address which deploys the contract
    • ETHERSCAN_API_KEY : API key for etherscan verification (Get one here)
  2. Deploy the ProjectRegistry contract

pnpm run deploy-project-registry goerli

Program Setup

The section here shows how to set up the program for the first time on a given network. Ideally these steps would be done once per chain. In this example, we would be deploying on goerli

  1. Create an .env file
cp ../.env.example ../.env
  1. Create an .env file and fill out

    • INFURA_ID : Infura ID for deploying contract
    • DEPLOYER_PRIVATE_KEY : address which deploys the contract
    • ETHERSCAN_API_KEY : API key for etherscan verification
  2. Deploy the ProgramFactory contract

pnpm run deploy-program-factory goerli
  1. Deploy the ProgramImplementation contract
pnpm run deploy-program-implementation goerli
  1. Update program.config.ts with deployed contracts based on your network
export const params: DeployParams = {
  goerli: {
    programImplementationContract: 'DEPLOYED_PROGRAM_IMPLEMENTATION_CONTRACT',
    programFactoryContract: 'DEPLOYED_PROGRAM_FACTORY_CONTRACT',
    ...
  },
};
  1. Update ProgramFactory to reference the ProgramImplementation contract.
pnpm run link-program-implementation goerli

VotingStrategy Setup

The section here shows how to set up voting strategy for the first time on a given network. Ideally these steps would be done once per chain. In this example, we would be deploying the QuadraticFundingVotingStrategyImplementation contract on goerli

  1. Create an .env file and fill out

    • INFURA_ID : Infura ID for deploying contract
    • DEPLOYER_PRIVATE_KEY : address which deploys the contract
    • ETHERSCAN_API_KEY : API key for etherscan verification
  2. Deploy the QuadraticFundingVotingStrategyFactory contract

pnpm run deploy-qf-factory goerli
  1. Deploy the QuadraticFundingVotingStrategyImplementation contract
pnpm run deploy-qf-implementation goerli
  1. Update votingStrategy.config.ts with deployed contracts based on your network
export const QFVotingParams: DeployParams = {
  "goerli": {
    factory: 'DEPLOYED_QF_FACTORY_CONTRACT',
    implementation: 'DEPLOYED_QF_IMPLEMENTATION_CONTRACT',
    ...
  },
  ...
};
  1. Update QuadraticFundingVotingStrategyFactory to reference the QuadraticFundingVotingStrategyImplementation contract
pnpm run link-qf-implementation goerli

Merkle PayoutStrategy Setup

The section here shows how to deploy the payout strategy contract. Ideally these would be done before creating a round. In this example, we would be deploying the MerklePayoutStrategy contract on goerli. This would have to be done before creating a round so that round is aware and store a reference to the voting contract during its creation.

  1. Create an .env file and fill out

    • INFURA_ID : Infura ID for deploying contract
    • DEPLOYER_PRIVATE_KEY : address which deploys the contract
    • ETHERSCAN_API_KEY : API key for etherscan verification
  2. Deploy the MerklePayoutStrategyFactory contract

pnpm run deploy-merkle-factory goerli
  1. Deploy the MerklePayoutStrategyImplementation contract
pnpm run deploy-merkle-implementation goerli
  1. Update payoutStrategy.config.ts with deployed contract based on your network
export const MerklePayoutParams: DeployParams = {
  "goerli": {
    factory: 'DEPLOYED_MERKLE_FACTORY_CONTRACT',
    implementation: 'DEPLOYED_MERKLE_IMPLEMENTATION_CONTRACT',
    ...
  },
  ...
};
  1. Update MerklePayoutStrategyFactory to reference the MerklePayoutStrategyImplementation contract
pnpm run link-merkle-implementation goerli

DirectGrants Setup

The section here shows how to deploy the payout strategy contract. Ideally these would be done before creating a round. In this example, we would be deploying the DirectPayoutStrategy contract on goerli. This would have to be done before creating a round so that round is aware and store a reference to the voting contract during its creation.

  1. Create an .env file and fill out

    • INFURA_ID : Infura ID for deploying contract
    • DEPLOYER_PRIVATE_KEY : address which deploys the contract
    • ETHERSCAN_API_KEY : API key for etherscan verification
  2. Deploy the DirectPayoutStrategyFactory contract

pnpm run deploy-direct-factory goerli
  1. Deploy the DirectPayoutStrategyImplementation contract
pnpm run deploy-direct-implementation goerli
  1. Update payoutStrategy.config.ts with deployed contract based on your network
export const DirectPayoutParams: DeployParams = {
  "goerli": {
    factory: 'DEPLOYED_DIRECT_FACTORY_CONTRACT',
    implementation: 'DEPLOYED_DIRECT_IMPLEMENTATION_CONTRACT',
    ...
  },
  ...
};
  1. Link the DirectPayoutStrategyImplementation contract to the DirectPayoutStrategyFactory contract
pnpm run link-direct-implementation goerli

Round Setup

The section here shows how to set up the round manager for the first time on a given network. Ideally these steps would be done once per chain. In this example, we would be deploying on goerli

  1. Create an .env file and fill out

    • INFURA_ID : Infura ID for deploying contract
    • DEPLOYER_PRIVATE_KEY : address which deploys the contract
    • ETHERSCAN_API_KEY : API key for etherscan verification on mainnet / testnet
    • OPTIMISTIC_ETHERSCAN_API_KEY : API key for etherscan verification on optimism mainnet / testnet
  2. Deploy the RoundFactory contract

pnpm run deploy-round-factory goerli
  1. Deploy the RoundImplementation contract
pnpm run deploy-round-implementation goerli
  1. Update round.config.ts with deployed contracts based on your network
export const params: DeployParams = {
  goerli: {
    roundImplementationContract: 'DEPLOYED_ROUND_IMPLEMENTATION_CONTRACT',
    roundFactoryContract: 'DEPLOYED_ROUND_FACTORY_CONTRACT',
    ...
  },
  ...
};
  1. Update RoundFactory to reference the RoundImplementation contract
pnpm run link-round-implementation goerli

Contract Verification on etherscan

pnpm hardhat clean
pnpm hardhat verify --network goerli <CONTRACT_ADDRESS>
Helper Deploy Script
# Program
pnpm run deploy-program-factory goerli
pnpm run deploy-program-implementation goerli
pnpm run link-program-implementation goerli

# QF
pnpm run deploy-qf-factory goerli
pnpm run deploy-qf-implementation goerli
pnpm run link-qf-implementation goerli

# Payout
pnpm run deploy-merkle-factory goerli
pnpm run deploy-merkle-implementation goerli
pnpm run link-merkle-implementation goerli

# direct grants
pnpm run deploy-direct-factory goerli
pnpm run deploy-direct-implementation goerli
pnpm run link-direct-implementation goerli

# AlloSettings
pnpm run deploy-allo-settings goerli
pnpm run set-protocol-fee goerli

# Round
pnpm run deploy-round-factory goerli
pnpm run deploy-round-implementation goerli
pnpm run link-round-implementation goerli
pnpm run link-allo-settings goerli
pnpm run deploy-dummy-voting-strategy goerli

# Project Registry
pnpm run deploy-project-registry goerli

# These scripts would be used to create a test round
pnpm run create-program goerli
pnpm run create-qf-contract goerli
pnpm run create-merkle-contract goerli
pnpm run create-round goerli

zkSync Era Deployment, and Verification

Deployment

npx hardhat run ./scripts/deployZkSync.ts --network zksync-testnet

Verification

yarn hardhat verify --network <network> <contract address> <constructor args>

Check the status of the verification:

yarn hardhat verify-status --verification-id <your verification id>