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
CID is not valid
file specified by the CID cannot be found, or it fails to load after 30 seconds
file loaded by the CID is not in one of the accepted formats (JSON ABI or EthPM v3 Package Manifest)
JSON ABI is used, and the import is not renamed from the CID
EthPM v3 Manifest is used, and ContractType is not one of the available contract types (containing a valid ABI)
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
Errors
ContractType
is not one of the available contract types (containing a valid ABI)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