tx · 515umsasrAUptR7EAuKonnhwGhQLJnudMg1YWfmbg84R 3MzVJhWvtXe4nNE6AwiGHUiYSBHjE19KdMf: -0.01000000 Waves 2019.09.11 14:52 [671422] smart account 3MzVJhWvtXe4nNE6AwiGHUiYSBHjE19KdMf > SELF 0.00000000 Waves
{ "type": 13, "id": "515umsasrAUptR7EAuKonnhwGhQLJnudMg1YWfmbg84R", "fee": 1000000, "feeAssetId": null, "timestamp": 1568202739117, "version": 1, "sender": "3MzVJhWvtXe4nNE6AwiGHUiYSBHjE19KdMf", "senderPublicKey": "3a2E1JSK9D27J6nW5oULVGPUEAfDycTf8RanPBYvxSXT", "proofs": [ "8NBzTh7pDgs7hF4w2GM7gZQUj1d4qwiqf6McZ8rv9PN6udwKZ7xuszmGMuDf2pVW2XsE8LYsKPH7qMcFibaBjeX" ], "script": "base64:AAIDAAAAAAAAAAAAAAAWAAAAABFtYW5hZ2VtZW50QWRkcmVzcwEAAAAaAVSR0Glm5RV2vSTuw/esP/dhGqUlN6o1Z3UAAAAACWNvbGRWYXVsdAkBAAAAB2V4dHJhY3QAAAABCQEAAAARYWRkcmVzc0Zyb21TdHJpbmcAAAABAgAAACMzTjNENVJTR3FoZVpqcEtiN0JXNDE3Rjk5WTVUc2Z4WlVjQwAAAAAFdG9rZW4BAAAAIBddItC31jFqdvLc6MFjw/T2/YTo0k3ipohbH5mDp5gfAAAAAAl0b2tlblJhdGUAAAAAAAAAAAIAAAAAE3Rva2VuRGVjaW1hbHNPZmZzZXQJAABsAAAABgAAAAAAAAAACgAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAkBAAAAAlVwAAAAAAAAAAANaGFyZENhcFRva2VucwAAAAAAO5rKAAAAAAASbWF4SW52ZXN0bWVudFdhdmVzAAAAAAAX14QAAAAAABBhbGxvd0RhdGVzQ2hhbmdlBwAAAAAJc3RhcnRUaW1lAAAAAABdeNp8AAAAAAdlbmRUaW1lAAAAAABdefwsAAAAAA13YXZlc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AAAZ2ZXJpZnkAAAAAB3NwmP0=", "chainId": 84, "height": 671422, "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let managementAddress = base58'3N3D5RSGqheZjpKb7BW417F99Y5TsfxZUcC' | |
5 | + | ||
6 | + | let coldVault = extract(addressFromString("3N3D5RSGqheZjpKb7BW417F99Y5TsfxZUcC")) | |
7 | + | ||
8 | + | let token = base58'2aCkKu1bprzo5jX6DGZeEyGhSaWNbYxZ8hXtndd8TTJW' | |
9 | + | ||
10 | + | let tokenRate = 2 | |
11 | + | ||
12 | + | let tokenDecimalsOffset = pow(10, 0, 8, 0, 0, Up()) | |
13 | + | ||
14 | + | let hardCapTokens = 1000000000 | |
15 | + | ||
16 | + | let maxInvestmentWaves = 400000000 | |
17 | + | ||
18 | + | let allowDatesChange = false | |
19 | + | ||
20 | + | let startTime = 1568201340 | |
21 | + | ||
22 | + | let endTime = 1568275500 | |
23 | + | ||
24 | + | let wavesDecimals = pow(10, 0, 8, 0, 0, Up()) | |
25 | + | ||
26 | + | func onlyManager (callerBytes) = { | |
27 | + | let caller = toBase58String(callerBytes) | |
28 | + | let managementAddressString = toBase58String(managementAddress) | |
29 | + | if ((caller != managementAddressString)) | |
30 | + | then false | |
31 | + | else true | |
32 | + | } | |
33 | + | ||
34 | + | ||
35 | + | func getTimeNow () = { | |
36 | + | let blockInfo = value(blockInfoByHeight(height)) | |
37 | + | (blockInfo.timestamp / 1000) | |
38 | + | } | |
39 | + | ||
40 | + | ||
41 | + | func getStartTime () = { | |
42 | + | let dataStartTime = getInteger(this, "startTime") | |
43 | + | match dataStartTime { | |
44 | + | case changedStartTime: Int => | |
45 | + | changedStartTime | |
46 | + | case notChanged: Unit => | |
47 | + | startTime | |
48 | + | case _ => | |
49 | + | throw() | |
50 | + | } | |
51 | + | } | |
52 | + | ||
53 | + | ||
54 | + | func getEndTime () = { | |
55 | + | let dataEndTime = getInteger(this, "endTime") | |
56 | + | match dataEndTime { | |
57 | + | case changedEndTime: Int => | |
58 | + | changedEndTime | |
59 | + | case notChanged: Unit => | |
60 | + | endTime | |
61 | + | case _ => | |
62 | + | throw() | |
63 | + | } | |
64 | + | } | |
65 | + | ||
66 | + | ||
67 | + | func hasStarted () = if ((getTimeNow() > getStartTime())) | |
68 | + | then true | |
69 | + | else false | |
70 | + | ||
71 | + | ||
72 | + | func hasEnded () = if ((getTimeNow() > getEndTime())) | |
73 | + | then true | |
74 | + | else false | |
75 | + | ||
76 | + | ||
77 | + | func hasFinished () = { | |
78 | + | let isFinalized = getBoolean(this, "finalized") | |
79 | + | match isFinalized { | |
80 | + | case dataFinalized: Boolean => | |
81 | + | dataFinalized | |
82 | + | case notFinalized: Unit => | |
83 | + | false | |
84 | + | case _ => | |
85 | + | throw() | |
86 | + | } | |
87 | + | } | |
88 | + | ||
89 | + | ||
90 | + | func getWavesRaised () = { | |
91 | + | let wavesRaised = getInteger(this, "wavesRaised") | |
92 | + | match wavesRaised { | |
93 | + | case waves: Int => | |
94 | + | waves | |
95 | + | case emptyState: Unit => | |
96 | + | 0 | |
97 | + | case _ => | |
98 | + | throw() | |
99 | + | } | |
100 | + | } | |
101 | + | ||
102 | + | ||
103 | + | func checkInvestorInPage (address,page) = { | |
104 | + | let whitelistPageKey = ("whitelistedInvestors-" + toString(page)) | |
105 | + | let whitelistPage = getString(this, whitelistPageKey) | |
106 | + | match whitelistPage { | |
107 | + | case pageString: String => | |
108 | + | let addressPosition = indexOf(pageString, address) | |
109 | + | match addressPosition { | |
110 | + | case pos: Int => | |
111 | + | true | |
112 | + | case empty: Unit => | |
113 | + | false | |
114 | + | case _ => | |
115 | + | throw() | |
116 | + | } | |
117 | + | case emptyPage: Unit => | |
118 | + | false | |
119 | + | case _ => | |
120 | + | throw() | |
121 | + | } | |
122 | + | } | |
123 | + | ||
124 | + | ||
125 | + | func checkInvestorInAllPages (address) = if (checkInvestorInPage(address, 0)) | |
126 | + | then true | |
127 | + | else if (checkInvestorInPage(address, 1)) | |
128 | + | then true | |
129 | + | else if (checkInvestorInPage(address, 2)) | |
130 | + | then true | |
131 | + | else if (checkInvestorInPage(address, 3)) | |
132 | + | then true | |
133 | + | else if (checkInvestorInPage(address, 4)) | |
134 | + | then true | |
135 | + | else if (checkInvestorInPage(address, 5)) | |
136 | + | then true | |
137 | + | else if (checkInvestorInPage(address, 6)) | |
138 | + | then true | |
139 | + | else if (checkInvestorInPage(address, 7)) | |
140 | + | then true | |
141 | + | else if (checkInvestorInPage(address, 8)) | |
142 | + | then true | |
143 | + | else if (checkInvestorInPage(address, 9)) | |
144 | + | then true | |
145 | + | else false | |
146 | + | ||
147 | + | ||
148 | + | func getMaxInvestment () = { | |
149 | + | let dataMaxInvestment = getInteger(this, "maxInvestment") | |
150 | + | match dataMaxInvestment { | |
151 | + | case changedMaxInvestment: Int => | |
152 | + | changedMaxInvestment | |
153 | + | case notChanged: Unit => | |
154 | + | maxInvestmentWaves | |
155 | + | case _ => | |
156 | + | throw() | |
157 | + | } | |
158 | + | } | |
159 | + | ||
160 | + | ||
161 | + | @Callable(i) | |
162 | + | func buyTokens () = { | |
163 | + | let investorAddress = toBase58String(i.caller.bytes) | |
164 | + | let sendedAmount = extract(i.payment).amount | |
165 | + | if ((0 >= sendedAmount)) | |
166 | + | then throw("Cannot accept zero value payments") | |
167 | + | else if ((sendedAmount > getMaxInvestment())) | |
168 | + | then throw("Attached payment is above maximum price") | |
169 | + | else if (!(hasStarted())) | |
170 | + | then throw("STO time is not started yet") | |
171 | + | else if (hasFinished()) | |
172 | + | then throw("STO is finalized") | |
173 | + | else if (hasEnded()) | |
174 | + | then throw("STO time is already ended") | |
175 | + | else { | |
176 | + | let wavesRaised = getWavesRaised() | |
177 | + | let wavesOffset = (wavesDecimals / tokenDecimalsOffset) | |
178 | + | let hardCapWaves = ((hardCapTokens / tokenRate) * wavesOffset) | |
179 | + | let updatedWavesRaised = (wavesRaised + sendedAmount) | |
180 | + | if ((updatedWavesRaised > hardCapWaves)) | |
181 | + | then throw("Attached payment overflows hardcap") | |
182 | + | else { | |
183 | + | let tokenAmountRaw = (sendedAmount * tokenRate) | |
184 | + | if ((wavesOffset > tokenAmountRaw)) | |
185 | + | then throw("Attached payment is too low to buy unit of token") | |
186 | + | else { | |
187 | + | let tokenAmount = (tokenAmountRaw / wavesOffset) | |
188 | + | ScriptResult(WriteSet([DataEntry("wavesRaised", updatedWavesRaised)]), TransferSet([ScriptTransfer(coldVault, sendedAmount, unit), ScriptTransfer(i.caller, tokenAmount, token)])) | |
189 | + | } | |
190 | + | } | |
191 | + | } | |
192 | + | } | |
193 | + | ||
194 | + | ||
195 | + | ||
196 | + | @Callable(i) | |
197 | + | func finalize () = if (!(onlyManager(i.caller.bytes))) | |
198 | + | then throw("Only for administration") | |
199 | + | else if (hasFinished()) | |
200 | + | then throw("Already finalized") | |
201 | + | else if (hasEnded()) | |
202 | + | then WriteSet([DataEntry("finalized", true)]) | |
203 | + | else throw("STO not finished yet") | |
204 | + | ||
205 | + | ||
206 | + | ||
207 | + | @Callable(i) | |
208 | + | func setStartTime (newStartTime) = if (!(onlyManager(i.caller.bytes))) | |
209 | + | then throw("Only for administration") | |
210 | + | else if (!(allowDatesChange)) | |
211 | + | then throw("changing dates is not supported") | |
212 | + | else if ((getTimeNow() >= newStartTime)) | |
213 | + | then throw("Cannot set time to past") | |
214 | + | else if ((newStartTime > getEndTime())) | |
215 | + | then throw("Start date must be lower than end date") | |
216 | + | else WriteSet([DataEntry("startTime", newStartTime)]) | |
217 | + | ||
218 | + | ||
219 | + | ||
220 | + | @Callable(i) | |
221 | + | func setEndTime (newEndTime) = if (!(onlyManager(i.caller.bytes))) | |
222 | + | then throw("Only for administration") | |
223 | + | else if (!(allowDatesChange)) | |
224 | + | then throw("changing dates is not supported") | |
225 | + | else if ((getTimeNow() >= newEndTime)) | |
226 | + | then throw("Cannot set time to past") | |
227 | + | else if ((getStartTime() > newEndTime)) | |
228 | + | then throw("End date must be higher than start date") | |
229 | + | else WriteSet([DataEntry("endTime", newEndTime)]) | |
230 | + | ||
231 | + | ||
232 | + | ||
233 | + | @Callable(i) | |
234 | + | func setStartAndEndTimes (newStartTime,newEndTime) = if (!(onlyManager(i.caller.bytes))) | |
235 | + | then throw("Only for administration") | |
236 | + | else if (!(allowDatesChange)) | |
237 | + | then throw("changing dates is not supported") | |
238 | + | else if ((getTimeNow() >= newStartTime)) | |
239 | + | then throw("Cannot set start time to past") | |
240 | + | else if ((newStartTime > newEndTime)) | |
241 | + | then throw("Start date must be lower than end date") | |
242 | + | else if ((getTimeNow() >= newEndTime)) | |
243 | + | then throw("Cannot set end time to past") | |
244 | + | else WriteSet([DataEntry("startTime", newStartTime), DataEntry("endTime", newEndTime)]) | |
245 | + | ||
246 | + | ||
247 | + | ||
248 | + | @Callable(i) | |
249 | + | func setMaxInvestment (newValue) = if (!(onlyManager(i.caller.bytes))) | |
250 | + | then throw("Only for administration") | |
251 | + | else WriteSet([DataEntry("maxInvestment", newValue)]) | |
252 | + | ||
253 | + | ||
254 | + | @Verifier(tx) | |
255 | + | func verify () = false | |
256 | + |
github/deemru/w8io/169f3d6 30.38 ms ◑