My Starknet contract uses cairo v2, but ETH tokens in starknet are deployed with cairo v0. But Cairo v0 and Cairo v2 are two very different versions in syntax and data types. So how to transfer ETH in cairo starknet contract v2
I tried using IERC20 to use ETH token but without success https://i.stack.imgur.com/lyBvJ.png
You we need to use
IERC20Camelto interact with camel cased contract (which many of ERC20 contracts are).https://github.com/OpenZeppelin/cairo-contracts/blob/main/src/token/erc20/interface.cairo#L34C3-L34C3
Steps are like this,
transferFromafter you have approvalApproval to move tokens with
approveBefore you can call
transferFrom(ortransfer_from) your contract needs to have approval for the tokens you want to transfer. This is usually done as a multi-call. So when you ask the client to sign the transaction that eventually callstransferFromyou add in a call toapproveright before it within the same transaction.