I'm having difficulty computing an initial tokenSupply parameter in Solidity, one of two required parameters to initialize a Bancor-style bonding curve contract.
P = sent Ether in Wei R = reserve ratio M = Slope tokenSupply = (P/(R*M))^R
P = 1 * 10^18 R = .333333 M = .0025 N = Scaling Factor = 1/1,000,000
This seems fine:
tokenSupply = 1*10^18 / ((N)333,333 * (N)2500) * N
tokenSupply = ( 1*10^18 / (N)833 )^R
Can I divide the unscaled wei by the scaled product (N)833 and assume the quotient has the same scaling factor N?
How on earth do I raise this quotient to R? (Assuming R's initial Scaling Factor, 333,333 is out of the question) And how do I know what the scaling factor would be of the result
tokenSupply? (I don't know how to handle scaled exponents). Thanks
I am using SafeMath to handle overflows