📌Flashloans
Last updated
Last updated
The FlashLoan
contract is designed to facilitate arbitrage trading using flash loans from a decentralized exchange (like PancakeSwap). It performs a series of token swaps to capitalize on price discrepancies across different liquidity pools.r
getBalanceOfToken
Retrieves the balance of a specified token for this contract.
placeTrade
Executes a trade on PancakeSwap.
initialArbitrage
Initiates an arbitrage trade using a flash loan.
pancakeCall
Callback function for PancakeSwap flash loan.
Parameter
Type
Description
_address
address
Token address to query the balance of.
Return
Type
Description
-
uint256
The token balance of the contract.
Parameter
Type
Description
_fromToken
address
Address of the token being traded from.
_toToken
address
Address of the token being traded to.
_amountIn
uint256
Amount of _fromToken
to trade.
Return
Type
Description
amountReceived
uint
Amount of _toToken
received from the trade.
Parameter
Type
Description
_busdBorrow
address
Address of the BUSD token to borrow.
_amount
uint
Amount of BUSD to borrow for the flash loan.
Parameter
Type
Description
_sender
address
Address of the sender initiating the flash loan.
_amount0
uint256
Amount of token0 involved in the loan.
_amount1
uint256
Amount of token1 involved in the loan.
_data
bytes
Encoded data for the loan.