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

feat: vvm deployer forward kwargs #332

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions boa/contracts/vvm/vvm_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def constructor(self):
return ABIFunction(t, contract_name=self.filename)
return None

def deploy(self, *args, env=None):
def deploy(self, *args, env=None, **kwargs):
encoded_args = b""
if self.constructor is not None:
encoded_args = self.constructor.prepare_calldata(*args)
Expand All @@ -64,7 +64,7 @@ def deploy(self, *args, env=None):
if env is None:
env = Env.get_singleton()

address, _ = env.deploy_code(bytecode=self.bytecode + encoded_args)
address, _ = env.deploy_code(bytecode=self.bytecode + encoded_args, **kwargs)

return self.at(address)

Expand Down
13 changes: 13 additions & 0 deletions tests/unitary/contracts/vvm/test_vvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,16 @@ def test_loads_vvm():

assert contract.foo() == 42
assert contract.bar() == 43


def test_forward_args_on_deploy():
with open(mock_3_10_path) as f:
code = f.read()

contract_vvm_deployer = boa.loads_partial(code)

random_addy = boa.env.generate_address()

contract = contract_vvm_deployer.deploy(43, override_address=random_addy)

assert random_addy == contract.address
Loading