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

ModuleNotFound:interfaces.IERC20Permit - Ape, Vyper & Snekmate #125

Closed tloriato closed 1 month ago

tloriato commented 1 month ago

Environment information

$ ape --version
0.8.9

$ ape plugins list
Installed Plugins
  alchemy      0.8.0
  ens          0.8.0
  etherscan    0.8.2
  foundry      0.8.0
  hardhat      0.8.0
  infura       0.8.0
  solidity     0.8.2
  template     0.8.0
  tokens       0.8.0
  vyper        0.8.3
$ cat ape-config.yaml
name: boilerplate
solidity:
  version: 0.8.1
test:
  mnemonic: test test test test test test test test test test test junk
  number_of_accounts: 5

What went wrong?

I'm terribly sorry to be opening an issue, but I have exhausted Google and hit a wall 2 hours ago.

I have a boilerplate Ape framework created with ape init and the necessary plugins to run Vyper. I can successfully compile examples of Vyper copied-and-paste from the official documentation. My ape-config.yaml is extremely simple with just the solidity: version: 0.8.1

I installed snekmate with the suggested pip method via pip install snekmate.

I'm trying to create a test ERC20 to validate my development setup. The ERC20.vy inside the /contracts folder is:

# pragma version ~=0.4.0
from snekmate.auth import ownable
from snekmate.tokens import erc20

initializes: ownable
initializes: erc20[ownable := ownable]

@deploy
def __init__(_name: String[25]):
    ownable.__init__()
    erc20.__init__(_name, "ERC20", 18, "name", "name2")

When running ape compile I ge thte following:

ERROR: 'interfaces' may not be installed. Could not find it in Ape dependencies or Python's site-packages. Error: Package 'interfaces' not found in site-packages.
ERROR: 'interfaces' may not be installed. Could not find it in Ape dependencies or Python's site-packages. Error: Package 'interfaces' not found in site-packages.
INFO: Compiling using Vyper compiler '0.4.0'.
Input:
        contracts/ERC20.vy
        [...stack-traces...]
ERROR: (CompilerError) contracts/ERC20.vy
ModuleNotFound:interfaces.IERC20Permit

  contract ".venv/lib/python3.10/site-packages/snekmate/tokens/erc20.vy:69", line 69:0 
       68 # syntax.
  ---> 69 import interfaces.IERC20Permit as IERC20Permit
  --------^
       70 implements: IERC20Permit

I'm not sure what I'm doing wrong. I'm uploading this "boilerplate" struct to a personal repository for easiness.

The issue was raised on the snekmate repository first but I was instructed to come here: https://github.com/pcaversaccio/snekmate/issues/262

Code example to reproduce the issue:

(careful not using python virtual environments!)

git clone https://github.com/tloriato/ape-boilerplate
cd ape-boilerplate

pip install requirements.txt
ape compile
linear[bot] commented 1 month ago

APE-1786 ModuleNotFound:interfaces.IERC20Permit - Ape, Vyper & Snekmate

linear[bot] commented 1 month ago

APE-1787 ModuleNotFound:interfaces.IERC20Permit - Ape, Vyper & Snekmate

fubuloubu commented 1 month ago

@tloriato sorry for one more transfer, but yes the vyper plugin does not currently compile .vyi interfaces e.g. https://github.com/pcaversaccio/snekmate/blob/main/src/snekmate/tokens/interfaces/IERC20Permit.vyi

Easy fix, will get someone on that

fubuloubu commented 1 month ago

@tloriato can you confirm if ape-vyper is at least v0.8.1 with ape plugins list?

tloriato commented 1 month ago

@fubuloubu Yes, it's vyper 0.8.3. I'm available now to join any discord or anything that might happen.

No worries about the transfer, thank you very much for the attention and I'm sorry for the delay in answering.

Easy fix, will get someone on that

I wouldn't know where to start yet, otherwise I would try. Sorry!

fubuloubu commented 1 month ago

@dtdang is looking at it, connect in discord to see if you can debug?

dtdang commented 1 month ago

@tloriato The PR linked should fix the issue if you would like to test it out and make sure it also works on your end.

antazoey commented 1 month ago

@tloriato sorry for one more transfer, but yes the vyper plugin does not currently compile .vyi interfaces e.g.

This isn't true, we added support for .vyi files at the same time as Vyper 0.4 support.

antazoey commented 1 month ago

Ape 0.8 uses the root project path as the base path, and you can import from there. So if interfaces/ is within contracts/, you import like

from contracts.interfaces import