1. AppCall:
Sender: user_address
Index: tinyman_amm_v2_app_id
OnComplete: NoOp
App Args: [“flash_swap”, index_diff, asset_1_amount, asset_2_amount]
Foreign Assets: [asset_1_id, asset_2_id]
Accounts: [pool_address]
Fee: (3 * min_fee)
2. AppCall (Group Index: index of flash swap call + index diff specified in the arguments):
Sender: user_address
Index: tinyman_amm_v2_app_id
OnComplete: NoOp
App Args: [“verifiy_flash_swap”, index_diff]
Foreign Assets: [asset_1_id, asset_2_id]
Accounts: [pool_address]
Fee: min_fee
- Flash Swap
- lock
- asset_1_cumulative_price
- asset_2_cumulative_price
- cumulative_price_update_timestamp
Logs
To able to share data between app calls, these logs are added:
- asset_1_balance_after_transfer
- asset_2_balance_after_transfer
1. AssetTransfer (If asset 1 amount is not 0):
Sender: pool_address
Receiver: user_address
Index: asset_1_id
Amount: asset_1_amount
2. AssetTransfer/Pay (If asset 2 amount is not 0):
Sender: pool_address
Receiver: user_address
Index: asset_2_id
Amount: asset_2_amount
2. Verify Flash Swap
Local State Changes
- lock
- asset_1_reserves
- asset_2_reserves
- asset_1_protocol_fees
- asset_2_protocol_fees
Logs
- asset_1_output_amount
- asset_1_input_amount
- asset_1_poolers_fee_amount
- asset_1_protocol_fee_amount
- asset_1_total_fee_amount
- asset_2_output_amount
- asset_2_input_amount
- asset_2_poolers_fee_amount
- asset_2_protocol_fee_amount
- asset_2_total_fee_amount