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 at() to be used with both contracts and blueprints #378

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

benber86
Copy link
Contributor

@benber86 benber86 commented Jan 27, 2025

What I did

Allow for the use of at() with blueprint contracts. Currently:

@pytest.fixture
def token_blueprint() -> VyperContract:
    return TokenBlueprint.deploy_as_blueprint()

@pytest.fixture
def token_factory(token_blueprint) -> VyperContract:
    return TokenFactory.deploy(token_blueprint)


def test_deployment(token_factory, token_blueprint):
    token_address = token_factory.deploy_token("Snek", "SNK", 18, "Snek", "1")
    print(f"Token deployed at: {token_address}")
    factory = token_factory.at(token_factory.address) # This will work
    token = token_blueprint.at(token_address) # This will not

Right now token_blueprint.at(token_address) does not work and one would have to use token_blueprint.deployer.at(token_address) which is inconsistent with the behavior of regular VyperContracts.

How I did it

Moved at (which was only in VyperContract) to the _BaseVyperContract class

How to verify it

Description for the changelog

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

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

Successfully merging this pull request may close these issues.

1 participant