VELOCORE V2
V1 DocszkSyncEraLineaTelos
  • Introduction
  • Our Philosophy
    • Vision
    • Gas Optimization
    • General Bedrock for All Kinds of AMM
    • Epoch-less Predictability
    • Free Flowing Easy Vote System
  • DEX Innovation
    • Token Vault
      • Flashloan
    • Gas Saving Matters : Benchmark
    • AMM Flexibility
    • Multi In/Out Swap
    • Batch Swap
    • Adjustable Trading Fee Mechanics
    • Accumulating Swap Fees in LP Tokens
  • ve(3,3) Innovation
    • Removing 'Epoch' Systems
      • Bribe Optimization
    • Fungible Votes ($veVC)
      • No Decay & Easy Liquidation
    • Decentralized Gauge Deployment
    • Rebase Elimination
  • Security & Contract Address
    • zkSyncEra Contracts
    • Linea Contracts
    • Telos Contracts
    • V1 zkSyncEra (deprecated)
    • Three Rounds of Audits
  • Technical Docs
    • Concepts
    • Architecture Overview
      • Source Files Overview
    • How to interact with VELOCORE
      • Uniswap compatible interface
    • How to Read Data
    • Example Codes
      • Swap
      • Add liquidity
      • Stake
      • Voting
      • Multicall operations
      • cf) wrapper functions
    • Typescript Examples for Integration
    • Pool Specifics
      • Generalized CPMM
      • Wombat Stableswap
    • Events & Chart Integration
      • Getting a pair list
      • Interpreting Swap / LP events
    • Flashloan
  • zkSync Era
    • Migration Plan
      • $VC 1:1 Exchange
      • veNFT -> $veVC
      • One-Step LP Migration
      • Migration Schedule
      • Emission Migration
    • V2 Tokenomics
      • $VC Gauge
      • Bribe Mechanics
      • $veVC VOTING
    • Paymaster as a Service
  • Linea
    • Launch Details
      • Getting Ready
      • Bridging
      • V2 Launch Event
      • $LVC Presale
    • $LVC Tokenomics
      • $LVC Gauge
      • Bribe Mechanics
      • $veLVC VOTING
  • Telos
    • Launch Details
      • Getting Ready
      • Bridging
      • Launch Event
    • $TVC Tokenomics
      • $TVC Gauge
      • Bribe Mechanics
      • $veTVC VOTING
  • Free Loot Box for Future Airdrops
  • PASSPORT - F'air drops
  • Legal Disclaimer
  • Velocore Brand Assets
Powered by GitBook
On this page
  1. Technical Docs

Flashloan

Last updated 1 year ago

Velocore supports flashloans, and they are completely free. The benefit of using our flashloan is that since it is treated as a part of normal swaps, you can repay with any tokens you want, and chain it with normal swaps or pay the difference with tokens in your wallet.

You can request flashloan with , specifying the recipient as a converter pool.

continuing from :

  await compileAndExecute(0, [
        [poolId(2, your_flashloan_recipient), [ // flashloan
            [eth, "flashloan", INT128_MAX], // flashloan entire balance of the vault
            [dai, "flashloan", INT128_MAX],
            [usdt, "exactly", 12340560], // you can also specify the amount to borrow
            [vc, "exactly", 0], // if you are planning to use another token to repay,
                                // you must specify that token too.
        ]],
        // at this point, the internal balance will be (tokens returned) - (tokens borrowed).
        // if you return less than what you've borrowed, they may be negative.
    ])

to receive flashloan, your contract must implement the method below:

function velocore__convert(address user, Token[] calldata tokens, int128[] memory, bytes calldata data) external {
    require(msg.sender == VAULT_ADDRESS);
    
    
    // do something with the tokens
    
    // return tokens
    for (uint256 i = 0; i < tokens.length; i++) {
        tokens[i].transferFrom(address(this), msg.sender, tokens[i].balanceOf(address(this)));
    }
}

vault.execute()
this code