ApeWorX / ape

The smart contract development tool for Pythonistas, Data Scientists, and Security Professionals
https://apeworx.io
Apache License 2.0
887 stars 131 forks source link

Contract types from dependencies cannot be used out of the box #468

Closed fubuloubu closed 2 years ago

fubuloubu commented 2 years ago

What went wrong?

Project dependencies cannot access their contract types as ContractContainer instances (necessary to deploy them)

In [1]: type(project.dependencies["erc4626"].Vault)
Out[1]: ethpm_types.contract_type.ContractType

In [2]: type(project.Portfolio)
Out[2]: ape.contracts.base.ContractContainer

which gives me this error:

>       return sudo.deploy(project.dependencies["erc4626"].Token)
E       TypeError: 'ContractType' object is not callable

How can it be fixed?

I think because project.dependencies is a dict to manifest contents, and not Projects

potential idea: have projects load from ProjectAPI and then convert to manifest, add class method ApeProject.from_manifest that expands a project from a manifest file, so that it can be maximally useful inside of your local project.

fubuloubu commented 2 years ago

@unparalleled-js is this one solved?