Skip to content

Latest commit

 

History

History
74 lines (56 loc) · 1.61 KB

File metadata and controls

74 lines (56 loc) · 1.61 KB

Swap

Transactions

1. AssetTransfer/Pay (Input):

Sender: user_address
Receiver: pool_address
Index: asset_1_id or asset_2_id
Amount: input_amount

2. AppCall:

a. Mode: Fixed Input

Sender: user_address
Index: tinyman_amm_v2_app_id
OnComplete: NoOp
App Args: [“swap”, “fixed-input”, min_output_amount]
Foreign Assets: [asset_1_id, asset_2_id]
Accounts: [pool_address]
Fee: (2 * min_fee)

b. Mode: Fixed Output

Sender: user_address
Index: tinyman_amm_v2_app_id
OnComplete: NoOp
App Args: [“swap”, “fixed-output”, output_amount]
Foreign Assets: [asset_1_id, asset_2_id]
Accounts: [pool_address]
Fee: (3 * min_fee)

Side Effects

Local State Changes

  1. asset_1_reserves
  2. asset_2_reserves
  3. asset_1_protocol_fees
  4. asset_2_protocol_fees
  5. asset_1_cumulative_price
  6. asset_2_cumulative_price
  7. cumulative_price_update_timestamp

Logs

  1. input_asset_id
  2. input_amount
  3. swap_amount
  4. change
  5. output_asset_id
  6. output_amount
  7. poolers_fee_amount
  8. protocol_fee_amount
  9. total_fee_amount

Inner Transactions

1. AssetTransfer/Pay (Change):
****Change is possible, if the swap mode is fixed-output.
This transaction is issued, If there is a change.

Sender: pool_address
Receiver: user_address
Index: input_asset_id
Amount: (See formula IV.B)

2. AssetTransfer/Pay (Output)

Sender: pool_address
Receiver: user_address
Index: output_asset_id
Amount: (See formula IV)