### Transfering assets
- In the IL2 Assets, the transfers are asynchronous operations that have 2 steps:
- The withdraw from the source wallet by the sender;
- The deposit into the destination wallet by the receiver;
### How transfers work - Withdraw
- Upon request from the sender to transfer a certain amount of assets to the destination wallet:
1. The system verifies if the wallet has sufficient funds and if the transfer to the destination wallet is allowed;
2. A new record of the wallet is created with the withdraw record in place;
3. A transfer notification is sent to the destination wallet via broadcast;
- The address of the withdraw record is the receipt of the transference to the destination wallet;
### How transfers work - Deposit
- Upon notification via system messages or by the sender:
1. The withdraw record is loaded and the autenticity of the assets in it are verified (optional);
2. A new record of the wallet is created registering the deposit;
- The address of the deposit is contains the new balance of the destination wallet;
### Transfer restrictions
- Some asset types imposes restrictions to based on the types of the source and destination wallets;
- Issuer and User wallets cannot hold nor transfer expired assets;
- Only authorized burners can receive assets of certain types;
Transfer operation example
Here we have 3 wallets.
Transfer operation example
Each with an initial balance of some asset.
WALLET: 10
WALLET: 9
WALLET: 0
Transfer operation example
Let's transfer 5 from W1234 to W5678...
WALLET: 10
WALLET: 9
WALLET: 0
Transfer operation example
A withdraw of 5 in favor of W5678 is registered.
WALLET: 10
WALLET: 9
WALLET: 0
Transfer operation example
Once the withdraw is registered a notification is sent to W5678.
WALLET: 10
WALLET: 9
WALLET: 0
Transfer operation example
The owner of W5678 receives the notification, verifies if it authentic and registers the deposit based on it.
WALLET: 5; W(W5678,5)
WALLET: 14; D(W1234,5)
WALLET: 10
WALLET: 9
WALLET: 0
Transfer operation example
A transfer from W5678 to W9012 happens in the same way...
WALLET: 0; W(W9012,14)
⇒
WALLET: 14; D(W5678,14)
WALLET: 5; W(W5678,5)
WALLET: 14; D(W1234,5)
WALLET: 10
WALLET: 9
WALLET: 0
Transfer operation example
...as a new transfer from W9012 to W1234.
WALLET: 11; D(W9012,6)
⇐
⇐
⇐
WALLET: 8; W(W1234,6)
WALLET: 0; W(W9012,14)
WALLET: 14; D(W5678,14)
WALLET: 5; W(W5678,5)
WALLET: 14; D(W1234,5)
WALLET: 10
WALLET: 9
WALLET: 0
Transfer operation example
This is the final state of the transfers. Wallet W1234 has 11, W5678 has 0 and W9012 ends with 6.
WALLET: 11; D(W9012,6)
WALLET: 8; W(W1234,6)
WALLET: 0; W(W9012,14)
WALLET: 14; D(W5678,14)
WALLET: 5; W(W5678,5)
WALLET: 14; D(W1234,5)
WALLET: 10
WALLET: 9
WALLET: 0
Transfer operation example
It is important to notice that a full tracing of the transfers are registered in the wallets, leaving a full auditing trail of the assets up to the issuer when necessary.
WALLET: 11; D(W9012,6)
⇐
⇐
⇐
WALLET: 8; W(W1234,6)
WALLET: 0; W(W9012,14)
⇒
WALLET: 14; D(W5678,14)
WALLET: 5; W(W5678,5)
⇒
WALLET: 14; D(W1234,5)
WALLET: 10
WALLET: 9
WALLET: 0