Skip to content

Conversation

@lucas2brh
Copy link
Collaborator

@lucas2brh lucas2brh commented Aug 7, 2025

Description

  • Add the 3rd test wallet to be the receiver
  • Add comprehensive test coverage for WIP token approval && tranferFrom functionality
  • Add negative cases for WIPTransfer
    • transfer to ZEROADDRESS
    • transfer to WIP

Test

All tests passed on my MAC.

Related Issue

Close #83

@lucas2brh lucas2brh marked this pull request as ready for review August 7, 2025 19:06
- Add the 3rd test wallet to be the receiver
- Add comprehensive test coverage for WIP token approval functionality
- Add integration tests for transferFrom with various scenarios (basic, insufficient allowance, insufficient balance, invalid inputs)
- Fix import issue with wallet_address_3 in setup_for_integration.py
return {"tx_hash": response["tx_hash"]}

except Exception as e:
raise ValueError(f"Failed to withdraw WIP: {str(e)}")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why need to remove the prefix? The prefix can give a detail on which method fails.

if sender_wip_before < transfer_amount:
story_client.WIP.deposit(
amount=transfer_amount - sender_wip_before,
tx_options={"waitForTransaction": True},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Python SDK doesn't have an option for waitForTransaction.

with pytest.raises(Exception) as exc_info:
story_client.WIP.transfer(
to=contract_address,
amount=web3.to_wei("0.01", "ether"),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a large amount, could we consider a small amount? Because it will spend many native token when it run.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

web3.to_wei("0.01", "ether") =1 wei

pass

def teardown_method(self):
"""Teardown method called after each test"""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use fixture instead of setup_method and teardown_method methods?

@lucas2brh lucas2brh merged commit a85ad9b into storyprotocol:main Sep 5, 2025
4 checks passed
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.

Add integration test for WIP’s transfer_from & approve

2 participants