ApeWorX / ape

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

APE doesn't handle lists #376

Closed SwapOperator closed 2 years ago

SwapOperator commented 2 years ago

Environment information

$ ape --version

0.1.0b1

$ ape plugins list

Installed Plugins:
  etherscan     0.1.0a2
  hardhat     0.1.0a3
  alchemy     0.1.0a1
  vyper     0.1.0a8
  infura     0.1.0a4

What went wrong?

I have tested my contract func that works with lists and got error. Func Example:

def foo(_tokens: address[25]) -> bool:

Token list and testing func:

tokens = [token1, token2, token3, token4, ZERO_ADDRESS, ZERO_ADDRESS,ZERO_ADDRESS...] 
assert deployer.foo(tokens, sender=owner)

Error:

eth_abi.exceptions.EncodingTypeError: Value `<Token 0x6418E...`  of type <class 'ape.contracts.base.ContractInstance'> cannot be encoded by AddressEncoder

Please include information like:

How can it be fixed?

Fill this in if you have ideas on how the bug could be fixed.

fubuloubu commented 2 years ago

@SwapOperator sorry it took so long, we fixed a host of other conversion issues now too!

SwapOperator commented 2 years ago

@SwapOperator sorry it took so long, we fixed a host of other conversion issues now too!

Super cool! I should update my version :)

fubuloubu commented 2 years ago

@SwapOperator sorry it took so long, we fixed a host of other conversion issues now too!

Super cool! I should update my version :)

Newest version not released yet! You can try installing from main if you like though

$ pip install git+https://github.com/ApeWorX/ape.git@main