Hello Academy! ,
Today i tryed flash loan on instadapp to long my ETH and i have problems with my script after specifying gas price and limit still running in to error
Warning! Error encountered during contract execution [Out of gas]
here is one of my transactions:
let borrowAmount = 100; // 20 DAI
let borrowAmtInWei = dsa.tokens.fromDecimal(borrowAmount, "dai"); // borrow flash loan and swap via Oasis
let slippage = 2; // 2% slippage.
let dai_address = dsa.tokens.info.dai.address;
let eth_address = dsa.tokens.info.eth.address;
let buyDetail = await dsa.oasis.getBuyAmount("ETH", "DAI", borrowAmount, slippage);
let spells = dsa.Spell();
spells.add({
connector: "instapool",
method: "flashBorrow",
args: [dai_address, borrowAmtInWei, 0, 0]
});
spells.add({
connector: "oasis",
method: "sell",
args: [eth_address, dai_address, borrowAmtInWei, buyDetail.unitAmt, 0, 0]
});
spells.add({
connector: "compound",
method: "deposit",
args: [eth_address, "-1", 0, 0]
});
spells.add({
connector: "compound",
method: "borrow",
args: [dai_address, borrowAmtInWei, 0, 0]
});
spells.add({
connector: "instapool",
method: "flashPayback",
args: [dai_address, 0, 0]
});
dsa.cast({
'spells' : spells,
'gasPrice' : web3.utils.toWei('24','gwei'),'gas':'1000000'
}).then(console.log)
Why still im out of gas even with this huge limits?