tx · 393FJkFUXJipFJhhBoDz5R1b8nGbkBieQkmmvpxdyaRe
3MrAr1PgXYYPi8hSBif9z4dHSDkUkaL8VHS: -0.01400000 Waves
2021.08.17 18:21 [1662514] smart account 3MrAr1PgXYYPi8hSBif9z4dHSDkUkaL8VHS > SELF 0.00000000 Waves
{
"type": 13,
"id": "393FJkFUXJipFJhhBoDz5R1b8nGbkBieQkmmvpxdyaRe",
"fee": 1400000,
"feeAssetId": null,
"timestamp": 1629213756700,
"version": 2,
"chainId": 84,
"sender": "3MrAr1PgXYYPi8hSBif9z4dHSDkUkaL8VHS",
"senderPublicKey": "4Jye1zP9d4RPVyK435sPSyfLahkhcYHaP8GzMZcGTCuE",
"proofs": [
"2zP1gV9Gmbn6XgaveZD7eznvotQUqHASisyL6iQiQRTAWjPM1xoSUDGZbVXbAJo3aNeCY7t8wAfv86QG2uTpeFTw"
],
"script": "base64:AAIFAAAAAAAAAWsIAhIAEgMKAQIaEQoCYTESC0dsb2JhbFN0b3JlGhAKAmEyEgpFdmVudFN0b3JlGhoKAmEzEhRPd25lclNldEN1cnJlbnRJbmRleBoLCgJhNBIFc3RvcmUaFQoCYTUSD093bmVyU2V0QnlJbmRleBoLCgJhNhIFaW5kZXgaEQoCYTcSC0luaXRpYWxpemVkGhMKAmE4Eg1UcmFuc2FjdGlvbklkGg4KAmE5EghPbGRPd25lchoOCgJiMRIITmV3T3duZXIaCwoCYjISBU93bmVyGg4KAmIzEghvd25lclNldBoOCgJiNBIIb2xkT3duZXIaDgoCYjUSCG5ld093bmVyGg0KAmI2EgckbWF0Y2gwGgcKAmI3EgFpGhMKAmI4Eg1pc0luaXRpYWxpemVkGg0KAmI5Egdpc093bmVyGgwKAmMxEgZjYWxsZXIaBwoCYzISAXYaCAoCYzMSAnR4GgwKAmM0EgZ2ZXJpZnkAAAAMAAAAAAJhMQIAAAAGZ2xvYmFsAAAAAAJhMgIAAAAFZXZlbnQBAAAAAmEzAAAAAQAAAAJhNAkAASwAAAACBQAAAA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AAAAmExAQAAAAJiOQAAAAEAAAACYzEEAAAAAmI2CQAEIQAAAAEJAQAAAAJiMgAAAAEFAAAAAmExAwkAAAEAAAACBQAAAAJiNgIAAAAKQnl0ZVZlY3RvcgQAAAACYzIFAAAAAmI2CQAAAAAAAAIFAAAAAmMyCAUAAAACYzEAAAAFYnl0ZXMHAAAAAgAAAAJiNwEAAAAEaW5pdAAAAAADCQEAAAACYjgAAAAACQAAAgAAAAECAAAAHENvbnRyYWN0IGFscmVhZHkgaW5pdGlhbGl6ZWQJAAROAAAAAgkBAAAAAmIzAAAAAgUAAAAEdW5pdAgFAAAAAmI3AAAABmNhbGxlcgkABEwAAAACCQEAAAAMQm9vbGVhbkVudHJ5AAAAAgkBAAAAAmE3AAAAAQUAAAACYTEGBQAAAANuaWwAAAACYjcBAAAAC2NoYW5nZU93bmVyAAAAAQAAAAJiNQQAAAACYjQIBQAAAAJiNwAAAAZjYWxsZXIDCQEAAAABIQAAAAEJAQAAAAJiOQAAAAEFAAAAAmI0CQAAAgAAAAECAAAAE0NhbGxlciBpcyBub3Qgb3duZXIJAQAAAAJiMwAAAAIFAAAAAmI0CQEAAAAHQWRkcmVzcwAAAAEFAAAAAmI1AAAAAQAAAAJjMwEAAAACYzQAAAAACQAB9AAAAAMIBQAAAAJjMwAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAmMzAAAABnByb29mcwAAAAAAAAAAAAgFAAAAAmMzAAAAD3NlbmRlclB1YmxpY0tleRe0acE=",
"height": 1662514,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: 7AVsx83Usaz4EtCNwNrXbRN9DaBF6aEXJUtTTRkCagbX
Next: 3VkiZvH8q94a729XDmtn8WU6KxURgPQhLj1wxepqannc
Diff:
Old | New | | Differences |
---|
9 | 9 | | |
---|
10 | 10 | | |
---|
11 | 11 | | func OwnerSetByIndex (store,index) = (((store + "ownerSet[") + toString(index)) + "]") |
---|
| 12 | + | |
---|
| 13 | + | |
---|
| 14 | + | func Initialized (store) = (store + "_initialized") |
---|
12 | 15 | | |
---|
13 | 16 | | |
---|
14 | 17 | | func TransactionId (store) = (store + "_tx") |
---|
|
34 | 37 | | } |
---|
35 | 38 | | |
---|
36 | 39 | | |
---|
| 40 | + | func isInitialized () = isDefined(getBoolean(Initialized(GlobalStore))) |
---|
| 41 | + | |
---|
| 42 | + | |
---|
37 | 43 | | func isOwner (caller) = match getBinary(Owner(GlobalStore)) { |
---|
38 | 44 | | case v: ByteVector => |
---|
39 | 45 | | (v == caller.bytes) |
---|
|
43 | 49 | | |
---|
44 | 50 | | |
---|
45 | 51 | | @Callable(i) |
---|
46 | | - | func init () = { |
---|
47 | | - | let owner = i.caller |
---|
48 | | - | ownerSet(unit, i.caller) |
---|
49 | | - | } |
---|
| 52 | + | func init () = if (isInitialized()) |
---|
| 53 | + | then throw("Contract already initialized") |
---|
| 54 | + | else (ownerSet(unit, i.caller) ++ [BooleanEntry(Initialized(GlobalStore), true)]) |
---|
50 | 55 | | |
---|
51 | 56 | | |
---|
52 | 57 | | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 5 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let GlobalStore = "global" |
---|
5 | 5 | | |
---|
6 | 6 | | let EventStore = "event" |
---|
7 | 7 | | |
---|
8 | 8 | | func OwnerSetCurrentIndex (store) = (EventStore + "_ownerSet_current") |
---|
9 | 9 | | |
---|
10 | 10 | | |
---|
11 | 11 | | func OwnerSetByIndex (store,index) = (((store + "ownerSet[") + toString(index)) + "]") |
---|
| 12 | + | |
---|
| 13 | + | |
---|
| 14 | + | func Initialized (store) = (store + "_initialized") |
---|
12 | 15 | | |
---|
13 | 16 | | |
---|
14 | 17 | | func TransactionId (store) = (store + "_tx") |
---|
15 | 18 | | |
---|
16 | 19 | | |
---|
17 | 20 | | func OldOwner (store) = (store + "_oldOwner") |
---|
18 | 21 | | |
---|
19 | 22 | | |
---|
20 | 23 | | func NewOwner (store) = (store + "_newOwner") |
---|
21 | 24 | | |
---|
22 | 25 | | |
---|
23 | 26 | | func Owner (store) = (store + "_owner") |
---|
24 | 27 | | |
---|
25 | 28 | | |
---|
26 | 29 | | func ownerSet (oldOwner,newOwner) = { |
---|
27 | 30 | | let index = match getInteger(OwnerSetCurrentIndex(EventStore)) { |
---|
28 | 31 | | case i: Int => |
---|
29 | 32 | | (i + 1) |
---|
30 | 33 | | case _ => |
---|
31 | 34 | | 0 |
---|
32 | 35 | | } |
---|
33 | 36 | | [BinaryEntry(Owner(GlobalStore), newOwner.bytes), IntegerEntry(OwnerSetCurrentIndex(EventStore), index), BinaryEntry(OldOwner(OwnerSetByIndex(EventStore, index)), newOwner.bytes), BinaryEntry(NewOwner(OwnerSetByIndex(EventStore, index)), newOwner.bytes)] |
---|
34 | 37 | | } |
---|
35 | 38 | | |
---|
36 | 39 | | |
---|
| 40 | + | func isInitialized () = isDefined(getBoolean(Initialized(GlobalStore))) |
---|
| 41 | + | |
---|
| 42 | + | |
---|
37 | 43 | | func isOwner (caller) = match getBinary(Owner(GlobalStore)) { |
---|
38 | 44 | | case v: ByteVector => |
---|
39 | 45 | | (v == caller.bytes) |
---|
40 | 46 | | case _ => |
---|
41 | 47 | | false |
---|
42 | 48 | | } |
---|
43 | 49 | | |
---|
44 | 50 | | |
---|
45 | 51 | | @Callable(i) |
---|
46 | | - | func init () = { |
---|
47 | | - | let owner = i.caller |
---|
48 | | - | ownerSet(unit, i.caller) |
---|
49 | | - | } |
---|
| 52 | + | func init () = if (isInitialized()) |
---|
| 53 | + | then throw("Contract already initialized") |
---|
| 54 | + | else (ownerSet(unit, i.caller) ++ [BooleanEntry(Initialized(GlobalStore), true)]) |
---|
50 | 55 | | |
---|
51 | 56 | | |
---|
52 | 57 | | |
---|
53 | 58 | | @Callable(i) |
---|
54 | 59 | | func changeOwner (newOwner) = { |
---|
55 | 60 | | let oldOwner = i.caller |
---|
56 | 61 | | if (!(isOwner(oldOwner))) |
---|
57 | 62 | | then throw("Caller is not owner") |
---|
58 | 63 | | else ownerSet(oldOwner, Address(newOwner)) |
---|
59 | 64 | | } |
---|
60 | 65 | | |
---|
61 | 66 | | |
---|
62 | 67 | | @Verifier(tx) |
---|
63 | 68 | | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) |
---|
64 | 69 | | |
---|