Leverage Ethereum price spike
Installation or just use your browser console.
Trigger the following uniquely designed spells to fulfill this use case. Check this section for generic details around casting spells.
The DSA will cast the spells across the Compound, OasisDEX and Instapool connectors in the following sequence.
let borrowAmount = 20; // 20 DAI
let borrowAmtInWei = dsa.tokens.fromDecimal(borrowAmount, "dai"); // borrow flash loan and swap via OasisDEX
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).then(console.log)
If you still can't find something you're looking for or have any questions, ask them at our developers community on Discord or simply send an Email.
Our team is excited about assisting you to build an application using Instadapp Developer Platform. Your questions and feedback help us make a better development environment for future developers.
Best way to stay connected with our progress.