Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: dualVMToken starknet functions #1421

Merged
merged 9 commits into from
Sep 24, 2024

Conversation

obatirou
Copy link
Collaborator

@obatirou obatirou commented Sep 18, 2024

Time spent on this PR:

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Resolves #1417

What is the new behavior?

  • add tests
  • interact directly with starknet address with DualVMToken

This change is Reviewable

@obatirou obatirou marked this pull request as ready for review September 18, 2024 14:24
enitrat
enitrat previously approved these changes Sep 19, 2024
enitrat
enitrat previously approved these changes Sep 20, 2024
@ClementWalter
Copy link
Member

ClementWalter commented Sep 23, 2024

So tl;dr after irl comments

  • use overloading and decided if it's starknet or EVM based on type: address <> EVM and uint256 <> Starknet
  • update the _wrap_kakarot util to use function selector instead of function name
  • make the get_function_by_identifier return a _wrap_kakarot function such that it's possible to use contract.get_function_by_identifier("transferFrom(uint256,address,uint256)")(0xabde1_sn, 0xabde1_evm, 1234)

Relevant utils may include
from web3._utils.abi import abi_to_signature
from eth_utils import function_abi_to_4byte_selector

@ClementWalter
Copy link
Member

@obatirou see
image

so we can add functions to the dict and access them easily in the test

@enitrat enitrat dismissed their stale review September 23, 2024 11:48

Overloading function signatures

@ClementWalter
Copy link
Member

about DEFAULT_PRIME : you test that you give an invalid starknet address, ie an address greater or equal than DEFAULT_PRIME. You could parametrize over [DEFAULT_PRIME, 2**256), but if it's only one value, I think that DEFAULT_PRIME makes it more explicit

@ClementWalter ClementWalter merged commit 524005d into kkrt-labs:main Sep 24, 2024
7 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.

feat: DualVMToken functions to interact with starknet address directly
3 participants