Untitled
unknown
plain_text
3 years ago
423 B
7
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...