Skip to content

Commit 2059c31

Browse files
committed
fix: get_erc20_balance method to Foundry
1 parent f92b421 commit 2059c31

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

tests-functional/clients/foundry.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,11 @@ def generate_tokens(self, controller_address, to_address, token_amount, private_
200200
)
201201
result = self.container.exec_run(generate_cmd)
202202
return result
203+
204+
def get_erc20_balance(self, token_address, owner_address):
205+
if not self.container:
206+
raise Exception("Container not found")
207+
208+
balance_cmd = f"cast call {token_address} 'balanceOf(address)' {owner_address} --rpc-url http://anvil:8545"
209+
result = self.container.exec_run(balance_cmd)
210+
return result

tests-functional/tests/test_wakuext_community_token_permissions.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,7 @@ def test_membership_with_valid_tokens(self, foundry_client):
110110
member_address = accounts[0]["address"] if accounts else self.fake_address
111111

112112
# Verify the balance directly with cast
113-
balance_cmd = f"cast call {self.snt_address} 'balanceOf(address)' {member_address} --rpc-url http://anvil:8545"
114-
balance_result = foundry_client.container.exec_run(balance_cmd)
113+
balance_result = foundry_client.get_erc20_balance(self.snt_address, member_address)
115114
logger.debug(f"SNT balance check: exit_code={balance_result.exit_code}, output={balance_result.output.decode()}")
116115

117116
token_address = self.snt_address
@@ -174,8 +173,7 @@ def test_admin_token_permissions_with_valid_tokens(self, foundry_client):
174173
member_address = accounts[0]["address"] if accounts else self.fake_address
175174

176175
# Verify the balance directly with cast
177-
balance_cmd = f"cast call {self.snt_address} 'balanceOf(address)' {member_address} --rpc-url http://anvil:8545"
178-
balance_result = foundry_client.container.exec_run(balance_cmd)
176+
balance_result = foundry_client.get_erc20_balance(self.snt_address, member_address)
179177
logger.debug(f"SNT balance check: exit_code={balance_result.exit_code}, output={balance_result.output.decode()}")
180178

181179
# Owner creates token-gated community with admin permission

0 commit comments

Comments
 (0)