Hi, all
I have a input field in my DAPP where user can input ETH and click the submit button to get token worth ETH..How to calculate the token price in ether and get the token and show it in DAPP..
Token Price is 0.10 cents
function getPrice() public pure returns(uint256) {
uint256 totalEther = uint256(225800608429140) / uint256(10**18);
uint256 result = uint256(231481480000000) * 10**18;
uint256 totalTokens = result / 1 ether;
// _totalEther = totalEther;
return totalTokens;
}
but this isn't working.