Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

abigen inline loading of ABI is failing #2678

Closed
IlluvatarEru opened this issue Nov 20, 2023 · 1 comment
Closed

abigen inline loading of ABI is failing #2678

IlluvatarEru opened this issue Nov 20, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@IlluvatarEru
Copy link

IlluvatarEru commented Nov 20, 2023

Version

├── ethers v2.0.11
│   ├── ethers-addressbook v2.0.11
│   │   ├── ethers-core v2.0.11
│   ├── ethers-contract v2.0.11
│   │   ├── ethers-contract-abigen v2.0.11
│   │   │   ├── ethers-core v2.0.11 (*)
│   │   ├── ethers-contract-derive v2.0.11 (proc-macro)
│   │   │   ├── ethers-contract-abigen v2.0.11
│   │   │   │   ├── ethers-core v2.0.11
│   │   │   ├── ethers-core v2.0.11 (*)
│   │   ├── ethers-core v2.0.11 (*)
│   │   ├── ethers-providers v2.0.11
│   │   │   ├── ethers-core v2.0.11 (*)
│   ├── ethers-core v2.0.11 (*)
│   ├── ethers-etherscan v2.0.11
│   │   ├── ethers-core v2.0.11 (*)
│   ├── ethers-middleware v2.0.11
│   │   ├── ethers-contract v2.0.11 (*)
│   │   ├── ethers-core v2.0.11 (*)
│   │   ├── ethers-etherscan v2.0.11 (*)
│   │   ├── ethers-providers v2.0.11 (*)
│   │   ├── ethers-signers v2.0.11
│   │   │   ├── ethers-core v2.0.11 (*)
│   ├── ethers-providers v2.0.11 (*)
│   └── ethers-signers v2.0.11 (*)
├── ethers-contract-abigen v2.0.11 (*)
├── ethers-core v2.0.11 (*)
├── ethers-providers v2.0.11 (*)

Platform
Linux debian-10 5.10.0-21-amd64 #1 SMP Debian 5.10.162-1 (2023-01-21) x86_64 GNU/Linux

Description

I am loading the abi.json directly in line (as shown here) but getting a use of undeclared type IERC20` error when compiling.

I tried this code:

    abigen!(IERC20, "./data/IERC20.json");
    const RPC_URL: &str = "https://eth.llamarpc.com";
    const WETH_ADDRESS: &str = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";

    let provider = Provider::<Http>::try_from(RPC_URL)?;
    let client = Arc::new(provider);
    let address: Address = WETH_ADDRESS.parse()?;
    let contract = IERC20::new(address, client);

I expected to see this happen: being able to load the abi from json and use it to create a new contract instance.

Instead, this happened:use of undeclared type IERC20` error when compiling.

@IlluvatarEru IlluvatarEru added the bug Something isn't working label Nov 20, 2023
@IlluvatarEru IlluvatarEru changed the title Inline abigen loading failing abigen inline loading of ABI is failing Nov 20, 2023
@IlluvatarEru
Copy link
Author

IlluvatarEru commented Nov 20, 2023

Found out that there is an error depending on how is the folder named: I had my abis in /data/ folder and that is failing but works fine if reading from ./abis/. Weird error though

@IlluvatarEru IlluvatarEru closed this as not planned Won't fix, can't repro, duplicate, stale Nov 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant