tx · 2D6qNz6SxcHoQiURM9wU6ie8gPmT3GwkLoTxsh2XFpQr

3N5YzdqDE6FDdsLNGXU4G4yrmirb2oiifEc:  -0.01000000 Waves

2022.10.19 11:00 [2279007] smart account 3N5YzdqDE6FDdsLNGXU4G4yrmirb2oiifEc > SELF 0.00000000 Waves

{ "type": 13, "id": "2D6qNz6SxcHoQiURM9wU6ie8gPmT3GwkLoTxsh2XFpQr", "fee": 1000000, "feeAssetId": null, "timestamp": 1666166473097, "version": 2, "chainId": 84, "sender": "3N5YzdqDE6FDdsLNGXU4G4yrmirb2oiifEc", "senderPublicKey": "E3rsNDJ7CyVzRYUkm1k4GYLuZYYxzQioRgWedzPYXTSL", "proofs": [ "3cRAgra5gxmd99sVsvmSLss9rgd6vtkYMrsendmCmr1izRLieAb6yc7Rvpq2rzbAanUz3nbMdb2Ln5kY194W1WwC" ], "script": "base64:AAIFAAAAAAAAAAcIAhIDCgEIAAAABgAAAAAJdm90ZUFzc2V0AQAAACAtNxOB0yQ3XZ/hb3bT0Q+T7yws9N2JrVxKVuh8yQFyGwAAAAAPbmV3UHVycG9zZVByaWNlAAAAAAJUC+QAAAAAAAx2b3RlRHVyYXRpb24JAABoAAAAAgAAAAAAAAAABwAAAAAAAAAFoAAAAAANbmV3UHVycG9zZUtleQIAAAAHcHVycG9zZQAAAAAMcHVycG9zZUlkS2V5AgAAAAlwdXJwb3NlSWQBAAAAC2lzUGF5bWVudE9rAAAAAQAAAAFpBAAAABFhY2NlcHRhYmxlQXNzZXRJZAUAAAAJdm90ZUFzc2V0AwkAAAAAAAACCQABkAAAAAEIBQAAAAFpAAAACHBheW1lbnRzAAAAAAAAAAAACQAAAgAAAAECAAAAFFBheW1lbnQgbm90IGF0dGFjaGVkBAAAAAFwCQABkQAAAAIIBQAAAAFpAAAACHBheW1lbnRzAAAAAAAAAAAABAAAAAckbWF0Y2gwCAUAAAABcAAAAAdhc3NldElkAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAApCeXRlVm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AJpZAUAAAAEdGV4dAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgUAAAAMcHVycG9zZUlkS2V5BQAAAAJpZAkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACBQAAAA1uZXdQdXJwb3NlS2V5AgAAAAFfCQABpAAAAAEFAAAAAmlkAgAAAAlfZHVyYXRpb24JAAEsAAAAAgkAASwAAAACCQABpAAAAAEFAAAAC3N0YXJ0SGVpZ2h0AgAAAAFfCQABpAAAAAEFAAAACWVuZEhlaWdodAkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACBQAAAA1uZXdQdXJwb3NlS2V5AgAAAAFfCQABpAAAAAEFAAAAAmlkAgAAAAZfb3duZXIFAAAACmN1cnJlbnRLZXkFAAAAA25pbAAAAABSZir8", "height": 2279007, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: 2H62WQsMcwSECDUJx4pgxTBTrsX1V1F2eGHHKEB3gZfr Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 5 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let voteAsset = base58'43W4FcqA1rEpSmUGHoGiXvpSLfhadws9LS5j3SJsKxxS'
5+
6+let newPurposePrice = 10000000000
7+
8+let voteDuration = (7 * 1440)
9+
10+let newPurposeKey = "purpose"
11+
12+let purposeIdKey = "purposeId"
13+
14+func isPaymentOk (i) = {
15+ let acceptableAssetId = voteAsset
16+ if ((size(i.payments) == 0))
17+ then throw("Payment not attached")
18+ else {
19+ let p = i.payments[0]
20+ match p.assetId {
21+ case assetId: ByteVector =>
22+ if ((assetId == acceptableAssetId))
23+ then (p.amount == newPurposePrice)
24+ else false
25+ case _ =>
26+ throw("Wrong payment asset")
27+ }
28+ }
29+ }
30+
31+
32+@Callable(i)
33+func newPurpose (purpose) = {
34+ let stringSize = size(toBytes(purpose))
35+ let currentKey = toBase58String(i.caller.bytes)
36+ let purposeId = valueOrElse(getInteger(this, purposeIdKey), 1)
37+ if (if ((stringSize > 200))
38+ then true
39+ else (10 > stringSize))
40+ then throw("Purpose text cannot be more than 200")
41+ else if (!(isPaymentOk(i)))
42+ then throw(("you have to pay " + toString(newPurposePrice)))
43+ else {
44+ let startHeight = height
45+ let endHeight = (height + voteDuration)
46+ let text = toBase64String(toBytes(purpose))
47+ let id = (purposeId + 1)
48+[StringEntry(((newPurposeKey + "_") + toString(id)), text), IntegerEntry(purposeIdKey, id), StringEntry((((newPurposeKey + "_") + toString(id)) + "_duration"), ((toString(startHeight) + "_") + toString(endHeight))), StringEntry((((newPurposeKey + "_") + toString(id)) + "_owner"), currentKey)]
49+ }
50+ }
51+
52+

github/deemru/w8io/169f3d6 
20.31 ms