EatTheBlocks Forum

PancakeSwap flashloan

Hi!
pancakeswap is fork of Uniswap.
I can take a flashloan from Uniswap.
the code is from here: https://github.com/Austin-Williams/uniswap-flash-swapper/tree/master/contracts

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:

“data”:mycontract.methods.flashSwap(‘0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c’,‘10000’,‘0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c’,‘10000’,method_arr,mst,‘1’).encodeABI()

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 {
WETH = _WETH;
DAI = _DAI;
}

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