If I have an ERC20 contract on my blockchain, and a user wants to buy tokens as in the following scenario:
User gives the number of tokens they want to buy
An info box will popup to show the user how many ether they will pay and the remaining balance
Once confirmed, a the amount of tokens in balance should be shown
To obtain tokens, I have to call a method in a smart contract which looks like this. obtainTok(BigInteger weiValue)
What is the formula to calculate the weiValue in this scenario using web3j?
EDIT Since there is no Javadocs for the library the parameters are not really clear for me as a beginner.
ethGetBalance(String address, DefaultBlockParameter defaultBlockParameter)
Does the address here represent the wallet address or user address?