Flash Swap On Classic
Using dmmSwapCall
dmmSwapCallfunction dmmSwapCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) {
IERC20 token0 = IDMMPool(msg.sender).token0(); // fetch the address of token0
IERC20 token1 = IDMMPool(msg.sender).token1(); // fetch the address of token1
assert(IDMMFactory(dmmFactory).isPool(token0, token1, msg.sender)); // ensure that caller can only be dmm pool
// rest of the function below
}Interface
pragma solidity 0.6.6;
interface IDMMCallee {
function dmmSwapCall(
address sender,
uint256 amount0,
uint256 amount1,
bytes calldata data
) external;
}Last updated
Was this helpful?