tx · 89qDxPZ5dGY41vX2PPfezQgysh8wfvbhY4NXD9noH17J 3N4upXkARvecPGQAtpSQ11CFASTFsvEPiP2: -0.01000000 Waves 2022.02.22 12:31 [1934686] smart account 3N4upXkARvecPGQAtpSQ11CFASTFsvEPiP2 > SELF 0.00000000 Waves
{ "type": 13, "id": "89qDxPZ5dGY41vX2PPfezQgysh8wfvbhY4NXD9noH17J", "fee": 1000000, "feeAssetId": null, "timestamp": 1645522282177, "version": 2, "chainId": 84, "sender": "3N4upXkARvecPGQAtpSQ11CFASTFsvEPiP2", "senderPublicKey": "5dTGvAkGC1ryvEkRCst923pqULtN3qWs6XXueerWos1D", "proofs": [ "jNEgAmPfp5LkByL9HDMoyZyXTy5BSU8pb5ESCqpnPkCtn7PmbfAzAkTGLLTohBVMhGDHokthEbQDPetQXS7ZQkA" ], "script": "base64:AAIFAAAAAAAAAAwIAhIDCgEIEgMKAQgAAAAEAAAAAAdrZXlIZWFkAgAAAARoZWFkAQAAAAdrZXlQcmV2AAAAAQAAAAJpZAkAASwAAAACBQAAAAJpZAIAAAAGX19wcmV2AQAAAAdrZXlOZXh0AAAAAQAAAAJpZAkAASwAAAACBQAAAAJpZAIAAAAGX19uZXh0AAAAAARoZWFkCQAEHQAAAAIFAAAABHRoaXMFAAAAB2tleUhlYWQAAAACAAAAAWkBAAAABmluc2VydAAAAAEAAAACaWQEAAAADHN0YXRlQ2hhbmdlcwkABE4AAAACCQAETgAAAAIFAAAAA25pbAMJAQAAAAlpc0RlZmluZWQAAAABBQAAAARoZWFkCQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAIJAQAAAAdrZXlOZXh0AAAAAQUAAAACaWQJAQAAAAV2YWx1ZQAAAAEFAAAABGhlYWQJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkBAAAAB2tleVByZXYAAAABCQEAAAAFdmFsdWUAAAABBQAAAARoZWFkBQAAAAJpZAUAAAADbmlsBQAAAANuaWwJAARMAAAAAgkBAAA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CQEAAAAJaXNEZWZpbmVkAAAAAQUAAAAEcHJldgkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABCQEAAAAHa2V5UHJldgAAAAEFAAAAAmlkCQAETAAAAAIJAQAAAAtEZWxldGVFbnRyeQAAAAEJAQAAAAdrZXlOZXh0AAAAAQkBAAAABXZhbHVlAAAAAQUAAAAEcHJldgUAAAADbmlsAwkAAAAAAAACBQAAAAJpZAUAAAAEaGVhZAkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABBQAAAAdrZXlIZWFkBQAAAANuaWwJAAACAAAAAQIAAAAMSW52YWxpZCBub2RlCQAFFAAAAAIFAAAADHN0YXRlQ2hhbmdlcwUAAAAEdW5pdAAAAABu8F2h", "height": 1934686, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: TFnwoHWWX5STpJhde4Bo8LQ1Zyj5igTxWNZ2cgzCXm5 Next: CqxKxLgE9WGTo23kyKgAah2N8qP22fm6jyggB4NtWzzp Diff:
Old | New | Differences | |
---|---|---|---|
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let keyHead = "head" | |
5 | + | ||
6 | + | func keyPrev (id) = (id + "__prev") | |
7 | + | ||
8 | + | ||
9 | + | func keyNext (id) = (id + "__next") | |
10 | + | ||
5 | 11 | ||
6 | 12 | let head = getString(this, keyHead) | |
7 | 13 | ||
8 | 14 | @Callable(i) | |
9 | 15 | func insert (id) = { | |
10 | 16 | let stateChanges = ((nil ++ (if (isDefined(head)) | |
11 | - | then [StringEntry((id | |
17 | + | then [StringEntry(keyNext(id), value(head)), StringEntry(keyPrev(value(head)), id)] | |
12 | 18 | else nil)) ++ [StringEntry(keyHead, id)]) | |
13 | 19 | $Tuple2(stateChanges, unit) | |
14 | 20 | } | |
17 | 23 | ||
18 | 24 | @Callable(i) | |
19 | 25 | func delete (id) = { | |
20 | - | let stateChanges = ((nil ++ (if (isDefined(head)) | |
21 | - | then [StringEntry((id + "_next"), value(head))] | |
22 | - | else nil)) ++ [StringEntry(keyHead, id)]) | |
26 | + | let prev = getString(this, keyPrev(id)) | |
27 | + | let next = getString(this, keyNext(id)) | |
28 | + | let stateChanges = if (if (isDefined(prev)) | |
29 | + | then isDefined(next) | |
30 | + | else false) | |
31 | + | then [StringEntry(keyNext(value(prev)), value(next)), StringEntry(keyPrev(value(next)), value(prev)), DeleteEntry(keyPrev(id)), DeleteEntry(keyNext(id))] | |
32 | + | else if (isDefined(next)) | |
33 | + | then [StringEntry(keyHead, value(next)), DeleteEntry(keyNext(id)), DeleteEntry(keyPrev(value(next)))] | |
34 | + | else if (isDefined(prev)) | |
35 | + | then [DeleteEntry(keyPrev(id)), DeleteEntry(keyNext(value(prev)))] | |
36 | + | else if ((id == head)) | |
37 | + | then [DeleteEntry(keyHead)] | |
38 | + | else throw("Invalid node") | |
23 | 39 | $Tuple2(stateChanges, unit) | |
24 | 40 | } | |
25 | 41 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let keyHead = "head" | |
5 | + | ||
6 | + | func keyPrev (id) = (id + "__prev") | |
7 | + | ||
8 | + | ||
9 | + | func keyNext (id) = (id + "__next") | |
10 | + | ||
5 | 11 | ||
6 | 12 | let head = getString(this, keyHead) | |
7 | 13 | ||
8 | 14 | @Callable(i) | |
9 | 15 | func insert (id) = { | |
10 | 16 | let stateChanges = ((nil ++ (if (isDefined(head)) | |
11 | - | then [StringEntry((id | |
17 | + | then [StringEntry(keyNext(id), value(head)), StringEntry(keyPrev(value(head)), id)] | |
12 | 18 | else nil)) ++ [StringEntry(keyHead, id)]) | |
13 | 19 | $Tuple2(stateChanges, unit) | |
14 | 20 | } | |
15 | 21 | ||
16 | 22 | ||
17 | 23 | ||
18 | 24 | @Callable(i) | |
19 | 25 | func delete (id) = { | |
20 | - | let stateChanges = ((nil ++ (if (isDefined(head)) | |
21 | - | then [StringEntry((id + "_next"), value(head))] | |
22 | - | else nil)) ++ [StringEntry(keyHead, id)]) | |
26 | + | let prev = getString(this, keyPrev(id)) | |
27 | + | let next = getString(this, keyNext(id)) | |
28 | + | let stateChanges = if (if (isDefined(prev)) | |
29 | + | then isDefined(next) | |
30 | + | else false) | |
31 | + | then [StringEntry(keyNext(value(prev)), value(next)), StringEntry(keyPrev(value(next)), value(prev)), DeleteEntry(keyPrev(id)), DeleteEntry(keyNext(id))] | |
32 | + | else if (isDefined(next)) | |
33 | + | then [StringEntry(keyHead, value(next)), DeleteEntry(keyNext(id)), DeleteEntry(keyPrev(value(next)))] | |
34 | + | else if (isDefined(prev)) | |
35 | + | then [DeleteEntry(keyPrev(id)), DeleteEntry(keyNext(value(prev)))] | |
36 | + | else if ((id == head)) | |
37 | + | then [DeleteEntry(keyHead)] | |
38 | + | else throw("Invalid node") | |
23 | 39 | $Tuple2(stateChanges, unit) | |
24 | 40 | } | |
25 | 41 | ||
26 | 42 |
github/deemru/w8io/169f3d6 51.55 ms ◑