-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.js
138 lines (103 loc) · 3.55 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
// let EthPrice = 100
// let hardcap = 1000
// function getDiscountPrice(_collateralAmount) {
// let EthEvaluation = _collateralAmount * EthPrice;
// console.log('EthEvaluation', EthEvaluation, 'hardcap', hardcap);
// let GenesisAmount = hardcap - EthEvaluation;
// let GenesisDiscount = getGenesisPrice(EthEvaluation)
// console.log('GenesisDiscount', GenesisDiscount);
// let GenesisTokenPrice = 1 - ((1 / 100) * GenesisDiscount)
// console.log('Genesis Token Price', GenesisTokenPrice);
// let GenesisTokenToMint = EthEvaluation * GenesisTokenPrice
// console.log('GenesisTokenToMint', GenesisTokenToMint);
// return EthEvaluation;
// }
// getDiscountPrice(4.2)
// function getGenesisPrice(_amount) {
// let genesisDiscount = 0;
// let amountPercentage = (_amount * 100) / hardcap; //let(100).mul(_amount).div(hardcap);
// let hardcapRemaining = ((hardcap - _amount) * 100) / hardcap
// console.log('amountPercentage', amountPercentage, '%', 'hardcapRemaining', hardcapRemaining);
// if (hardcapRemaining >= 90 && hardcapRemaining <= 100) {
// genesisDiscount = 21
// }
// if (hardcapRemaining >= 80 && hardcapRemaining <= 89) {
// genesisDiscount = 16
// }
// if (hardcapRemaining >= 70 && hardcapRemaining <= 79) {
// genesisDiscount = 12
// }
// if (hardcapRemaining >= 60 && hardcapRemaining <= 69) {
// genesisDiscount = 9
// }
// if (hardcapRemaining >= 50 && hardcapRemaining <= 59) {
// genesisDiscount = 6
// }
// if (hardcapRemaining >= 40 && hardcapRemaining <= 49) {
// genesisDiscount = 5
// }
// if (hardcapRemaining >= 30 && hardcapRemaining <= 39) {
// genesisDiscount = 3
// }
// if (hardcapRemaining >= 20 && hardcapRemaining <= 29) {
// genesisDiscount = 2
// }
// if (hardcapRemaining >= 10 && hardcapRemaining <= 1) {
// genesisDiscount = 1
// }
// //console.log('genesisDiscount', genesisDiscount);
// return genesisDiscount
// }
let hardcap = 100
let EthPrice = 100
let amountRaised = 11
const getGenesisTokenPrice = (_amount) => {
let ethRaised = (amountRaised * 100) / hardcap
let arthPrice
console.log('ethRaised', ethRaised, '%');
if (ethRaised >= 0 && ethRaised <= 9) {
arthPrice = 0.50
}
if (ethRaised >= 10 && ethRaised <= 19) {
arthPrice = 0.53
}
if (ethRaised >= 20 && ethRaised <= 29) {
arthPrice = 0.56
}
if (ethRaised >= 30 && ethRaised <= 39) {
arthPrice = 0.61
}
if (ethRaised >= 40 && ethRaised <= 49) {
arthPrice = 0.65
}
if (ethRaised >= 50 && ethRaised <= 59) {
arthPrice = 0.71
}
if (ethRaised >= 60 && ethRaised <= 69) {
arthPrice = 0.78
}
if (ethRaised >= 70 && ethRaised <= 79) {
arthPrice = 0.85
}
if (ethRaised >= 80 && ethRaised <= 89) {
arthPrice = 0.95
}
if (ethRaised >= 90 && ethRaised <= 99) {
arthPrice = 1.05
}
if (ethRaised >= 100) {
arthPrice = 1.18
}
return arthPrice
}
const mintGenesisToken = async (_amount) => {
let ethPrice = _amount * EthPrice
console.log('_amount', _amount, 'ethPrice', ethPrice, '$')
let genesisTokenPrice = getGenesisTokenPrice(ethPrice)
console.log('genesisTokenPrice', genesisTokenPrice);
let genesisTokenToMint = ethPrice / genesisTokenPrice
console.log('genesisTokenToMint', genesisTokenToMint);
let t = 0.5 + ((5 ** (10) - 1) / 5 * 0.85)
// console.log(t);
}
mintGenesisToken(5)