tx · 4qDLFSfwpzVtdLkTJrh9hK6W3LPUKAxXWEWDW58GG5pC

3N5u3T8dmqaRxKKNUXsECJa5Hvv4teCTXYL:  -0.01000000 Waves

2019.08.21 20:22 [641186] smart account 3N5u3T8dmqaRxKKNUXsECJa5Hvv4teCTXYL > SELF 0.00000000 Waves

{ "type": 13, "id": "4qDLFSfwpzVtdLkTJrh9hK6W3LPUKAxXWEWDW58GG5pC", "fee": 1000000, "feeAssetId": null, "timestamp": 1566408227881, "version": 1, "sender": "3N5u3T8dmqaRxKKNUXsECJa5Hvv4teCTXYL", "senderPublicKey": "5g7ojwPedmiH5VhTimF6AyJjFvyTyVEBbbYjLJpE1aok", "proofs": [ "5WcpTQz5uvn3vNAryM85qs8gPyVE3TvAvY7bPhbf67SPNWfHoi2QMXmPhpfaNZXJHMJ1jDK4icfEAMJMc69HJm9U" ], "script": "base64:AAIDAAAAAAAAAAAAAAAZAAAAAA1pc3N1ZXJBc3NldElkAQAAACAF7JugxxWOYKAn8KBqmznDnbW1QZy9kN4Ox/Q/DGfFvwAAAAARaW52ZXN0bWVudEFzc2V0SWQBAAAAIKUSt2QTaYe7I8TmazUtP5W5UKTGKYykO9ISPNm6lmgwAAAAABhpbnZlc3RtZW50QXNzZXRJZElzV2F2ZXMHAAAAAA5vd25lclB1YmxpY0tleQEAAAAg3JXo11i3zZs6Kxg2WSqbxZrzrUfQAVHhEpJkqd5+3WMAAAAADG93bmVyQWRkcmVzcwkBAAAAFGFkZHJlc3NGcm9tUHVibGljS2V5AAAAAQUAAAAOb3duZXJQdWJsaWNLZXkAAAAAEm93bmVyQWRkcmVzc1N0cmluZwIAAAAjM014TVAyNjNxdGZhNW1pWXBuOTMxcnB0RTVrNnFqdDhVSngAAAAAEWFjY291bnRUaGF0QWxsb3dzCQEAAAAHQWRkcmVzcwAAAAEBAAAAGgFUsuKbPrsJRAk2hWi4lia9MhdtRoVBFCA1AAAAABVhY2NvdW50VGhhdEFsbG93REFwcHMJAQAAAAdBZGRyZ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Y3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAANY3VycmVudEFtb3VudAUAAAARaW52ZXN0bWVudEFzc2V0SWQFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAEAAAAByRtYXRjaDAFAAAAAnR4AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABRTZXRTY3JpcHRUcmFuc2FjdGlvbgQAAAACdHgFAAAAByRtYXRjaDAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5B8Jnx7o=", "chainId": 84, "height": 641186, "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'Q8J9rMGbZrgZrRSxHLdhKyrhRkBSRsBX1Q8VgPyekqC'
5+
6+let investmentAssetId = base58'C7NpjX1zJ1JrSGw8AvpBwfwUHU44a2u6mhCjdkJgXgrT'
7+
8+let investmentAssetIdIsWaves = false
9+
10+let ownerPublicKey = base58'Fr5GuccUrGsbMVXpMZ9Eebrqy5iXxsqyAzHqrNvxkBqL'
11+
12+let ownerAddress = addressFromPublicKey(ownerPublicKey)
13+
14+let ownerAddressString = "3MxMP263qtfa5miYpn931rptE5k6qjt8UJx"
15+
16+let accountThatAllows = Address(base58'3N6DwWxT82nGJUwBwd7L514r2u71gr7WhwJ')
17+
18+let accountThatAllowDApps = Address(base58'3N1SPvLZgv6FMfe5WNUtnPzt3okYxcJhYnR')
19+
20+let assetDigits = 1000000
21+
22+let sumAccountAssets = 100000000
23+
24+let issuerAssets = 0
25+
26+let startBlock = 641185
27+
28+let increasePriceBlock = 643242
29+
30+let endBlock = 643242
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/169f3d6 
23.61 ms