erc20/library.cairo "Transfer" event param "_from" not compatible with Starknet Python testing library
See original GitHub issue📝 Details
with Starkware official testing Python package: starkware/starknet/testing/contract_utils.py line 100, it encodes processed StarknetTransaction with namedtuple. Thus, calling erc20 Transfer with current OZ event signature
@event
func Transfer(_from : felt, to : felt, value : Uint256):
end
will fail with ValueError: Field names cannot start with an underscore: '_from'
🔢 Code to reproduce bug
In Python, try calling Transfer with this pattern
tx = await erc20_contract.transfer(10, dst.contract_address).invoke(src)
given
- erc20_contract = erc20 contract
- src = source account contract
- dst = destination account contract
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Shard-Labs/starknet-hardhat-plugin - GitHub
A plugin for integrating StarkNet tools into Hardhat projects - GitHub ... but will default to 'alphaGoerli' network in case this parameter is...
Read more >Writing unit tests — Cairo documentation - cairo-lang
This page demonstrates how to write unit tests for your StarkNet contracts. The cairo-lang package provides a set of Python classes that simulates...
Read more >Guide - Starknet.py documentation
Using existing contracts . Although it is possible to use Client to interact with contracts, it requires translating python values into Cairo...
Read more >Getting started with OpenZeppelin Contracts for Cairo
Using the library. For this example we'll create an ERC20 token. First, create a MyToken.cairo file and write:.
Read more >Unit tests - Perama's notes.
A contract can be tested before deployment. Below is a contract that stores pen and paper inventory across different warehouses. To test that...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Agree. Luckily argument names are not part of Ethereum’s ABI specification, so it shouldn’t break anything. I’m unsure about the events though.
Let’s go with
from_then.To me, that looks too much like a type name (when compared to
Uint256), but that’s just my opinion.