ApeWorX / ape-vyper

Vyper compiler plugin for the Ape Framework, using VVM
https://www.apeworx.io/
Apache License 2.0
26 stars 9 forks source link

fix: issue where could not use interfaces #55

Closed antazoey closed 2 years ago

antazoey commented 2 years ago

What I did

fixes: #45

The issue is that vyper does not like the interfaces when they are passed in as source files. It seems to work fine when they are imported and not passed in as source files.

How I did it

How to verify it

Can compile a project with interfaces in it. Can use interfaces in contracts.

Checklist

antazoey commented 2 years ago

Sounds like this is not 100% the solution we want, and we may need to make changes to ape core. Discussions to be had!

Edit: changed it to ignore paths when interfaces is in the base and now things seem to work. Just don't put actual vyper contracts in the <contracts_folder>/interfaces/ folder, which I don't see why you would, so I think this is fine.

antazoey commented 2 years ago

@charles-cooper and @fubuloubu I am wondering your thoughts on this since you know more about the vyper sides of things.

Is this solution okay now, at least for a short term? I don't think any harm could come of it unless you put non-interface material in a folder names interfaces. Does that ever happen?

fubuloubu commented 2 years ago

Is this solution okay now, at least for a short term? I don't think any harm could come of it unless you put non-interface material in a folder names interfaces. Does that ever happen?

This is more of a "framework expectation" sort of thing. Like is anyone else using it in this way? Or using it in a way that directly conflicts with this usage. Brownie had a feature where a separate interfaces folder could be defined that lives outside of the contracts folder, but you can import things in. I think that's the feature people expect. Is there a way to provide this feature in a different way that is a lot easier and less weird/error-prone to use? Worth some research

charles-cooper commented 2 years ago

This is more of a "framework expectation" sort of thing. Like is anyone else using it in this way? Or using it in a way that directly conflicts with this usage. Brownie had a feature where a separate interfaces folder could be defined that lives outside of the contracts folder, but you can import things in. I think that's the feature people expect. Is there a way to provide this feature in a different way that is a lot easier and less weird/error-prone to use? Worth some research

agreed, the vyper does not really know about project layout, it only knows about files.

if i'm understanding correctly, the solution is to segregate compilation - only compile contracts in the contracts/ folder and never those in the interfaces/ folder. this makes sense. vyper interface files are not currently compile-able as standalone contracts, they can only be imported, so @unparalleled-js i think your solution works.

(as an aside, i am redoing how interfaces work in vyper, so we may need to revisit this at some point in the future)