Request form
Cyfrin F23 / foundry-upgrades-f23
    Docs
    Source
    ChefGPT

    Cyfrin Foundry-23 implementation of the Universal Upgradeable Proxy Standard.

    test.sol
    Base.sol
    Script.sol
    StdAssertions.sol
    StdChains.sol
    StdCheats.sol
    StdError.sol
    StdInvariant.sol
    StdJson.sol
    StdMath.sol
    StdStorage.sol
    StdStyle.sol
    StdUtils.sol
    Test.sol
    Vm.sol
    console.sol
    console2.sol
    IMulticall3.sol
    DevOpsTools.sol
    IERC1967.sol
    draft-IERC1822.sol
    ERC1967Proxy.sol
    ERC1967Upgrade.sol
    Proxy.sol
    IBeacon.sol
    Address.sol
    StorageSlot.sol
    OwnableUpgradeable.sol
    IERC1967Upgradeable.sol
    draft-IERC1822Upgradeable.sol
    ERC1967UpgradeUpgradeable.sol
    IBeaconUpgradeable.sol
    Initializable.sol
    UUPSUpgradeable.sol
    AddressUpgradeable.sol
    ContextUpgradeable.sol
    StorageSlotUpgradeable.sol
    DeployBox.s.sol
    UpgradeBox.s.sol
    BoxV1.sol
    BoxV2.sol
    DelegateCallExample.sol
    SmallProxy.sol
    DeployAndUpgradeTest.t.sol

    11 downloads

    Chains

    Authors

    Cyfrin F23 / foundry-upgrades-f23
      Info
      Source
      ChefGPT
      Expand
      Share

      Get Cookin'

      11 downloads

      Authors

      Foundry UUPS Upgradeable Contracts

      This is a section of the Cyfrin Foundry Solidity Course.

      ⭐️ (4:47:00) | Lesson 13: Foundry Upgradable Contracts

      *This is for demo purposes only. Upgradeable contracts are a menance and in general should be avoided for

      Getting Started

      Requirements

      • git
        • You'll know you did it right if you can run git --version and you see a response like git version x.x.x
      • foundry
        • You'll know you did it right if you can run forge --version and you see a response like forge 0.2.0 (816e00b 2023-03-16T00:05:26.396218Z)

      Quickstart

      git clone https://github.com/Cyfrin/foundry-upgrades-f23
      cd foundry-upgrades-f23
      forge build
      

      Optional Gitpod

      If you can't or don't want to run and install locally, you can work with this repo in Gitpod. If you do this, you can skip the clone this repo part.

      Open in Gitpod

      Usage

      Start a local node

      make anvil
      

      Deploy

      This will default to your local node. You need to have it running in another terminal in order for it to deploy.

      make deploy
      

      Deploy - Other Network

      See below

      Testing

      forge test
      

      Test Coverage

      forge coverage
      

      and for coverage based testing:

      forge coverage --report debug
      

      Deployment to a testnet or mainnet

      1. Setup environment variables

      You'll want to set your SEPOLIA_RPC_URL and PRIVATE_KEY as environment variables. You can add them to a .env file, similar to what you see in .env.example.

      • PRIVATE_KEY: The private key of your account (like from metamask). NOTE: FOR DEVELOPMENT, PLEASE USE A KEY THAT DOESN'T HAVE ANY REAL FUNDS ASSOCIATED WITH IT.
      • SEPOLIA_RPC_URL: This is url of the goerli testnet node you're working with. You can get setup with one for free from Alchemy

      Optionally, add your ETHERSCAN_API_KEY if you want to verify your contract on Etherscan.

      1. Get testnet ETH

      Head over to faucets.chain.link and get some tesnet ETH. You should see the ETH show up in your metamask.

      1. Deploy
      make deploy ARGS="--network sepolia"
      

      Estimate gas

      You can estimate how much gas things cost by running:

      forge snapshot
      

      And you'll see and output file called .gas-snapshot

      Formatting

      To run code formatting:

      forge fmt
      

      Thank you!

      If you appreciated this, feel free to follow me or donate!

      ETH/Arbitrum/Optimism/Polygon/etc Address: 0x9680201d9c93d65a3603d2088d125e955c73BD65

      Patrick Collins Twitter Patrick Collins YouTube Patrick Collins Linkedin Patrick Collins Medium

      Cyfrin Foundry-23 implementation of the Universal Upgradeable Proxy Standard.
      test.sol
      Base.sol
      Script.sol
      StdAssertions.sol
      StdChains.sol
      StdCheats.sol
      StdError.sol
      StdInvariant.sol
      StdJson.sol
      StdMath.sol
      StdStorage.sol
      StdStyle.sol
      StdUtils.sol
      Test.sol
      Vm.sol
      console.sol
      console2.sol
      IMulticall3.sol
      DevOpsTools.sol
      IERC1967.sol
      draft-IERC1822.sol
      ERC1967Proxy.sol
      ERC1967Upgrade.sol
      Proxy.sol
      IBeacon.sol
      Address.sol
      StorageSlot.sol
      OwnableUpgradeable.sol
      IERC1967Upgradeable.sol
      draft-IERC1822Upgradeable.sol
      ERC1967UpgradeUpgradeable.sol
      IBeaconUpgradeable.sol
      Initializable.sol
      UUPSUpgradeable.sol
      AddressUpgradeable.sol
      ContextUpgradeable.sol
      StorageSlotUpgradeable.sol
      DeployBox.s.sol
      UpgradeBox.s.sol
      BoxV1.sol
      BoxV2.sol
      DelegateCallExample.sol
      SmallProxy.sol
      DeployAndUpgradeTest.t.sol