Tinyman Docs
  • Tinyman V2 Overview
  • About Tinyman
  • Protocol Specification
    • Pool
      • Pool Creation
      • Adding Liquidity
      • Removing Liquidity
    • Swap
    • Fees
    • Flash Loan
    • Flash Swap
    • Additional Notes
  • FAQ
    • Migration FAQ
  • Fees
  • Permissioned Methods
    • Roles
    • Methods
    • Related Non-Permissioned Methods
  • Formulae
  • Disclaimer
  • Contracts
  • Audits & Security
  • Token and Governance
    • TINY Token Details
    • Governance Details
      • Overview
      • Governance Vault
      • Governance Rewards
      • Governance Process
      • TINY Farming
  • V2 Integration
    • Protocol Methods
      • Bootstrap
      • Add Initial Liquidity
      • Add Subsequent Liquidity
      • Remove Liquidity
      • Swap
      • Flash Loan
      • Flash Swap
    • State Data
    • Oracle Data
    • Calculating Quotes
    • Official SDKs
  • Swap Router
    • Transaction Specification
  • Swap Widget
    • Customization Preferences
    • How to export your Widget
  • Lending Pools
  • Liquid Staking
    • Liquid Staking
  • Tinyman V1
    • Overview
    • Tinyman AMM Basics
      • Creating Pools
      • Slippage & Excess
      • Farming
    • FAQ
    • Fees
    • Design Doc
    • Contracts
    • Tinyman Testnet
    • Disclaimer
    • Audits
    • Security
  • V1 Integration
    • Pool Lookup
    • Transaction Specifications
      • Bootstrap Pool
      • OptIn
      • Swap
      • Mint
      • Burn
      • Redeem
      • Create Validator App
      • Redeem Protocol Fees
    • Official SDKs
    • Community SDKs
  • Tinyman Presentations
  • Known Issues
    • 2021-11-12 - Pool overflow errors
Powered by GitBook
On this page

Was this helpful?

  1. V2 Integration
  2. Protocol Methods

Flash Swap

Transactions

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

Side Effects

  1. Flash Swap

Local State Changes

  1. lock

  2. asset_1_cumulative_price

  3. asset_2_cumulative_price

  4. cumulative_price_update_timestamp

Logs

To able to share data between app calls, these logs are added:

  1. asset_1_balance_after_transfer

  2. asset_2_balance_after_transfer

Inner Transactions

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

  1. lock

  2. asset_1_reserves

  3. asset_2_reserves

  4. asset_1_protocol_fees

  5. asset_2_protocol_fees

Logs

  1. asset_1_output_amount

  2. asset_1_input_amount

  3. asset_1_poolers_fee_amount

  4. asset_1_protocol_fee_amount

  5. asset_1_total_fee_amount

  6. asset_2_output_amount

  7. asset_2_input_amount

  8. asset_2_poolers_fee_amount

  9. asset_2_protocol_fee_amount

  10. asset_2_total_fee_amount

PreviousFlash LoanNextState Data

Last updated 2 years ago

Was this helpful?