Untitled
Anonymous
plain_text
04/21/2023 12:45 AM
564 B
13
Indexable
const contractInstance = new web3.eth.Contract(abi, contractAddress);
async function getPrice() {
const totalTokensSupply = await contractInstance.methods.totalTokensSupply().call();
const totalEthInContract = await web3.eth.getBalance(contractAddress);
const price = await contractInstance.methods.getPrice(totalEthInContract, totalTokensSupply).call();
console.log("Current price:", price);
}
getPrice();
Editor is loading...