Skip to content

Commit

Permalink
feat: vvm deployer forward kwargs (#332)
Browse files Browse the repository at this point in the history
* feat: forward kwargs to `deploy`

* test: forwarding test

* ci: fix linter
  • Loading branch information
AlbertoCentonze authored Oct 14, 2024
1 parent bedd49e commit a52c79c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
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

0 comments on commit a52c79c

Please sign in to comment.