Untitled
const provider = new ethers.providers.Web3Provider(window.ethereum); const signer = provider.getSigner(); const contractInstance = new ethers.Contract(contractAddress, abi, signer); async function getPrice() { const totalTokensSupply = await contractInstance.totalTokensSupply(); const totalEthInContract = await provider.getBalance(contractAddress); const price = await contractInstance.getPrice(totalEthInContract, totalTokensSupply); console.log("Current price:", price.toString()); } getPrice();