Intro

This section will cover how to interact with Notional V3 contracts using ETH brownie a Python-based development and testing framework.

Contract Github repository

Notional's V3 smart contracts repository can be found here.

Setup

Here is a simple setup to start interacting with Notional V3 using ETH brownie:
import json
from brownie import (
accounts,
interface
)
from brownie.network.state import Chain
import eth_abi
class V3Environment:
def __init__(self):
self.notional = interface.NotionalProxy("0x1344A36A1B56144C3Bc62E7757377D288fDE0369")
self.owner = self.notional.owner()
def main():
env = V3Environment()
env.chain = Chain()
env.notional.address

Contract approval

To interact with the protocol using ERC-20 tokens, accounts must approve Notional's Proxy.
# Approve sending an unlimited amount of DAI to the Notional Proxy.
interface.ERC20(currencyAddress).approve(notional.address, 2**255, {'from': account})