Function: withdraw_asset
The withdraw_asset
function can be used to withdraw from the available balances of the caller.
The function ensures that safe mode is not enabled and that the user is a liquidity provider. It also validates the destination address where the funds should be withdrawn, ensuring the address can be decoded and that it corresponds to a chain that matches the asset being withdrawn.
If all the above checks pass, the account is debited and a corresponding egress is scheduled by invoking the egress handler, implemented by the cf-ingress-egress pallet.
Finally, an event containing the details of the scheduled egress is deposited.