The Bunicorn stablecoins flash swap functionality works similarly to Uniswap's. You may read more about flash swaps . We highlight the syntax differences below.
Using buniSwapCall
function buniSwapCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) {
IERC20 token0 = IBuniCornPool(msg.sender).token0(); // fetch the address of token0
IERC20 token1 = IBuniCornPool(msg.sender).token1(); // fetch the address of token1
assert(IBuniCornFactory(buniCornFactory).isPool(token0, token1, msg.sender)); // ensure that caller can only be Bunicorn pool
// rest of the function below
}