tx · 7PF38XBNjytqqoyrZRPzUBVRGhJ8xpyKjmUErPH1VZvn

3MutTVXh7Z2m9Cfzx982D4nm7h9Yzr3Ra9a:  -0.01400000 Waves

2021.05.08 15:54 [1516734] smart account 3MutTVXh7Z2m9Cfzx982D4nm7h9Yzr3Ra9a > SELF 0.00000000 Waves

{ "type": 13, "id": "7PF38XBNjytqqoyrZRPzUBVRGhJ8xpyKjmUErPH1VZvn", "fee": 1400000, "feeAssetId": null, "timestamp": 1620478471907, "version": 2, "chainId": 84, "sender": "3MutTVXh7Z2m9Cfzx982D4nm7h9Yzr3Ra9a", "senderPublicKey": "98wdUyX2hd6XAj7ggvLJURbxcMbJum5CnatqPwMxv9Pw", "proofs": [ "5UPp7ZCuC1HvTJgbgSF9iCbcVHP5aWzqssrRBGnQ2hWL1TWKGbwZcu3zRC958uLYezjwbk9cXKnpD9gStkox6MEH" ], "script": "base64:AAIEAAAAAAAAAAQIAhIAAAAAAAAAAAEAAAABaQEAAAAEY2FsbAAAAAAEAAAABWFzc2V0CQAEQwAAAAcCAAAABUFzc2V0AgAAAAAAAAAAAAAAAAEAAAAAAAAAAAAGBQAAAAR1bml0AAAAAAAAAAAABAAAAAdhc3NldElkCQAEOAAAAAEFAAAABWFzc2V0CQAETAAAAAIJAQAAAAtCaW5hcnlFbnRyeQAAAAICAAAAA2JpbgEAAAAACQAETAAAAAIJAQAAAAxCb29sZWFuRW50cnkAAAACAgAAAARib29sBgkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgIAAAADaW50AAAAAAAAAAABCQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAICAAAAA3N0cgIAAAAACQAETAAAAAIJAQAAAAtEZWxldGVFbnRyeQAAAAECAAAAA3N0cgkABEwAAAACBQAAAAVhc3NldAkABEwAAAACCQEAAAAHUmVpc3N1ZQAAAAMFAAAAB2Fzc2V0SWQAAAAAAAAAAAEHCQAETAAAAAIJAQAAAARCdXJuAAAAAgUAAAAHYXNzZXRJZAAAAAAAAAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIAAAAAAAAAAAEFAAAAB2Fzc2V0SWQFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5KOU8bg==", "height": 1516734, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GnAQ2wAHZuyCQxmSUhTgJjy8WQ8ifg5o4KiWX9bdCLcE Next: none Full:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let appVersion = 3
5-
6-let appName = "NibelNet Vault"
7-
8-let appGenesisHeight = 1456230
9-
10-let separator = "_"
11-
12-let waves = "WAVES"
13-
14-let maxInt = 9223372036854775807
15-
16-let insuranceName = "Insurance"
17-
18-let receiptName = "Receipt"
19-
20-let iDuplicateName = "DuInsurance"
21-
22-let rDuplicateName = "DuReceipt"
23-
24-let insuranceType = "i"
25-
26-let receiptType = "r"
27-
28-let duplicateType = "d"
29-
30-let conclusionType = "c"
31-
32-let keyNonce = "nonce"
33-
34-let keyAppIsFree = "app_is_free"
35-
36-let keyAppPrivateKey = "app_private_key"
37-
38-let keyAppVersion = "app_version"
39-
40-let keyAppFreeSinceHeight = "app_free_since_height"
41-
42-let keyAppName = "app_name"
43-
44-let keyType = "type"
45-
46-let keyHeight = "height"
47-
48-let keySigner = "signer"
49-
50-let keyAsset = "asset"
51-
52-let keyAmount = "amount"
53-
54-let keyInsuranceHeight = "insurance_height"
55-
56-let keyInsuranceSigner = "insurance_signer"
57-
58-let keyInsuranceId = "insurance_asset_id"
59-
60-let keyReceiptId = "receipt_asset_id"
61-
62-let keyDuplicateOf = "duplicate_of_asset_id"
63-
64-let keyDuplicateType = "duplicate_type"
65-
66-func hasAccess (caller) = if (if ((caller == this))
67- then true
68- else (appGenesisHeight > height))
69- then throw("Access denied")
70- else unit
714
725
73-func getNonce () = {
74- let nonce = valueOrElse(getInteger(this, keyNonce), 0)
75- if ((nonce >= maxInt))
76- then 1
77- else (nonce + 1)
6+@Callable(i)
7+func call () = {
8+ let asset = Issue("Asset", "", 1, 0, true, unit, 0)
9+ let assetId = calculateAssetId(asset)
10+[BinaryEntry("bin", base58''), BooleanEntry("bool", true), IntegerEntry("int", 1), StringEntry("str", ""), DeleteEntry("str"), asset, Reissue(assetId, 1, false), Burn(assetId, 1), ScriptTransfer(i.caller, 1, assetId)]
7811 }
7912
8013
81-func inRange (integer,mini,maxi) = if ((integer >= mini))
82- then (maxi >= integer)
83- else false
84-
85-
86-func with (str1,str2) = ((str1 + separator) + str2)
87-
88-
89-func assetTypeValidation (info,enforceType) = if ((info.issuer != this))
90- then throw("Unknown issuer")
91- else {
92- let type = getStringValue(this, with(keyType, toBase58String(info.id)))
93- let isInsurance = if ((info.name == insuranceName))
94- then (type == insuranceType)
95- else false
96- let isReceipt = if ((info.name == receiptType))
97- then (type == receiptType)
98- else false
99- match enforceType {
100- case isType: String =>
101- if (if (if (isInsurance)
102- then (isType == insuranceType)
103- else false)
104- then true
105- else if (isReceipt)
106- then (isType == receiptType)
107- else false)
108- then info
109- else throw("Unknown type")
110- case _ =>
111- if (if (!(isInsurance))
112- then !(isReceipt)
113- else false)
114- then throw("Unknown type")
115- else info
116- }
117- }
118-
119-
120-@Callable(i)
121-func deposit () = valueOrElse(hasAccess(i.caller), if (if ((size(i.payments) != 1))
122- then true
123- else !(inRange(i.payments[0].amount, 1, maxInt)))
124- then throw("Require one valid payment")
125- else {
126- let assetId = match i.payments[0].assetId {
127- case isAsset: ByteVector =>
128- toBase58String(valueOrErrorMessage(assetInfo(isAsset), "Unknown asset").id)
129- case isWaves: Unit =>
130- waves
131- case _ =>
132- throw("Unknown asset type")
133- }
134- let nonce = getNonce()
135- let insuranceSigner = toString(i.caller)
136- let insuranceDesc = makeString([appName, insuranceName, "| Height:", toString(height), "| Signer:", insuranceSigner, "| Asset ID:", assetId, "| Amount:", toString(i.payments[0].amount), "(includes decimals)"], " ")
137- let insuranceIssue = Issue(insuranceName, insuranceDesc, 1, 0, false, unit, nonce)
138- let insuranceId = calculateAssetId(insuranceIssue)
139- let id = toBase58String(insuranceId)
140-[IntegerEntry(keyNonce, nonce), insuranceIssue, ScriptTransfer(i.caller, 1, insuranceId), StringEntry(with(keyType, id), insuranceType), IntegerEntry(with(keyHeight, id), height), StringEntry(with(keySigner, id), insuranceSigner), StringEntry(with(keyAsset, id), assetId), IntegerEntry(with(keyAmount, id), i.payments[0].amount)]
141- })
142-
143-
144-
145-@Callable(i)
146-func withdraw () = valueOrElse(hasAccess(i.caller), if (if ((size(i.payments) != 1))
147- then true
148- else (i.payments[0].amount != 1))
149- then throw("Require one NFT payment")
150- else {
151- let insuranceInfo = assetTypeValidation(valueOrErrorMessage(assetInfo(valueOrErrorMessage(i.payments[0].assetId, "No Waves payment")), "Unknown asset"), insuranceType)
152- let insuranceId = toBase58String(insuranceInfo.id)
153- let insuranceHeight = getIntegerValue(this, with(keyHeight, insuranceId))
154- let insuranceSigner = getStringValue(this, with(keySigner, insuranceId))
155- let insuranceAsset = getStringValue(this, with(keyAsset, insuranceId))
156- let insuranceAssetAmount = getIntegerValue(this, with(keyAmount, insuranceId))
157- let nonce = getNonce()
158- let receiptSigner = toString(i.caller)
159- let receiptDesc = makeString([appName, receiptName, "| Insurance Height:", toString(insuranceHeight), "| Insurance Signer:", insuranceSigner, "| Insurance ID:", insuranceId, "| Asset ID:", insuranceAsset, "| Amount:", toString(insuranceAssetAmount), "(includes decimals)", "| Height:", toString(height), "| Signer:", receiptSigner], " ")
160- let receiptIssue = Issue(receiptName, receiptDesc, 1, 0, false, unit, nonce)
161- let receiptId = calculateAssetId(receiptIssue)
162- let id = toBase58String(receiptId)
163- let receiptAssetTranfer = match assetInfo(fromBase58String(insuranceAsset)) {
164- case isAsset: Asset =>
165- ScriptTransfer(i.caller, insuranceAssetAmount, isAsset.id)
166- case maybeWaves =>
167- if ((insuranceAsset == waves))
168- then ScriptTransfer(i.caller, insuranceAssetAmount, unit)
169- else throw("Unknown asset")
170- }
171-[IntegerEntry(keyNonce, nonce), Burn(insuranceInfo.id, 1), receiptIssue, ScriptTransfer(i.caller, 1, receiptId), receiptAssetTranfer, StringEntry(with(keyType, insuranceId), conclusionType), StringEntry(with(keyReceiptId, insuranceId), id), StringEntry(with(keyType, id), receiptType), IntegerEntry(with(keyInsuranceHeight, id), insuranceHeight), StringEntry(with(keyInsuranceSigner, id), insuranceSigner), StringEntry(with(keyInsuranceId, id), insuranceId), StringEntry(with(keyAsset, id), insuranceAsset), IntegerEntry(with(keyAmount, id), insuranceAssetAmount), IntegerEntry(with(keyHeight, id), height), StringEntry(with(keySigner, id), receiptSigner)]
172- })
173-
174-
175-
176-@Callable(i)
177-func claim (claimAssetId) = valueOrElse(hasAccess(i.caller), if ((size(i.payments) != 0))
178- then throw("No need payment")
179- else {
180- let claimAssetInfo = assetTypeValidation(valueOrErrorMessage(assetInfo(fromBase58String(claimAssetId)), "Unknown asset"), unit)
181- if ((assetBalance(this, claimAssetInfo.id) != 1))
182- then throw("Insuffisant balance")
183- else if ((toString(i.caller) != getStringValue(this, with(keySigner, claimAssetId))))
184- then throw("Caller isn't last signer")
185- else [ScriptTransfer(i.caller, 1, claimAssetInfo.id)]
186- })
187-
188-
189-
190-@Callable(i)
191-func duplicate (toDuplicateId) = valueOrElse(hasAccess(i.caller), if ((size(i.payments) != 0))
192- then throw("No need payment")
193- else {
194- let toDuplicateInfo = assetTypeValidation(valueOrErrorMessage(assetInfo(fromBase58String(toDuplicateId)), "Unknown asset"), unit)
195- let toDuplicateType = getStringValue(this, with(keyType, toDuplicateId))
196- if ((assetBalance(i.caller, toDuplicateInfo.id) != 1))
197- then throw("Caller isn't owner")
198- else {
199- let nonce = getNonce()
200- let duplicateSigner = toString(i.caller)
201- let $t079328406 = if ((toDuplicateType == insuranceType))
202- then $Tuple2(iDuplicateName, makeString([appName, iDuplicateName, "| Insurance ID:", toDuplicateId, "| Height:", toString(height), "| Duplicate Signer:", duplicateSigner], " "))
203- else $Tuple2(rDuplicateName, makeString([appName, rDuplicateName, "| Receipt ID:", toDuplicateId, "| Height:", toString(height), "| Duplicate Signer:", duplicateSigner], " "))
204- let duplicateName = $t079328406._1
205- let duplicateDesc = $t079328406._2
206- let duplicateIssue = Issue(duplicateName, duplicateDesc, 1, 0, false, unit, nonce)
207- let duplicateId = calculateAssetId(duplicateIssue)
208- let id = toBase58String(duplicateId)
209-[IntegerEntry(keyNonce, nonce), duplicateIssue, ScriptTransfer(i.caller, 1, duplicateId), StringEntry(with(keyType, id), duplicateType), IntegerEntry(with(keyHeight, id), height), StringEntry(with(keyDuplicateType, id), toDuplicateType), StringEntry(with(keyDuplicateOf, id), toDuplicateId), StringEntry(with(keySigner, id), duplicateSigner)]
210- }
211- })
212-
213-
214-
215-@Callable(i)
216-func freedom (privKey) = if (if ((this != i.caller))
217- then true
218- else valueOrElse(getBoolean(this, keyAppIsFree), false))
219- then throw("Access denied")
220- else [BooleanEntry(keyAppIsFree, true), StringEntry(keyAppPrivateKey, privKey), IntegerEntry(keyAppVersion, appVersion), StringEntry(keyAppName, appName), IntegerEntry(keyAppFreeSinceHeight, height)]
221-
222-
22314 @Verifier(tx)
224-func verify () = if (valueOrElse(getBoolean(this, keyAppIsFree), false))
225- then false
226- else match tx {
227- case isUpdate: SetScriptTransaction =>
228- sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
229- case _ =>
230- false
231- }
15+func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
23216

github/deemru/w8io/169f3d6 
42.51 ms