Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow example to work with or without ape-tokens installed #146

Open
fubuloubu opened this issue Oct 21, 2024 · 2 comments
Open

Allow example to work with or without ape-tokens installed #146

fubuloubu opened this issue Oct 21, 2024 · 2 comments

Comments

@fubuloubu
Copy link
Member

from ape_tokens import tokens # type: ignore[import]

do something like:

try:
    # You can use any Ape's extensive array of plugins and tools
    from ape_tokens import tokens
except ImportError:
    # NOTE: Must install tokenlists to use this feature
    tokens = {}

...

YFI = tokens.get("YFI", Contract("<YFI address on mainnet>"))
...
Copy link

linear bot commented Oct 21, 2024

@fubuloubu fubuloubu changed the title Allow exampe to work with or without ape-tokens installed Allow example to work with or without ape-tokens installed Oct 21, 2024
@fubuloubu
Copy link
Member Author

Acceptance criteria:

uv tool install silverback
wget https://raw.githubusercontent.com/ApeWorX/silverback/refs/heads/main/example.py
silverback run example --network ethereum:mainnet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant