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

Add a CLI tool to deploy the contracts using Foundry #86

Merged
merged 9 commits into from
Apr 9, 2024

Conversation

bpierre
Copy link
Contributor

@bpierre bpierre commented Mar 28, 2024

WIP

This relies on Foundry rather than Hardhat like #83 did.

  • Port utils/deploymentDev.js to a Foundry script
  • Add a CLI tool to deploy the contracts (./deploy)
  • Add a GitHub action that:
    • Deploys the contracts to Tenderly
    • Deploys the app on Vercel (carrying the env vars from deploying the contracts) (will be done in another PR)

deploy can be launched with --help to see its documentation:

$ ./deploy --help

deploy - deploy the Liquity contracts.

Usage:
  ./deploy [NETWORK_PRESET] [OPTIONS]

Arguments:
  NETWORK_PRESET  A network preset, which is a shorthand for setting certain options
                  such as the chain ID and RPC URL. Options take precedence over
                  network presets. Available presets:
                  - local: Deploy to a local network
                  - mainnet: Deploy to the Ethereum mainnet
                  - tenderly-devnet: Deploy to a Tenderly devnet


Options:
  --chain-id <CHAIN_ID>                    Chain ID to deploy to.
  --deployer <DEPLOYER>                    Address or private key to deploy with.
                                           Requires a Ledger if an address is used.
  --ledger-path <LEDGER_PATH>              HD path to use with the Ledger (only used
                                           when DEPLOYER is an address).
  --etherscan-api-key <ETHERSCAN_API_KEY>  Etherscan API key to verify the contracts
                                           (mainnet only).
  --help, -h                               Show this help message.
  --open-demo-troves                       Open demo troves after deployment (local
                                           only).
  --rpc-url <RPC_URL>                      RPC URL to use.
  --verify                                 Verify contracts on Etherscan after
                                           deployment (requires ETHERSCAN_API_KEY).

Note: options can also be set via corresponding environment variables,
e.g. --chain-id can be set via CHAIN_ID instead. Parameters take precedence over
variables.

Usage:

  ./deploy.sh <local | tenderly-devnet | mainnet>

Environment variables (can be set in a .env file):

  CHAIN_ID:           Chain ID to deploy to (optional)
  RPC_URL:            RPC URL to use (optional)
  DEPLOYER:           Address or private key to deploy with (optional with local)
  DEPLOYER_PATH:      HD path to use with the ledger (optional, only used when DEPLOYER is an address)
  ETHERSCAN_API_KEY:  Etherscan API key for contracts verification (mainnet only)
  OPEN_DEMO_TROVES:   Set to 1 to open demo troves after deployment (defaults to 0, local only)
uint256 debt;
}

function openDemoTroves() internal {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will move this part in another script before merging the PR, to separate deployment from demo data.

@bpierre bpierre removed the request for review from bingen March 29, 2024 15:05
@bpierre bpierre reopened this Mar 29, 2024
Copy link
Collaborator

@danielattilasimon danielattilasimon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks all good to me! 👍 👍

I've added some changes on top of the branch to automatically deploy to our testnet, can you give those a look before we merge this? Thanks 🙏

@danielattilasimon danielattilasimon marked this pull request as ready for review April 9, 2024 08:40
Copy link
Contributor Author

@bpierre bpierre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 🔥 🔥

@bpierre bpierre merged commit f260960 into main Apr 9, 2024
6 checks passed
@bpierre bpierre deleted the foundry-deploy-script branch April 9, 2024 09:26
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.

2 participants