Skip to main content
Ramses V3 uses interfaces compatible with Uniswap V3, so you can use the @uniswap/v3-periphery and @uniswap/v3-core npm packages for interface definitions. The callback function names (uniswapV3FlashCallback, etc.) remain the same for compatibility.
This guide builds a contract that calls flash on a Ramses V3 pool and arbitrages the price difference between pools with different fee tiers for the same token pair.

Flash Transactions Overview

flash withdraws specified amounts of both token0 and token1 to a recipient. The withdrawn amount plus fees must be repaid by the end of the transaction. A data parameter allows passing arbitrary abi-encoded data to the callback.

The Flash Callback

Inside flash, the pool calls back into msg.sender:
This is where you implement your custom logic. Three callbacks exist: uniswapV3SwapCallback, uniswapV3MintCallback, and uniswapV3FlashCallback.

Contract Setup

Inherit IUniswapV3FlashCallback and PeripheryPayments. PeripheryPayments extends other contracts we need, including LowGasSafeMath.