| 12345678910111213141516171819202122232425262728293031 |
- import { web3 } from "hardhat";
- import contracts from "../config/contracts";
- import deployer from "../.secret";
- describe('Flash test', () => {
- let inAmount = 1e10.toString()
- it('Flash swap test', async () => {
- const FLASH_ABI = require('../artifacts/contracts/Flash.sol/Flash.json').abi
- let flash = new web3.eth.Contract(FLASH_ABI, contracts.FLASH)
- let rawTx = {
- from: deployer.address,
- nonce: await web3.eth.getTransactionCount(deployer.address),
- gasPrice: web3.utils.toWei('2', 'gwei'),
- gasLimit: 1e6
- }
- const WETH_USDT_POOL_CONTRACT = '0x4e68Ccd3E89f51C3074ca5072bbAC773960dFa36'
- await flash.methods
- .flashLoan({
- pool: WETH_USDT_POOL_CONTRACT,
- inToken0: true,
- inAmount: inAmount,
- sqrtPriceLimitX96: 0,
- inToken: contracts.WETH
- })
- .send(rawTx).then(console.log)
- })
- })
|