tx · FXnNxieuFemMQfuYW2JFe6qW1fhrKtFDxt5Rk5JLsihS 3MriZGLhQEu1jMDKDAbnsbh6TZuZueBAHSY: -0.05000000 Waves 2021.03.17 17:40 [1441862] smart account 3MriZGLhQEu1jMDKDAbnsbh6TZuZueBAHSY > SELF 0.00000000 Waves
{ "type": 13, "id": "FXnNxieuFemMQfuYW2JFe6qW1fhrKtFDxt5Rk5JLsihS", "fee": 5000000, "feeAssetId": null, "timestamp": 1615991996607, "version": 2, "chainId": 84, "sender": "3MriZGLhQEu1jMDKDAbnsbh6TZuZueBAHSY", "senderPublicKey": "3idTJAmqkivFDf1EUKZ85Tt43Rp22pZb3RDiVXTWrgBq", "proofs": [ "ZKK19AxdeCzdZUMAmTKKRbGRFLDqo6uAqR4sU84tQo6wvBN7KPTfWzEdzDWMu8WQC5bCQNWYwL2xePMVExwZs7j" ], "script": "base64:AAIEAAAAAAAAAAsIAhIDCgEIEgASAAAAAAkAAAAAEXRhc2tTdGF0dXNEZWZhdWx0AgAAAAppbmNvbXBsZXRlAAAAABJ0YXNrU3RhdHVzQ29tcGxldGUCAAAACGNvbXBsZXRlAAAAAAd3YXZlc0lkBQAAAAR1bml0AAAAABJhc3NldE5mdEluaXRBbW91bnQAAAAAAAAAAAEAAAAAEGFzc2V0TmZ0RGVjaW1hbHMAAAAAAAAAAAAAAAAAEmFzc2V0TmZ0UmVpc3N1YWJsZQcAAAAAF2Fzc2V0QW1vdW50TWluVGhyZXNob2xkAAAAAAAAAAPoAAAAABJkZWNpbWFsc0Fzc2V0V2F2ZXMAAAAAAAAAAAgAAAAAD2xhYmVsVGFza0lkTGFzdAIAAAAKdGFza0lkTGFzdAAAAAMAAAABaQEAAAAHc2V0VGFzawAAAAEAAAAIdGFza05hbWUEAAAACnRhc2tMYXN0SWQDCQEAAAAJaXNEZWZpbmVkAAAAAQkABBoAAAACBQAAAAR0aGlzBQAAAA9sYWJlbFRhc2tJZExhc3QJAABkAAAAAgkBAAAAEUBleHRyTmF0aX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RPdXRwdXRJZEFtb3VudAUAAAAHd2F2ZXNJZAkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABBQAAAA9sYWJlbFRhc2tBbW91bnQJAARMAAAAAgkBAAAAC0RlbGV0ZUVudHJ5AAAAAQUAAAAPbGFiZWxUYXNrU3RhdHVzCQAETAAAAAIJAQAAAAtEZWxldGVFbnRyeQAAAAEFAAAADWxhYmVsVGFza05hbWUFAAAAA25pbAMJAAAAAAAAAgUAAAAKdGFza1N0YXR1cwUAAAASdGFza1N0YXR1c0NvbXBsZXRlCQAETAAAAAIJAQAAAAtEZWxldGVFbnRyeQAAAAEFAAAAD2xhYmVsVGFza0Ftb3VudAkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABBQAAAA9sYWJlbFRhc2tTdGF0dXMJAARMAAAAAgkBAAAAC0RlbGV0ZUVudHJ5AAAAAQUAAAANbGFiZWxUYXNrTmFtZQUAAAADbmlsCQAAAgAAAAECAAAAGVRhc2sgaGF2ZSBhIGJyb2tlbiBzdGF0dXMJAAACAAAAAQIAAAAeQXR0YWNoZWQgYXNzZXQgaXMgbm90IGV4cGVjdGVkAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXlk7+Ap", "height": 1441862, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Fo4v8L2EFybJBcdJxykFUA7JujeTyFWMEtnhx3aXFKN3 Next: none Diff:
Old | New | Differences | |
---|---|---|---|
26 | 26 | else 1 | |
27 | 27 | let assetName = ("task #" + toString(taskLastId)) | |
28 | 28 | let assetDescription = ("NFT-token of task manager from" + toString(this)) | |
29 | - | let | |
29 | + | let pmtAmount = i.payments[0].amount | |
30 | 30 | let nftIssue = Issue(assetName, assetDescription, assetNftInitAmount, assetNftDecimals, assetNftReissuable) | |
31 | 31 | let nftIssueId = toBase58String(calculateAssetId(nftIssue)) | |
32 | 32 | let labelTaskName = ("taskName_" + nftIssueId) | |
40 | 40 | then throw((("amount must be greater than the minimum threshold: " + toString(assetAmountMinThreshold)) + " WAVES")) | |
41 | 41 | else if ((i.caller == this)) | |
42 | 42 | then throw("method may not be called from the contract") | |
43 | - | else [StringEntry(labelTaskName, taskName), StringEntry(labelTaskStatus, taskStatusDefault), nftIssue, ScriptTransfer(i.caller, assetNftInitAmount, fromBase58String(nftIssueId)), IntegerEntry(labelTaskAmount, | |
43 | + | else [StringEntry(labelTaskName, taskName), StringEntry(labelTaskStatus, taskStatusDefault), nftIssue, ScriptTransfer(i.caller, assetNftInitAmount, fromBase58String(nftIssueId)), IntegerEntry(labelTaskAmount, pmtAmount), IntegerEntry(labelTaskIdLast, taskLastId)] | |
44 | 44 | } | |
45 | 45 | ||
46 | 46 | ||
47 | 47 | ||
48 | 48 | @Callable(i) | |
49 | 49 | func completeTask () = { | |
50 | - | let $ | |
51 | - | let | |
52 | - | let | |
53 | - | let labelTaskStatus = ("taskStatus_" + toBase58String( | |
54 | - | let labelTaskAmount = ("taskAmount_" + toBase58String( | |
55 | - | let | |
56 | - | let | |
50 | + | let $t019402064 = $Tuple2(i.payments[0].amount, valueOrErrorMessage(i.payments[0].assetId, "Attached asset is not expected")) | |
51 | + | let pmtAmount = $t019402064._1 | |
52 | + | let pmtId = $t019402064._2 | |
53 | + | let labelTaskStatus = ("taskStatus_" + toBase58String(pmtId)) | |
54 | + | let labelTaskAmount = ("taskAmount_" + toBase58String(pmtId)) | |
55 | + | let stringPmtId = toBase58String(value(i.payments[0].assetId)) | |
56 | + | let infoPmt = valueOrErrorMessage(assetInfo(value(i.payments[0].assetId)), (("Asset " + stringPmtId) + " doesn't exist")) | |
57 | 57 | let intAssetOutputIdAmount = getIntegerValue(this, labelTaskAmount) | |
58 | 58 | if ((size(i.payments) != 1)) | |
59 | 59 | then throw("One attached assets expected") | |
61 | 61 | then throw("method may not be called from the contract") | |
62 | 62 | else if (!(isDefined(getString(this, labelTaskStatus)))) | |
63 | 63 | then throw("Attached asset is not expected") | |
64 | - | else [StringEntry(labelTaskStatus, taskStatusComplete), Burn( | |
64 | + | else [StringEntry(labelTaskStatus, taskStatusComplete), Burn(pmtId, pmtAmount), ScriptTransfer(i.caller, intAssetOutputIdAmount, wavesId)] | |
65 | 65 | } | |
66 | 66 | ||
67 | 67 | ||
68 | 68 | ||
69 | 69 | @Callable(i) | |
70 | 70 | func removeTask () = { | |
71 | - | let $ | |
72 | - | let | |
73 | - | let | |
74 | - | let labelTaskAmount = ("taskAmount_" + toBase58String( | |
75 | - | let labelTaskStatus = ("taskStatus_" + toBase58String( | |
76 | - | let labelTaskName = ("taskName_" + toBase58String( | |
77 | - | let | |
78 | - | let | |
71 | + | let $t030213130 = $Tuple2(i.payments[0].amount, value(i.payments[0].assetId)) | |
72 | + | let pmtAmount = $t030213130._1 | |
73 | + | let pmtId = $t030213130._2 | |
74 | + | let labelTaskAmount = ("taskAmount_" + toBase58String(pmtId)) | |
75 | + | let labelTaskStatus = ("taskStatus_" + toBase58String(pmtId)) | |
76 | + | let labelTaskName = ("taskName_" + toBase58String(pmtId)) | |
77 | + | let stringPmtId = toBase58String(value(i.payments[0].assetId)) | |
78 | + | let infoPmt = valueOrErrorMessage(assetInfo(value(i.payments[0].assetId)), (("Asset " + stringPmtId) + " doesn't exist")) | |
79 | 79 | if ((size(i.payments) != 1)) | |
80 | 80 | then throw("One attached assets expected") | |
81 | 81 | else if ((i.caller == this)) | |
88 | 88 | else false) | |
89 | 89 | then { | |
90 | 90 | let intAssetOutputIdAmount = (getIntegerValue(this, labelTaskAmount) / 2) | |
91 | - | [Burn( | |
91 | + | [Burn(pmtId, pmtAmount), ScriptTransfer(i.caller, intAssetOutputIdAmount, wavesId), DeleteEntry(labelTaskAmount), DeleteEntry(labelTaskStatus), DeleteEntry(labelTaskName)] | |
92 | 92 | } | |
93 | 93 | else if ((taskStatus == taskStatusComplete)) | |
94 | 94 | then [DeleteEntry(labelTaskAmount), DeleteEntry(labelTaskStatus), DeleteEntry(labelTaskName)] |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let taskStatusDefault = "incomplete" | |
5 | 5 | ||
6 | 6 | let taskStatusComplete = "complete" | |
7 | 7 | ||
8 | 8 | let wavesId = unit | |
9 | 9 | ||
10 | 10 | let assetNftInitAmount = 1 | |
11 | 11 | ||
12 | 12 | let assetNftDecimals = 0 | |
13 | 13 | ||
14 | 14 | let assetNftReissuable = false | |
15 | 15 | ||
16 | 16 | let assetAmountMinThreshold = 1000 | |
17 | 17 | ||
18 | 18 | let decimalsAssetWaves = 8 | |
19 | 19 | ||
20 | 20 | let labelTaskIdLast = "taskIdLast" | |
21 | 21 | ||
22 | 22 | @Callable(i) | |
23 | 23 | func setTask (taskName) = { | |
24 | 24 | let taskLastId = if (isDefined(getInteger(this, labelTaskIdLast))) | |
25 | 25 | then (getIntegerValue(this, labelTaskIdLast) + 1) | |
26 | 26 | else 1 | |
27 | 27 | let assetName = ("task #" + toString(taskLastId)) | |
28 | 28 | let assetDescription = ("NFT-token of task manager from" + toString(this)) | |
29 | - | let | |
29 | + | let pmtAmount = i.payments[0].amount | |
30 | 30 | let nftIssue = Issue(assetName, assetDescription, assetNftInitAmount, assetNftDecimals, assetNftReissuable) | |
31 | 31 | let nftIssueId = toBase58String(calculateAssetId(nftIssue)) | |
32 | 32 | let labelTaskName = ("taskName_" + nftIssueId) | |
33 | 33 | let labelTaskStatus = ("taskStatus_" + nftIssueId) | |
34 | 34 | let labelTaskAmount = ("taskAmount_" + nftIssueId) | |
35 | 35 | if ((size(i.payments) != 1)) | |
36 | 36 | then throw("One attached assets expected") | |
37 | 37 | else if ((i.payments[0].assetId != wavesId)) | |
38 | 38 | then throw("must be attached asset: WAVES") | |
39 | 39 | else if ((assetAmountMinThreshold > i.payments[0].amount)) | |
40 | 40 | then throw((("amount must be greater than the minimum threshold: " + toString(assetAmountMinThreshold)) + " WAVES")) | |
41 | 41 | else if ((i.caller == this)) | |
42 | 42 | then throw("method may not be called from the contract") | |
43 | - | else [StringEntry(labelTaskName, taskName), StringEntry(labelTaskStatus, taskStatusDefault), nftIssue, ScriptTransfer(i.caller, assetNftInitAmount, fromBase58String(nftIssueId)), IntegerEntry(labelTaskAmount, | |
43 | + | else [StringEntry(labelTaskName, taskName), StringEntry(labelTaskStatus, taskStatusDefault), nftIssue, ScriptTransfer(i.caller, assetNftInitAmount, fromBase58String(nftIssueId)), IntegerEntry(labelTaskAmount, pmtAmount), IntegerEntry(labelTaskIdLast, taskLastId)] | |
44 | 44 | } | |
45 | 45 | ||
46 | 46 | ||
47 | 47 | ||
48 | 48 | @Callable(i) | |
49 | 49 | func completeTask () = { | |
50 | - | let $ | |
51 | - | let | |
52 | - | let | |
53 | - | let labelTaskStatus = ("taskStatus_" + toBase58String( | |
54 | - | let labelTaskAmount = ("taskAmount_" + toBase58String( | |
55 | - | let | |
56 | - | let | |
50 | + | let $t019402064 = $Tuple2(i.payments[0].amount, valueOrErrorMessage(i.payments[0].assetId, "Attached asset is not expected")) | |
51 | + | let pmtAmount = $t019402064._1 | |
52 | + | let pmtId = $t019402064._2 | |
53 | + | let labelTaskStatus = ("taskStatus_" + toBase58String(pmtId)) | |
54 | + | let labelTaskAmount = ("taskAmount_" + toBase58String(pmtId)) | |
55 | + | let stringPmtId = toBase58String(value(i.payments[0].assetId)) | |
56 | + | let infoPmt = valueOrErrorMessage(assetInfo(value(i.payments[0].assetId)), (("Asset " + stringPmtId) + " doesn't exist")) | |
57 | 57 | let intAssetOutputIdAmount = getIntegerValue(this, labelTaskAmount) | |
58 | 58 | if ((size(i.payments) != 1)) | |
59 | 59 | then throw("One attached assets expected") | |
60 | 60 | else if ((i.caller == this)) | |
61 | 61 | then throw("method may not be called from the contract") | |
62 | 62 | else if (!(isDefined(getString(this, labelTaskStatus)))) | |
63 | 63 | then throw("Attached asset is not expected") | |
64 | - | else [StringEntry(labelTaskStatus, taskStatusComplete), Burn( | |
64 | + | else [StringEntry(labelTaskStatus, taskStatusComplete), Burn(pmtId, pmtAmount), ScriptTransfer(i.caller, intAssetOutputIdAmount, wavesId)] | |
65 | 65 | } | |
66 | 66 | ||
67 | 67 | ||
68 | 68 | ||
69 | 69 | @Callable(i) | |
70 | 70 | func removeTask () = { | |
71 | - | let $ | |
72 | - | let | |
73 | - | let | |
74 | - | let labelTaskAmount = ("taskAmount_" + toBase58String( | |
75 | - | let labelTaskStatus = ("taskStatus_" + toBase58String( | |
76 | - | let labelTaskName = ("taskName_" + toBase58String( | |
77 | - | let | |
78 | - | let | |
71 | + | let $t030213130 = $Tuple2(i.payments[0].amount, value(i.payments[0].assetId)) | |
72 | + | let pmtAmount = $t030213130._1 | |
73 | + | let pmtId = $t030213130._2 | |
74 | + | let labelTaskAmount = ("taskAmount_" + toBase58String(pmtId)) | |
75 | + | let labelTaskStatus = ("taskStatus_" + toBase58String(pmtId)) | |
76 | + | let labelTaskName = ("taskName_" + toBase58String(pmtId)) | |
77 | + | let stringPmtId = toBase58String(value(i.payments[0].assetId)) | |
78 | + | let infoPmt = valueOrErrorMessage(assetInfo(value(i.payments[0].assetId)), (("Asset " + stringPmtId) + " doesn't exist")) | |
79 | 79 | if ((size(i.payments) != 1)) | |
80 | 80 | then throw("One attached assets expected") | |
81 | 81 | else if ((i.caller == this)) | |
82 | 82 | then throw("method may not be called from the contract") | |
83 | 83 | else if (isDefined(getString(this, labelTaskStatus))) | |
84 | 84 | then { | |
85 | 85 | let taskStatus = getString(this, labelTaskStatus) | |
86 | 86 | if (if ((taskStatus == taskStatusDefault)) | |
87 | 87 | then (value(i.payments[0].amount) == assetNftInitAmount) | |
88 | 88 | else false) | |
89 | 89 | then { | |
90 | 90 | let intAssetOutputIdAmount = (getIntegerValue(this, labelTaskAmount) / 2) | |
91 | - | [Burn( | |
91 | + | [Burn(pmtId, pmtAmount), ScriptTransfer(i.caller, intAssetOutputIdAmount, wavesId), DeleteEntry(labelTaskAmount), DeleteEntry(labelTaskStatus), DeleteEntry(labelTaskName)] | |
92 | 92 | } | |
93 | 93 | else if ((taskStatus == taskStatusComplete)) | |
94 | 94 | then [DeleteEntry(labelTaskAmount), DeleteEntry(labelTaskStatus), DeleteEntry(labelTaskName)] | |
95 | 95 | else throw("Task have a broken status") | |
96 | 96 | } | |
97 | 97 | else throw("Attached asset is not expected") | |
98 | 98 | } | |
99 | 99 | ||
100 | 100 | ||
101 | 101 | @Verifier(tx) | |
102 | 102 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
103 | 103 |
github/deemru/w8io/026f985 32.57 ms ◑