I am trying to implement a smart contract to which users can send their funds and then these can be withdrawn to their L1 address.
I found and modified some testing code from the wasp repository (https://github.com/iotaledger/wasp/blob/develop/packages/evm/evmtest/ISCTest.sol):
function withdraw(L1Address memory receiver, uint64 amount) external {
require(amount > 0, "Invalid amount to withdraw");
require(balance >= amount, "User do not have the demanded balance");
balance -= amount;
ISCAssets memory assets;
assets.baseTokens = amount;
ISCSendMetadata memory metadata;
ISCSendOptions memory options;
ISC.sandbox.send(receiver, assets, true, metadata, options);
}
I am trying to test this code but I have not been able to find an example which forms the L1Address structure. I had a look at some go code which serializes the address and its type but I don't fully understand how it is done. Right now I am calling the function from Remix IDE but the idea is to call it using python and Web3.py. So my question is:
How can I send a valid address to this function?
Also, if this is not possible or just a bit too complex,
Can I use either the evm core contract or the wasp-cli to send my L2 funds to a L1 address? If so, how?