tx · 3h2p49NqZaqT6Q7mcGAwygmdV6SDL3s9znNSFatbKQFq

3N9uu8FGXCiEyXVU2DYeHhEmGTZw6aq1if7:  -0.01000000 Waves

2019.07.25 17:26 [601694] smart account 3N9uu8FGXCiEyXVU2DYeHhEmGTZw6aq1if7 > SELF 0.00000000 Waves

{ "type": 13, "id": "3h2p49NqZaqT6Q7mcGAwygmdV6SDL3s9znNSFatbKQFq", "fee": 1000000, "feeAssetId": null, "timestamp": 1564064855221, "version": 1, "sender": "3N9uu8FGXCiEyXVU2DYeHhEmGTZw6aq1if7", "senderPublicKey": "52VjSU5Ufj6TjL4MpDNzWxx2royRffn2WS2dgN9xbFJ5", "proofs": [ "2g1JnTXgzKF4Ub2zP1hcibfosQoQN8FkQ5ZEgM1P6UHz3qVBKig2skKbx8ozhngUPMMQf1zRDnT6jQbmad66ud7A" ], "script": "base64:AAIDAAAAAAAAAAAAAAAZAAAAAA1pc3N1ZXJBc3NldElkAQAAACBIx5KobRD8WbUmaEOJ3Vw19bdi4XWPk4ooxE7lX3JLzgAAAAARaW52ZXN0bWVudEFzc2V0SWQBAAAABBOr2TMAAAAAGGludmVzdG1lbnRBc3NldElkSXNXYXZlcwYAAAAADm93bmVyUHVibGljS2V5AQAAAAcYBDc88OZCAAAAAAxvd25lckFkZHJlc3MJAQAAABRhZGRyZXNzRnJvbVB1YmxpY0tleQAAAAEFAAAADm93bmVyUHVibGljS2V5AAAAABJvd25lckFkZHJlc3NTdHJpbmcCAAAAIzNONDhkTFR2OVRTNzN5Y1dnaWJIZGhvaGcyNXJqb3hBZEVKAAAAABFhY2NvdW50VGhhdEFsbG93cwkBAAAAB0FkZHJlc3MAAAABAQAAABoBVMYbTDAWhUaVMk5pP6sw+hs730/Z1xCPOwAAAAAVYWNjb3VudFRoYXRBbGxvd0RBcHBzCQEAAAAHQWRkcmVzcwAAAAEBAAAAGgFUxhtMMBaFRpUyTmk/qzD6GzvfT9nXEI87AAAAAAthc3NldERpZ2l0cwAAAAAAAA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dG1lbnRBc3NldElkBQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABAAAAAckbWF0Y2gwBQAAAAJ0eAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAUU2V0U2NyaXB0VHJhbnNhY3Rpb24EAAAAAnR4BQAAAAckbWF0Y2gwCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleQcvGg1S", "chainId": 84, "height": 601694, "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 issuerAssetId = base58'5u6rjf4QRFs5DiN7X9Z3jetVdcrAjmEvoekpv3RycR33'
5+
6+let investmentAssetId = base58'WAVES'
7+
8+let investmentAssetIdIsWaves = true
9+
10+let ownerPublicKey = base58'undefined'
11+
12+let ownerAddress = addressFromPublicKey(ownerPublicKey)
13+
14+let ownerAddressString = "3N48dLTv9TS73ycWgibHdhohg25rjoxAdEJ"
15+
16+let accountThatAllows = Address(base58'3N7yaGaFS8BvgRrc9trhNy7v5H4qCcxW3Fp')
17+
18+let accountThatAllowDApps = Address(base58'3N7yaGaFS8BvgRrc9trhNy7v5H4qCcxW3Fp')
19+
20+let assetDigits = 1000000
21+
22+let sumAccountAssets = 100000000
23+
24+let issuerAssets = 0
25+
26+let startBlock = 601691
27+
28+let increasePriceBlock = 603748
29+
30+let endBlock = 603748
31+
32+let price = 100000000
33+
34+let priceSecond = 100000000
35+
36+let softCapAmount = 10000000000
37+
38+let hardCapAmount = 10000000000
39+
40+let keySumAmountPrefix = "sumAmount "
41+
42+let keySumPaidAmountPrefix = "paidAmount "
43+
44+let keySumAssetsPrefix = "sumAssets "
45+
46+let keyAllowAccountPrefix = "allow "
47+
48+let keyDistAssets = "assets"
49+
50+let keyCollectedAmount = "amount"
51+
52+let keyIssuer = "issuer"
53+
54+@Callable(i)
55+func deposit () = {
56+ let currentPrice = if ((increasePriceBlock > height))
57+ then price
58+ else priceSecond
59+ let accountAmount = match getInteger(this, keyCollectedAmount) {
60+ case a: Int =>
61+ a
62+ case _ =>
63+ 0
64+ }
65+ if ((startBlock > height))
66+ then throw(((("The Tokensale works between " + toString(startBlock)) + " and ") + toString(endBlock)))
67+ else if (if ((height > endBlock))
68+ then true
69+ else (accountAmount >= hardCapAmount))
70+ then throw("The required amount has already been accumulated. If you are an investor, you can withdraw your funds.")
71+ else {
72+ let payment = match i.payment {
73+ case p: AttachedPayment =>
74+ let isPaymentOk = match p.assetId {
75+ case assetId: ByteVector =>
76+ if (!(investmentAssetIdIsWaves))
77+ then (assetId == investmentAssetId)
78+ else false
79+ case _ =>
80+ (investmentAssetIdIsWaves == true)
81+ }
82+ if (isPaymentOk)
83+ then p.amount
84+ else throw("Invalid asset ID of investment")
85+ case _ =>
86+ throw("Payment must be attached")
87+ }
88+ let currentKey = toBase58String(i.caller.bytes)
89+ let isAccountAllow = match getInteger(accountThatAllows, currentKey) {
90+ case a: Int =>
91+ a
92+ case _ =>
93+ -255
94+ }
95+ if ((-1 > isAccountAllow))
96+ then throw("Your account has no right to send funds.")
97+ else {
98+ let accountAssets = match getInteger(this, keyDistAssets) {
99+ case a: Int =>
100+ a
101+ case _ =>
102+ sumAccountAssets
103+ }
104+ if ((0 > (accountAssets - ((payment * assetDigits) / currentPrice))))
105+ then throw((("Payment is too big. Maximum possible payment is " + toString(((accountAssets * currentPrice) / assetDigits))) + " wavelet"))
106+ else {
107+ let currentAmount = match getInteger(this, (keySumAmountPrefix + currentKey)) {
108+ case a: Int =>
109+ a
110+ case _ =>
111+ 0
112+ }
113+ let newAmount = (currentAmount + payment)
114+ let currentAssets = match getInteger(this, (keySumAssetsPrefix + currentKey)) {
115+ case a: Int =>
116+ a
117+ case _ =>
118+ 0
119+ }
120+ let newAssets = (currentAssets + ((payment * assetDigits) / currentPrice))
121+ let newAccountAssets = (accountAssets - ((payment * assetDigits) / currentPrice))
122+ let newAccountAmount = (accountAmount + payment)
123+ WriteSet([DataEntry((keySumAmountPrefix + currentKey), newAmount), DataEntry((keySumAssetsPrefix + currentKey), newAssets), DataEntry(keyDistAssets, newAccountAssets), DataEntry(keyCollectedAmount, newAccountAmount)])
124+ }
125+ }
126+ }
127+ }
128+
129+
130+
131+@Callable(i)
132+func withdrawal () = {
133+ let isDAppAllow = match getInteger(accountThatAllowDApps, toString(this)) {
134+ case a: Int =>
135+ a
136+ case _ =>
137+ 0
138+ }
139+ if ((isDAppAllow == 0))
140+ then throw("Withdrawals are not available until the issuer passes verification")
141+ else {
142+ let currentKey = toBase58String(i.caller.bytes)
143+ let currentAssets = match getInteger(this, (keySumAssetsPrefix + currentKey)) {
144+ case a: Int =>
145+ a
146+ case _ =>
147+ 0
148+ }
149+ let currentAmount = match getInteger(this, (keySumAmountPrefix + currentKey)) {
150+ case a: Int =>
151+ a
152+ case _ =>
153+ 0
154+ }
155+ let accountAmount = match getInteger(this, keyCollectedAmount) {
156+ case a: Int =>
157+ a
158+ case _ =>
159+ 0
160+ }
161+ let accountAssets = match getInteger(this, keyDistAssets) {
162+ case a: Int =>
163+ a
164+ case _ =>
165+ 0
166+ }
167+ if (!(if ((height > endBlock))
168+ then true
169+ else (accountAmount >= hardCapAmount)))
170+ then throw(("The Tokensale end on block " + toString(endBlock)))
171+ else if (if (if ((currentKey == ownerAddressString))
172+ then (accountAmount >= softCapAmount)
173+ else false)
174+ then (isDAppAllow == 1)
175+ else false)
176+ then {
177+ let currentIssuerPaidAssets = match getInteger(this, keyIssuer) {
178+ case a: Int =>
179+ a
180+ case _ =>
181+ 0
182+ }
183+ if ((currentIssuerPaidAssets == 0))
184+ then ScriptResult(WriteSet([DataEntry(keyIssuer, (accountAssets + issuerAssets))]), TransferSet([ScriptTransfer(ownerAddress, (accountAssets + issuerAssets), issuerAssetId), ScriptTransfer(ownerAddress, accountAmount, investmentAssetId)]))
185+ else throw("The issuer has already taken its share!")
186+ }
187+ else if ((currentAmount == 0))
188+ then throw("Don't have money")
189+ else if (if ((accountAmount >= softCapAmount))
190+ then (isDAppAllow == 1)
191+ else false)
192+ then ScriptResult(WriteSet([DataEntry((keySumAmountPrefix + currentKey), 0), DataEntry((keySumAssetsPrefix + currentKey), 0)]), TransferSet([ScriptTransfer(i.caller, currentAssets, issuerAssetId)]))
193+ else ScriptResult(WriteSet([DataEntry((keySumAmountPrefix + currentKey), 0), DataEntry((keySumAssetsPrefix + currentKey), 0)]), TransferSet([ScriptTransfer(i.caller, currentAmount, investmentAssetId)]))
194+ }
195+ }
196+
197+
198+@Verifier(tx)
199+func verify () = match tx {
200+ case tx: SetScriptTransaction =>
201+ sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
202+ case _ =>
203+ false
204+}
205+

github/deemru/w8io/026f985 
17.86 ms