tx · 9C73MiLT9CzpsaJgaEsRhfzX6JhC8j4Tp4o84cYjg4f4

3MzBpTY7uS4oxEd7kN84QMDuPnXj2FkksRR:  -0.01000000 Waves

2019.08.29 12:02 [652296] smart account 3MzBpTY7uS4oxEd7kN84QMDuPnXj2FkksRR > SELF 0.00000000 Waves

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

github/deemru/w8io/026f985 
18.42 ms