vyperlang / vyper

Pythonic Smart Contract Language for the EVM
https://vyperlang.org
Other
4.9k stars 801 forks source link

VIP: Add support for loading interfaces via IPFS #2297

Open fubuloubu opened 3 years ago

fubuloubu commented 3 years ago

Simple Summary

Allow loading interfaces (either JSON ABI or EthPM v3 contract types) from IPFS

Motivation

Vyper has limited support for importing custom interfaces from external files, which is a helpful method of code de-duplication. However, this feature is hard to use, especially with code verification utilities such as Etherscan. Since IPFS is a widely-supported data sharing protocol in the Web3 ecosystem, we can leverage this fact to make development and verification much easier with external interfaces, leveraging hash-based identifiers to lock the imported code version and make compilation more dependable.

Specification

# JSON ABI e.g. `{ "abi": [ ... ] }`
import ipfs.Qm....A21d  as MyInterface  # must rename from CID

# EthPM Package Manifest (v3)
from ipfs.Qm....b34C import ContractType # can rename `ContractType as MyInterface`

Errors

Backwards Compatibility

This feature is backwards compatible

Dependencies

No dependencies

References

https://web3py.readthedocs.io/en/stable/ethpm.html

Copyright

Copyright and related rights waived via CC0

fubuloubu commented 3 years ago

Idea: instead of introducing the full IPFS client, have it just reference the cache folder from IPFS

fubuloubu commented 2 years ago

Using https://github.com/ApeWorX/ethpm-types might be way nicer!