question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ABI includes full contract type data

See original GitHub issue

Environment information

  • OS: macOS / linux / win
  • Python Version: x.x.x
  • ape and plugin versions:

macOS python 3.10.4

$ ape --version
# 0.4.1.dev7+g0b4d7bf

$ ape plugins list
# Installed Plugins:
  hardhat      0.4.0
  alchemy      0.4.0
  etherscan    0.4.0
  • Contents of your ape-config.yaml (NOTE: do not post anything private like RPC urls or secrets!):
$ cat ape-config.yaml
# 
plugins:
  - name: etherscan

geth:
  ethereum:
    mainnet:
      uri: http://localhost:9090

What went wrong?

Please include information like:

  • what command you ran
  • the code that caused the failure (see this link for help with formatting code)
  • full output of the error you received

say i do the following:

pool = Contract("0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7")
print(pool.AddLiquidity.abi)

this returns the following:

image

Now, it looks like it just dumps the entire contract abi instead of just the abi for AddLiquidity event. I assume that when one does contract.EventName.abi the returned output should only be for that event and not the whole contract.

Interestingly, it seems to return a shorter event abi if I do the following:

In [50]: print(pool.AddLiquidity.abi.json(indent=4))
{
    "anonymous":false,
    "inputs":[
        {
            "indexed":true,
            "name":"provider",
            "type":"address"
        },
        {
            "indexed":false,
            "name":"token_amounts",
            "type":"uint256[3]"
        },
        {
            "indexed":false,
            "name":"fees",
            "type":"uint256[3]"
        },
        {
            "indexed":false,
            "name":"invariant",
            "type":"uint256"
        },
        {
            "indexed":false,
            "name":"token_supply",
            "type":"uint256"
        }
    ],
    "name":"AddLiquidity",
    "type":"event"
}

Not sure if this is a bug, but I decided to report this any way.

How can it be fixed?

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

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
bout3fiddycommented, Aug 17, 2022

Thanks! I think it was just a dev experience issue for me. I didn’t want my terminal to clutter up. It causes issues when you’re trying to use rich console for displaying exceptions with the state (state is huge because of that full dump that eth-pm gives).

Thanks for looking into it! I’ll let you know if this helps! 😃

1reaction
unparalleled-jscommented, Aug 10, 2022

This PR “fixes” it: https://github.com/ApeWorX/ethpm-types/pull/42

Now, the contract_type will be hidden from the repr and hopefully causes less confusion.

Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Contract ABI Specification — Solidity 0.8.16 documentation
The Contract Application Binary Interface (ABI) is the standard way to interact with contracts in the Ethereum ecosystem, both from outside the blockchain ......
Read more >
What is an ABI? explained - step-by-step beginners guides
The ABI documents these names and types precisely, easily parseable format, doing translations between human-intended method calls and smart-contract ...
Read more >
ABI details - Algorand Developer Portal
The ABI (Application Binary Interface) is a specification that defines the encoding/decoding of data types and a standard for exposing and invoking methods...
Read more >
What is an ABI of a Smart Contract? Examples and Usage
An ABI, or Application Binary Interface, gives smart contracts the ability to communicate and interact with other smart contracts and applications.
Read more >
What is a Smart Contract ABI? Full Guide - Moralis Web3
Basically, a smart contract ABI serves as an agent that enables a Web3 contract to communicate and interact with external apps and other...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found