Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let ether = 0;
- let token = 1;
- let rate = 500000;
- function buy(amount) {
- ether += amount;
- let tokensToMint = calc(amount);
- token += tokensToMint;
- console.log(token);
- }
- function calc(amount) {
- // return token * (1 + amount) / ether ^ (rate - 1);
- return token * ((1 + amount / ether) ** (rate / 1000000) - 1)
- }
- for (let i = 0; i < 10; i++) {
- buy(10);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement