Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Pydantic support for smart contracts #147

Open
James4Ever0 opened this issue Feb 13, 2024 · 2 comments
Open

Feature Request: Pydantic support for smart contracts #147

James4Ever0 opened this issue Feb 13, 2024 · 2 comments

Comments

@James4Ever0
Copy link

James4Ever0 commented Feb 13, 2024

Overview

I am trying to let Boa have a type safe interface for smart contracts.

I want to generate a Pydantic compatible interface for interacting with smart contracts, into a portable Python script, so people can use that script to get type hints while using IDE.

Boa currently only provides an interactive environment, no Python APIs generated.

Specification

I want to generate APIs via the contract ABIs. If possible, just parse the Vyper code and generate compatible API Python code.

It will first generate all used data structures for each contract, for passing into the contract methods.

Contracts are transformed into Python classes.

FInally these Python API code will be stored into a folder like structure, installable and callable from external Python code.

Dependencies

Pydantic: the data validator

@charles-cooper
Copy link
Member

titanoboa works with vyper contracts, not solidity

@James4Ever0
Copy link
Author

James4Ever0 commented Apr 23, 2024

Titanoboa allows importing contract via ABI and that enables resolving both Vyper and Solidity contracts.

import boa
filename = "foo.json"
boa.load_abi(src, name="Foo")

I mean something like TypeChain in Python. I made my own attempt available as Pytract.

Also I want to have a history-free blockchain-free storage efficient stateful persistent EVM-like system locally without any gas fee and deployment fee, to empower my local accounting system. I am doing both pure Python solution and EVM emulation based solution. I believe a centralized typed Web3-like environment is a good and cheap starting point for every Web2 developer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants