From af5545dc6a19f46435c8f229982077b87c3ce533 Mon Sep 17 00:00:00 2001 From: Alberto Date: Mon, 14 Oct 2024 16:46:20 +0200 Subject: [PATCH 1/3] feat: forward kwargs to `deploy` --- boa/contracts/vvm/vvm_contract.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/boa/contracts/vvm/vvm_contract.py b/boa/contracts/vvm/vvm_contract.py index 2c028be0..6eedc2b8 100644 --- a/boa/contracts/vvm/vvm_contract.py +++ b/boa/contracts/vvm/vvm_contract.py @@ -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) @@ -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) From 9f49557aa1c3a2d6aac3bf3502c7ed7a40ef49de Mon Sep 17 00:00:00 2001 From: Alberto Date: Mon, 14 Oct 2024 16:46:36 +0200 Subject: [PATCH 2/3] test: forwarding test --- tests/unitary/contracts/vvm/test_vvm.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/unitary/contracts/vvm/test_vvm.py b/tests/unitary/contracts/vvm/test_vvm.py index 6a2da16f..0f98e9ce 100644 --- a/tests/unitary/contracts/vvm/test_vvm.py +++ b/tests/unitary/contracts/vvm/test_vvm.py @@ -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 + From fd1716d130cd68cbe8e7d6d16393d523dcc3697f Mon Sep 17 00:00:00 2001 From: Alberto Date: Mon, 14 Oct 2024 16:50:33 +0200 Subject: [PATCH 3/3] ci: fix linter --- tests/unitary/contracts/vvm/test_vvm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unitary/contracts/vvm/test_vvm.py b/tests/unitary/contracts/vvm/test_vvm.py index 0f98e9ce..3f10106d 100644 --- a/tests/unitary/contracts/vvm/test_vvm.py +++ b/tests/unitary/contracts/vvm/test_vvm.py @@ -38,6 +38,7 @@ 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() @@ -49,4 +50,3 @@ def test_forward_args_on_deploy(): contract = contract_vvm_deployer.deploy(43, override_address=random_addy) assert random_addy == contract.address -