SHARE
TWEET

Untitled

a guest Feb 19th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let ether = 0;
  2. let token = 1;
  3. let rate = 500000;
  4.  
  5. function buy(amount) {
  6.     ether += amount;
  7.     let tokensToMint = calc(amount);
  8.     token += tokensToMint;
  9.     console.log(token);
  10. }
  11.  
  12. function calc(amount) {
  13.     // return token * (1 + amount) / ether ^ (rate - 1);
  14.     return token * ((1 + amount / ether) ** (rate / 1000000) - 1)
  15. }
  16.  
  17. for (let i = 0; i < 10; i++) {
  18.     buy(10);
  19. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top