Lakylife
Lakylife

Reputation: 1

Uniswap V3 automatic token & liquidity deployment hardhat

I'm trying to develop a script that deploys a token and automatically creates a Uniswap V3 liquidity pool with both-sided and single-sided liquidity using Hardhat. However, I keep encountering the following error:

Error: transaction execution reverted (action="sendTransaction", data=null, reason=null, invocation=null, revert=null, transaction={ "data": "", "from": "0x6877aE0322C86964519614549Ad3f89dB758d24c", "to": "0x680c4290f315b9EBF9a340143f5b91d262cBDFF6" }, receipt={ "_type": "TransactionReceipt", "blockHash": "0xae17977ec8d50f51e0a0b9b2937bc6b8cacab829df47bd5603d2bb435f9043d4", "blockNumber": 26324210, "contractAddress": null, "cumulativeGasUsed": "17688897", "from": "0x6877aE0322C86964519614549Ad3f89dB758d24c", "gasPrice": "10937023", "gasUsed": "5210312", "hash": "0x7bd2fadeccb8e3c9a36f7f97821459c74268915e3d12cae67914efd98538f0b3", "index": 67, "logs": [  ], "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "root": null, "status": 0, "to": "0x680c4290f315b9EBF9a340143f5b91d262cBDFF6" }, code=CALL_EXCEPTION, version=6.9.0)
    at makeError (/var/www/SNIPER/newTesting/base-contracts/node_modules/ethers/src.ts/utils/errors.ts:694:21)
    at assert (/var/www/SNIPER/newTesting/base-contracts/node_modules/ethers/src.ts/utils/errors.ts:715:25)
    at checkReceipt (/var/www/SNIPER/newTesting/base-contracts/node_modules/ethers/src.ts/providers/provider.ts:1469:19)
    at TransactionResponse.wait (/var/www/SNIPER/newTesting/base-contracts/node_modules/ethers/src.ts/providers/provider.ts:1486:24)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at main (/var/www/SNIPER/newTesting/base-contracts/scripts/launch.js:55:25) {
  code: 'CALL_EXCEPTION',
  action: 'sendTransaction',
  data: null,
  reason: null,
  invocation: null,
  revert: null,
  transaction: {
    to: '0x680c4290f315b9EBF9a340143f5b91d262cBDFF6',
    from: '0x6877aE0322C86964519614549Ad3f89dB758d24c',
    data: ''
  },
  receipt: TransactionReceipt {
    provider: HardhatEthersProvider {
      _hardhatProvider: [LazyInitializationProviderAdapter],
      _networkName: 'base'
    },
    to: '0x680c4290f315b9EBF9a340143f5b91d262cBDFF6',
    from: '0x6877aE0322C86964519614549Ad3f89dB758d24c',
    contractAddress: null,
    hash: '0x7bd2fadeccb8e3c9a36f7f97821459c74268915e3d12cae67914efd98538f0b3',
    index: 67,
    blockHash: '0xae17977ec8d50f51e0a0b9b2937bc6b8cacab829df47bd5603d2bb435f9043d4',
    blockNumber: 26324210,
    logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
    gasUsed: 5210312n,
    cumulativeGasUsed: 17688897n,
    gasPrice: 10937023n,
    type: 2,
    status: 0,
    root: undefined
  },
  shortMessage: 'transaction execution reverted'
}

Transaction details:
Data: 
To: 0x680c4290f315b9EBF9a340143f5b91d262cBDFF6
From: 0x6877aE0322C86964519614549Ad3f89dB758d24c
Gas limit: undefined

Receipt details:
Transaction hash: 0x7bd2fadeccb8e3c9a36f7f97821459c74268915e3d12cae67914efd98538f0b3
Gas used: 5210312
Block number: 26324210

My Setup

Network: Base Factory Contract Address: 0x680c4290f315b9EBF9a340143f5b91d262cBDFF6 Hardhat Version: latest Ethers Version: 6.9.0

Launch Script (Simplified)

const { ethers } = require("hardhat");

async function main() {
    try {
        const FACTORY_ADDRESS = "0x680c4290f315b9EBF9a340143f5b91d262cBDFF6";
        const [deployer] = await ethers.getSigners();
        
        const Factory = await ethers.getContractFactory("FairLaunchFactory");
        const factory = Factory.attach(FACTORY_ADDRESS);

        const launchParams = {
            name: "Test Token",
            symbol: "TEST",
            totalSupply: ethers.parseEther("1000000"),  
            feeTier: 3000, 
            initialPrice: ethers.parseEther("0.00001"),
            minPrice: ethers.parseEther("0.00001"), 
            maxPrice: ethers.parseEther("0.0001"),
            depositTokens: ethers.parseEther("500000")
        };

        console.log("Launching with parameters:", launchParams);

        const tx = await factory.launchToken.populateTransaction(launchParams);
        const transaction = await deployer.sendTransaction({
            to: FACTORY_ADDRESS,
            data: tx.data,
            gasLimit: ethers.getBigInt(10000000)
        });

        console.log(`Transaction hash: ${transaction.hash}`);
        const receipt = await transaction.wait();

        if (receipt.status === 1) {
            console.log("Token successfully launched!");
        } else {
            console.error("Transaction failed!");
        }
    } catch (error) {
        console.error("Error launching token:", error);
    }
}

main().catch((error) => {
    console.error(error);
    process.exit(1);
});

What I’ve Tried:

  1. Checked gas limits – Increased gas but still fails.
  2. Verified contract address – The factory contract is deployed and verified.
  3. Used a direct contract call instead of populateTransaction – Same error.

Questions:

What could be causing this transaction execution reverted error?

contract contract who should be able to

https://basescan.org/address/0x680c4290f315b9ebf9a340143f5b91d262cbdff6

Upvotes: 0

Views: 27

Answers (0)

Related Questions