tx · 5iXxxFzFthwBsBFNCUEVi42Um8n6dfjVz2cnKN32CrzD

3MwJgoFVv4YFZDkQREUXDPxSq2AnSQNrBip:  -0.01000000 Waves

2019.08.09 15:44 [623456] smart account 3MwJgoFVv4YFZDkQREUXDPxSq2AnSQNrBip > SELF 0.00000000 Waves

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

github/deemru/w8io/026f985 
16.74 ms