EatTheBlocks Forum

PancakeSwap flashloan

pancakeswap is fork of Uniswap.
I can take a flashloan from Uniswap.
the code is from here:

but when I try to take flashloan from Pancakeswap it always fails.

code in smart contract for flashswap:

function flashSwap(address _tokenBorrow, uint _amount, address _tokenPay, uint _amountToRepay, bytes calldata _userData,
address[] calldata drx, uint count) external {
startSwap(_tokenBorrow, _amount, _tokenPay, _userData);

    // you can do anything you want to here after the flash swap has completed
    // ..

what I send in web3js:


also,when you deploy smart contract you should enter Weth and Dai addresses. I don’t know why. code is here:

constructor(address _DAI, address _WETH) public {

With such a vague question, its difficult to help :frowning:
Do you have a more specific question?