Skip to content

Notebooks

Notebooks are easy-to-use notebooks written in Python aiming to showcase the usage of smart contracts and their functionalities. They can be interactively designed and directly run in the browser to make the user experience as easy and smooth as possible.

GitHub

All hosted Jupyter notebooks can also be found in the curve-notebooks repository. A full list of all hosted notebooks can be found here.


Google Colab and JupyterHub

The first notebooks were hosted on a JupyterHub server from Vyper. Due to performance issues, hosting was switched to Google Colab. Old notebooks remain hosted on the JupyterHub server, but all new ones will be hosted on Google Colab.


Vyper and Titanoboa

All Curve Smart Contracts are written in Vyper.

For notebooks, mostly Titanoboa is used. Titanoboa is a Vyper interpreter with pretty tracebacks, forking, debugging features, and more! Titanoboa's goal is to provide a modern, advanced, and integrated development experience for Vyper users.

Notebook: Titanoboa Guide

A very simple notebook on the basic usage of Titanoboa and how it's used throughout all the notebooks can be found here: https://colab.research.google.com/drive/1zHMuvNVZP8oB-Q1dA8NqgGLFpLI2JGni?usp=sharing.


How to run Notebooks

For notebooks hosted on Google Colab, a user only needs to set up two "Secrets." For consistency, all notebooks use a secret named RPC_ETHEREUM for HTTP API keys (e.g., from Alchemy) and a ETHERSCAN_API_KEY secret holding a valid Etherscan API key.

After setting up these two secrets, the notebook can successfully be run directly in the browser.


Notebook List

Curve Lending

Conatract Description Link
Vault Obtaining Vault Shares: deposit and mint here
Vault Withdrawing Assets: withdraw and redeem here
OneWayLendingFactory Changing default borrow rates: set_default_rates here
OneWayLendingFactory Changing implementations: set_implementations here
Controller Creating a simple loan: create_loan here