tx · BxcGsmAkx7SpMUgH8yBxP2MCdVbiJwnjYTFJXhhmxcye 3MxbD7vwyGjwsRxT8fmMB9fngo59VfHcrea: -0.00900000 Waves 2022.08.18 18:49 [2190124] smart account 3MxbD7vwyGjwsRxT8fmMB9fngo59VfHcrea > SELF 0.00000000 Waves
{ "type": 13, "id": "BxcGsmAkx7SpMUgH8yBxP2MCdVbiJwnjYTFJXhhmxcye", "fee": 900000, "feeAssetId": null, "timestamp": 1660837770108, "version": 2, "chainId": 84, "sender": "3MxbD7vwyGjwsRxT8fmMB9fngo59VfHcrea", "senderPublicKey": "7kBiESqWjiW6nNeStcbrVX9XRQkWmUM51MZFRZNQEVfR", "proofs": [ "2vKwAcG5VGHedkqxXv5m9dmZejsccLRXH4Eqq2V5Hurvc3NBup3Z1gN2y43L6JFo7cp41iowekMAoUGvcUxA7eMr" ], "script": "base64:AAIFAAAAAAAAABEIAhIDCgEBEgMKAQgSAwoBCAAAAAgAAAAABWFkbWluAQAAABoBVF7PmnzOmgX2jKLcdeBrYASwnejG9qYGLwAAAAALY29hbEFzc2V0SWQBAAAAIDHg1fVAt3Hphex6Dm+3r1K6I7ymQhydmjuZJeiJho7mAQAAAA10cnlHZXRJbnRlZ2VyAAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWIFAAAAByRtYXRjaDAFAAAAAWIAAAAAAAAAAAABAAAADXRyeUdldEJvb2xlYW4AAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABBsAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAB0Jvb2xlYW4EAAAAAWIFAAAAByRtYXRjaDAFAAAAAWIHAQAAAA5nZXRBc3NldFN0cmluZwAAAAEAAAAHYXNzZXRJZAQAAAAHJG1hdGNoMAUAAAAHYXNzZXRJZAMJAAABAAAAAgUAAAAHJG1h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 0 } View: original | compacted Prev: 3ryMzRJZow8UxQDi9A6KdAGsZXXo27B4tLBvui9gmEmX Next: 4x9zKyqjLs787CtcMWRJnVg5PNaeuU8azyKwZD4mBEM4 Diff:
Old | New | Differences | |
---|---|---|---|
75 | 75 | then throw("Already finished") | |
76 | 76 | else if ((lifetime == 0)) | |
77 | 77 | then throw("Cannot find furnace") | |
78 | - | else if ((finisHeight > height)) | |
78 | + | else if (if ((lastBurn > 0)) | |
79 | + | then (finisHeight >= height) | |
80 | + | else false) | |
79 | 81 | then throw("Time is run out") | |
80 | 82 | else if ((size(i.payments) != 1)) | |
81 | 83 | then throw("You should to provide payment") |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let admin = base58'3MxZPzVdHQYNjp99N7VRuR4RLmJUqnDg9ok' | |
5 | 5 | ||
6 | 6 | let coalAssetId = base58'4MhpjsP1MPpC49v6zBr7eAAEPZdmHWcrSqcSv8tZcpjo' | |
7 | 7 | ||
8 | 8 | func tryGetInteger (key) = match getInteger(this, key) { | |
9 | 9 | case b: Int => | |
10 | 10 | b | |
11 | 11 | case _ => | |
12 | 12 | 0 | |
13 | 13 | } | |
14 | 14 | ||
15 | 15 | ||
16 | 16 | func tryGetBoolean (key) = match getBoolean(this, key) { | |
17 | 17 | case b: Boolean => | |
18 | 18 | b | |
19 | 19 | case _ => | |
20 | 20 | false | |
21 | 21 | } | |
22 | 22 | ||
23 | 23 | ||
24 | 24 | func getAssetString (assetId) = match assetId { | |
25 | 25 | case b: ByteVector => | |
26 | 26 | toBase58String(b) | |
27 | 27 | case _ => | |
28 | 28 | "WAVES" | |
29 | 29 | } | |
30 | 30 | ||
31 | 31 | ||
32 | 32 | func tryGetString (key) = match getString(this, key) { | |
33 | 33 | case b: String => | |
34 | 34 | b | |
35 | 35 | case _ => | |
36 | 36 | "" | |
37 | 37 | } | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func tryGetBinary (key) = match getBinary(this, key) { | |
41 | 41 | case b: ByteVector => | |
42 | 42 | b | |
43 | 43 | case _ => | |
44 | 44 | base58'' | |
45 | 45 | } | |
46 | 46 | ||
47 | 47 | ||
48 | 48 | func getAssetBytes (assetIdStr) = if ((assetIdStr == "WAVES")) | |
49 | 49 | then unit | |
50 | 50 | else fromBase58String(assetIdStr) | |
51 | 51 | ||
52 | 52 | ||
53 | 53 | @Callable(i) | |
54 | 54 | func createFurnace (lifetime) = if ((toBase58String(i.caller.bytes) != toBase58String(admin))) | |
55 | 55 | then throw("You cannot create furnace") | |
56 | 56 | else if ((size(i.payments) != 1)) | |
57 | 57 | then throw("You should to provide reward") | |
58 | 58 | else { | |
59 | 59 | let rewardAmount = i.payments[0].amount | |
60 | 60 | let rewardAssetId = i.payments[0].assetId | |
61 | 61 | let newFurnacesAmount = (tryGetInteger("global_furnacesAmount") + 1) | |
62 | 62 | let furnaceId = toString(newFurnacesAmount) | |
63 | 63 | [IntegerEntry("global_furnacesAmount", newFurnacesAmount), IntegerEntry((("furnace_" + furnaceId) + "_lifetime"), lifetime), IntegerEntry((("furnace_" + furnaceId) + "_rewardAmount"), rewardAmount), StringEntry((("furnace_" + furnaceId) + "_rewardAssetId"), getAssetString(rewardAssetId))] | |
64 | 64 | } | |
65 | 65 | ||
66 | 66 | ||
67 | 67 | ||
68 | 68 | @Callable(i) | |
69 | 69 | func burn (furnaceId) = { | |
70 | 70 | let isFinished = tryGetBoolean((("furnace_" + furnaceId) + "_finished")) | |
71 | 71 | let lifetime = tryGetInteger((("furnace_" + furnaceId) + "_lifetime")) | |
72 | 72 | let lastBurn = tryGetInteger((("furnace_" + furnaceId) + "_lastBurn")) | |
73 | 73 | let finisHeight = (lastBurn + lifetime) | |
74 | 74 | if (isFinished) | |
75 | 75 | then throw("Already finished") | |
76 | 76 | else if ((lifetime == 0)) | |
77 | 77 | then throw("Cannot find furnace") | |
78 | - | else if ((finisHeight > height)) | |
78 | + | else if (if ((lastBurn > 0)) | |
79 | + | then (finisHeight >= height) | |
80 | + | else false) | |
79 | 81 | then throw("Time is run out") | |
80 | 82 | else if ((size(i.payments) != 1)) | |
81 | 83 | then throw("You should to provide payment") | |
82 | 84 | else if ((i.payments[0].assetId != coalAssetId)) | |
83 | 85 | then throw("Invalid coal") | |
84 | 86 | else if ((i.payments[0].amount != 1)) | |
85 | 87 | then throw("You can burn only 1 coal") | |
86 | 88 | else { | |
87 | 89 | let callerAddress = toBase58String(i.caller.bytes) | |
88 | 90 | [Burn(coalAssetId, i.payments[0].amount), IntegerEntry((("furnace_" + furnaceId) + "_lastBurn"), height), StringEntry((("furnace_" + furnaceId) + "_lastStoker"), callerAddress)] | |
89 | 91 | } | |
90 | 92 | } | |
91 | 93 | ||
92 | 94 | ||
93 | 95 | ||
94 | 96 | @Callable(i) | |
95 | 97 | func claim (furnaceId) = { | |
96 | 98 | let isFinished = tryGetBoolean((("furnace_" + furnaceId) + "_finished")) | |
97 | 99 | let lifetime = tryGetInteger((("furnace_" + furnaceId) + "_lifetime")) | |
98 | 100 | let lastBurn = tryGetInteger((("furnace_" + furnaceId) + "_lastBurn")) | |
99 | 101 | let rewardAsset = tryGetString((("furnace_" + furnaceId) + "_rewardAssetId")) | |
100 | 102 | let lastStoker = tryGetString((("furnace_" + furnaceId) + "_lastStoker")) | |
101 | 103 | let rewardAmount = tryGetInteger((("furnace_" + furnaceId) + "_rewardAmount")) | |
102 | 104 | let finishHeight = (lastBurn + lifetime) | |
103 | 105 | if (isFinished) | |
104 | 106 | then throw("Already finished") | |
105 | 107 | else if ((lifetime == 0)) | |
106 | 108 | then throw("Cannot find furnace") | |
107 | 109 | else if ((lastBurn == 0)) | |
108 | 110 | then throw("Furnace not found") | |
109 | 111 | else if ((finishHeight > height)) | |
110 | 112 | then throw("Time has not run out") | |
111 | 113 | else if ((rewardAsset == "")) | |
112 | 114 | then throw("Cannot find reward asset") | |
113 | 115 | else if ((lastStoker == "")) | |
114 | 116 | then throw("Cannot find last stoker") | |
115 | 117 | else if ((rewardAmount == 0)) | |
116 | 118 | then throw("Reward already sent to winner") | |
117 | 119 | else [BooleanEntry((("furnace_" + furnaceId) + "_finished"), true), ScriptTransfer(Address(fromBase58String(lastStoker)), rewardAmount, getAssetBytes(rewardAsset))] | |
118 | 120 | } | |
119 | 121 | ||
120 | 122 | ||
121 | 123 | @Verifier(tx) | |
122 | 124 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
123 | 125 |
github/deemru/w8io/03bedc9 36.44 ms ◑![]()