Skip to content

MetaRegistry: Overview

The MetaRegistry functions as a Curve Finance Pool Registry Aggregator and offers an on-chain API for various properties of Curve pools by consolidating different registries into a single contract.

This is done by integrating multiple ChildRegistries, each accompanied by a RegistryHandler. This handler acts as a wrapper around its respective ChildRegistry, ensuring compatibility with the MetaRegistry's ABI standards.

Contract Source & Deployment

Currently, a MetaRegistry does only exist on Ethereum. Source code is available on Github.
The MetaRegistry contract is deployed to the Ethereum mainnet at: 0xF98B45FA17DE75FB1aD0e7aFD971b0ca00e379fC.

flowchart BT
    mr[(MetaRegistry)]
    cr1(ChildRegistry) -.- rh1([RegistryHandler])
    cr2(ChildRegistry) -.- rh2([RegistryHandler])
    cr3(ChildRegistry) -.- rh3([RegistryHandler])
    rh1 -.-> mr
    rh2 -.-> mr
    rh3 -.-> mr

Info

If a ChildRegistry already meets these standards, it doesn't require a handler. Nonetheless, wrappers can be useful for hotfixing bugs in production, especially when direct modifications to the ChildRegistry would lead to significant breaking changes.

Description Registry Handler Child Registry
Curve Registry for v1 0x46a8a9CF4Fc8e99EC3A14558ACABC1D93A27de68 0x90E00ACe148ca3b23Ac1bC8C240C2a7Dd9c2d7f5
Curve Registry for v1 (latest) 0x127db66E7F0b16470Bec194d0f496F9Fa065d0A9 0xB9fC157394Af804a3578134A6585C0dc9cc990d4
Curve Registry for v2 Crypto 0x5f493fEE8D67D3AE3bA730827B34126CFcA0ae94 0x9a32aF1A11D9c937aEa61A3790C2983257eA8Bc0
Curve Registry for v2 Factory 0xC4F389020002396143B863F6325aA6ae481D19CE 0xF18056Bbd320E96A48e3Fbf8bC061322531aac99
crvUSD Pool Registry 0x538E984C2d5f821d51932dd9C570Dff192D3DF2D 0x4F8846Ae9380B90d2E71D5e3D042dff3E7ebb40d
Curve Tricrypto Factory 0x30a4249C42be05215b6063691949710592859697 0x0c0e5f2fF0ff18a3be9b835635039256dC4B4963
Curve BasePool Registry 0xDE3eAD9B2145bBA2EB74007e58ED07308716B725

These registry handlers are then added to the MetaRegistry using the add_registry_handler function, see here.

Who should use the MetaRegistry?

Integrators often find it challenging to incorporate a protocol into their dapp when multiple on-chain registries are stored in separate contracts. They lack intrinsic, protocol-level knowledge to handle edge cases and onboard various registries. A single source that aggregates all registries can simplify integrations significantly.

If you're an integrator looking to integrate Curve, the MetaRegistry is an invaluable resource.

Setup

Set up the python environment using the following steps: Please visit Github for more details.

> python -m venv venv
> source ./venv/bin/active
> pip install --upgrade pip
> pip install -r ./requirements.txt

This project uses eth-ape >= 0.5.2 developed at Apeworx. The various plugins used are:

  • ape-vyper
  • ape-hardhat
  • ape-alchemy
  • ape-ledger
  • ape-etherscan

To install these, please follow the instructions in their respective Github repositories.

Note

If you choose to run tests using Alchemy as the upstream provider, please set up an Alchemy API key into an environment variable labeled WEB3_ALCHEMY_PROJECT_ID or WEB3_ALCHEMY_API_KEY. If you use a local node (geth or erigon), please change the hardhat upstream provider for mainnet-fork to geth in ape-config.yaml:

hardhat:
    port: auto
    fork:
        ethereum:
            mainnet:
                upstream_provider: geth
                # upstream_provider: alchemy

Testing

To run tests in interactive mode, please do the following:

> ape test -I -s

Deployment

First, set up your account in Ape. If you're using an EOA that is a cold wallet, do:

> ape accounts import <alias>

This will prompt you for a private key. If your account is a ledger account, then follow:

> ape ledger add <alias>

To deploy, please use the following command (example deployment in mainnet-fork):

> ape run scripts/deploy.py main --network ethereum:mainnet-fork --account <your_account>