The fourth video in the Boa Llama Lend Tutorial released today comprise a complete set: all the prerequisites to allow us to do a deeper dive into several different types of liquidations using Curve Llama Lend.
Since these videos cover a lot of ground, particularly the most recent video (which is really two lesson squashed into one to try and speed through to the good stuff), we wanted to aggregate all the information so far from the first four videos in one helpful companion.
As always, drop questions or comments here, as itβs important to have everything set up properly before we can do liquidations correctly!
Curve Llama Lend Titanoboa Tutorial
Companion repository for Curve's YouTube Titanoboa Tutorial
About This Tutorial
This tutorial covers how to launch a memecoin and manage it on Curve Llama Lend using Vyper's Titanoboa.
To complete this course we recommend you have a basic understanding of Vyper, which you can obtain by completing the companion Vyper Tutorial. Each lesson will contain a downloadable Jupyter Notebook. The contents of this repository will also be mirrored at try.vyperlang.org
Main Series
Links
Documentation
Social
Tutorials
Lesson 1: Launch
May 6, 2024: Titanoboa Llama Lend Tutorial
Today weβre pleased to release the first video in an ongoing tutorial series, to be updated periodically at https://github.com/curvefi/boa-tutorial This tutorial covers how to launch a memecoin and manage it on Curve Llama Lend using Vyper's Titanoboa.
The Curve Titanoboa Tutorial covers the management of a memecoin on Curve's permissionless Llama Lend markets.
This lesson shows how to quickly install Titanoboa and quickly deploy a memecoin to Sepolia.
Boa Installation
Installing Titanoboa from PyPI
pip install titanoboa
The latest in-development version of Titanoboa can be installed from GitHub
pip install git+https://github.com/vyperlang/titanoboa
Other Installation Notes
The video launches boa within a Jupyter Notebook in a virtual environment on the local machine.
To create a virtual environment:
virtualenv boa-env
source boa-env/bin/activate
Other librarires installed into the virtual environment
pip install jupyter
pip install snekmate
ERC-20 Token Launch
The ERC20 token launch script in this case is courtesy Charles Cooper via try.vyperlang.org
!pip install -q "git+https://github.com/pcaversaccio/snekmate@modules"
import boa
boa.set_browser_env()
boa.env.set_chain_id(0xaa36a7) # sepolia
from snekmate.tokens import ERC20
my_token = ERC20.deploy("Vyper wif hat", "VWIF", 100_000_000, "", "")
The token is sourced from the snekmate default ERC-20 implementation from snekmate by pcaversaccio
Helpful Links
Github
Other
For more details, consult the Curve Vyper Tutorial:
Lesson 2: Fork
This lesson shows how to fork a live RPC and read from a contract.
FORK
To fork an RPC node
boa.env.fork(RPC_URL)
LOAD CONTRACT FROM BLOCK EXPLORER
Read a contract from a block explorer
boa.from_etherscan(
address: Any,
name=None,
uri='https://api.etherscan.io/api',
api_key=None,
)
INSTALL PYENV (optional)
To install pyenv for managing environment variables
pip install python-dotenv
HELPFUL LINKS
Llama Lend One Way Lending Factory
Misc
Lesson 3: Magic
This lesson shows off the %%vyper
cell magic command that compiles a dummy Vyper price oracle contract into a variable for testing Curve Llama Lend.
VIEW MAGIC COMMANDS
Built-in IPython magic command to list all currently available magic functions
%lsmagic
LOAD CONTRACT FROM BLOCK EXPLORER
The EOA (Externally Owned Account) is the account Titanoboa uses by default for msg.sender
top-level calls and tx.origin
in state-mutating function calls
boa.env.eoa
HELPFUL LINKS
Vyper Code
Documentation
Lesson 4: Blueprint
For our final prerequisite lesson before we get into arb trading, we create a test loan and a healthy Curve liquidity pool to ensure smooth liquidations.
To do so, we often need to interact with contracts that are not yet verified on Etherscan (or in this case, Arbiscan). Curve factories help devs in this process by providing verified implementation contracts. In this lesson we show how to use Titanoboa to quickly reuse these ABIs to load contracts.
We also introduce Titanoboa's prank
function, which allows you to spoof calls from any address
ABI CONTRACT FACTORY
This Titanoboa object represents an ABI contract that has not been coupled with an address yet. This is named Factory
instead of Deployer
because it doesn't actually do any contract deployment.
existing_contract = ABIContractFactory.from_abi_dict(abi, name=name).at(addr)
PRANK
A context manager which temporarily sets eoa and resets it on exit.
>>> import boa
>>> boa.env.eoa
'0x0000000000000000000000000000000000000065'
>>> with boa.env.prank("0x00000000000000000000000000000000000000ff"):
... boa.env.eoa
...
'0x00000000000000000000000000000000000000ff'
>>> boa.env.eoa
'0x0000000000000000000000000000000000000065'
HELPFUL LINKS
Contracts
Documentation