tx · 8Cx1HAbJUpWtxcSnu3NHbsMp3tVyZoAU9PEpbRpLugcm 3MqsDXvFU9WM8hEzCcrw2aVGtVimCgbNeXD: -0.00700000 Waves 2024.04.24 10:03 [3076592] smart account 3MqsDXvFU9WM8hEzCcrw2aVGtVimCgbNeXD > SELF 0.00000000 Waves
{ "type": 13, "id": "8Cx1HAbJUpWtxcSnu3NHbsMp3tVyZoAU9PEpbRpLugcm", "fee": 700000, "feeAssetId": null, "timestamp": 1713942227226, "version": 1, "sender": "3MqsDXvFU9WM8hEzCcrw2aVGtVimCgbNeXD", "senderPublicKey": "4dNR2Up6mpwUEcy9WQuE2wAzR7HRURa6Pk9jrFKgcHqB", "proofs": [ "eiLBiTtFafoDzTwwgPr1pRnqtqsbqQQMkug2WYSCvzSzixhUDtkiRMfZ8wvdUiPxnKMHsHgCd7nbe2qJR4GxPC5" ], "script": "base64:BgISCAISBAoCCAQSAwoBCBIDCgEIDgAQY29udHJhY3RGaWxlbmFtZQIOZm9yY2VzdG9wLnJpZGUAA1NFUAICX18BB3dyYXBFcnIBA21zZwkAuQkCCQDMCAIFEGNvbnRyYWN0RmlsZW5hbWUJAMwIAgICOiAJAMwIAgUDbXNnBQNuaWwCAAEIdGhyb3dFcnIBA21zZwkAAgEJAQd3cmFwRXJyAQUDbXNnARZrZXlNYW5hZ2VyVmF1bHRBZGRyZXNzAAkAuQkCCQDMCAICAiVzCQDMCAICE21hbmFnZXJWYXVsdEFkZHJlc3MFA25pbAUDU0VQARNrZXlNYW5hZ2VyUHVibGljS2V5AAkAuQkCCQDMCAICAiVzCQDMCAICEG1hbmFnZXJQdWJsaWNLZXkFA25pbAUDU0VQARFrZXlQZXJtaXNzaW9uTGlzdAAJALkJAgkAzAgCAgIlcwkAzAgCAhNmb3JjZVN0b3BQZXJtaXNzaW9uBQNuaWwFA1NFUAEMa2V5Rm9yY2VTdG9wAQdhZGRyZXNzCQC5CQIJAMwIAgIEJXMlcwkAzAgCAghkaXNhYmxlZAkAzAgC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hZ2UCCQDPCAIFDnBlcm1pc3Npb25MaXN0BQdhZGRyZXNzCQCsAgIFB2FkZHJlc3MJAQd3cmFwRXJyAQILbm90IGluIGxpc3QEB25ld0xpc3QJANEIAgUOcGVybWlzc2lvbkxpc3QFB3JfaW5kZXgEDW5ld0xpc3RTdHJpbmcJALkJAgUHbmV3TGlzdAUDU0VQCQDMCAIJAQtTdHJpbmdFbnRyeQIJARFrZXlQZXJtaXNzaW9uTGlzdAAFDW5ld0xpc3RTdHJpbmcFA25pbAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgECdHgBBnZlcmlmeQAED3RhcmdldFB1YmxpY0tleQQHJG1hdGNoMAkBFm1hbmFnZXJQdWJsaWNLZXlPclVuaXQAAwkAAQIFByRtYXRjaDACCkJ5dGVWZWN0b3IEAnBrBQckbWF0Y2gwBQJwawMJAAECBQckbWF0Y2gwAgRVbml0CAUCdHgPc2VuZGVyUHVibGljS2V5CQACAQILTWF0Y2ggZXJyb3IJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAFD3RhcmdldFB1YmxpY0tleRUwdvk=", "chainId": 84, "height": 3076592, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 76P5DacsbzZJgyU8699u2EDCk99F6FiquQyANm7cDgMC Next: EJ2n5W4ojcrQFpNA5Tk8LhNzb14NWrMdYwfT4r1nLX2H Diff:
Old | New | Differences | |
---|---|---|---|
20 | 20 | func keyPermissionList () = makeString(["%s", "forceStopPermission"], SEP) | |
21 | 21 | ||
22 | 22 | ||
23 | - | func keyForceStop (address) = makeString(["%s%s", " | |
23 | + | func keyForceStop (address) = makeString(["%s%s", "disabled", address], SEP) | |
24 | 24 | ||
25 | 25 | ||
26 | 26 | let permissionList = split(valueOrElse(getString(this, keyPermissionList()), ""), SEP) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let contractFilename = "forcestop.ride" | |
5 | 5 | ||
6 | 6 | let SEP = "__" | |
7 | 7 | ||
8 | 8 | func wrapErr (msg) = makeString([contractFilename, ": ", msg], "") | |
9 | 9 | ||
10 | 10 | ||
11 | 11 | func throwErr (msg) = throw(wrapErr(msg)) | |
12 | 12 | ||
13 | 13 | ||
14 | 14 | func keyManagerVaultAddress () = makeString(["%s", "managerVaultAddress"], SEP) | |
15 | 15 | ||
16 | 16 | ||
17 | 17 | func keyManagerPublicKey () = makeString(["%s", "managerPublicKey"], SEP) | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | func keyPermissionList () = makeString(["%s", "forceStopPermission"], SEP) | |
21 | 21 | ||
22 | 22 | ||
23 | - | func keyForceStop (address) = makeString(["%s%s", " | |
23 | + | func keyForceStop (address) = makeString(["%s%s", "disabled", address], SEP) | |
24 | 24 | ||
25 | 25 | ||
26 | 26 | let permissionList = split(valueOrElse(getString(this, keyPermissionList()), ""), SEP) | |
27 | 27 | ||
28 | 28 | let permissionDeniedError = throwErr("Permission denied") | |
29 | 29 | ||
30 | 30 | func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) { | |
31 | 31 | case s: String => | |
32 | 32 | addressFromStringValue(s) | |
33 | 33 | case _ => | |
34 | 34 | this | |
35 | 35 | } | |
36 | 36 | ||
37 | 37 | ||
38 | 38 | func managerPublicKeyOrUnit () = { | |
39 | 39 | let managerVaultAddress = getManagerVaultAddressOrThis() | |
40 | 40 | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
41 | 41 | case s: String => | |
42 | 42 | fromBase58String(s) | |
43 | 43 | case _: Unit => | |
44 | 44 | unit | |
45 | 45 | case _ => | |
46 | 46 | throw("Match error") | |
47 | 47 | } | |
48 | 48 | } | |
49 | 49 | ||
50 | 50 | ||
51 | 51 | func mustThis (i) = if ((i.caller == this)) | |
52 | 52 | then true | |
53 | 53 | else permissionDeniedError | |
54 | 54 | ||
55 | 55 | ||
56 | 56 | func mustManager (i) = match managerPublicKeyOrUnit() { | |
57 | 57 | case pk: ByteVector => | |
58 | 58 | if ((i.callerPublicKey == pk)) | |
59 | 59 | then true | |
60 | 60 | else permissionDeniedError | |
61 | 61 | case _: Unit => | |
62 | 62 | mustThis(i) | |
63 | 63 | case _ => | |
64 | 64 | throw("Match error") | |
65 | 65 | } | |
66 | 66 | ||
67 | 67 | ||
68 | 68 | @Callable(i) | |
69 | 69 | func forceStopContract (address,stop) = { | |
70 | 70 | let callerAddressString = toString(i.caller) | |
71 | 71 | let check = [if (containsElement(permissionList, callerAddressString)) | |
72 | 72 | then true | |
73 | 73 | else mustManager(i)] | |
74 | 74 | if ((check == check)) | |
75 | 75 | then [BooleanEntry(keyForceStop(address), stop)] | |
76 | 76 | else throw("Strict value is not equal to itself.") | |
77 | 77 | } | |
78 | 78 | ||
79 | 79 | ||
80 | 80 | ||
81 | 81 | @Callable(i) | |
82 | 82 | func addPermission (address) = { | |
83 | 83 | let check = [mustManager(i), if (!(containsElement(permissionList, address))) | |
84 | 84 | then true | |
85 | 85 | else throwErr("already in permission list")] | |
86 | 86 | if ((check == check)) | |
87 | 87 | then { | |
88 | 88 | let newList = (permissionList :+ address) | |
89 | 89 | let newListString = makeString(newList, SEP) | |
90 | 90 | [StringEntry(keyPermissionList(), newListString)] | |
91 | 91 | } | |
92 | 92 | else throw("Strict value is not equal to itself.") | |
93 | 93 | } | |
94 | 94 | ||
95 | 95 | ||
96 | 96 | ||
97 | 97 | @Callable(i) | |
98 | 98 | func removePermission (address) = { | |
99 | 99 | let check = [mustManager(i), if (containsElement(permissionList, address)) | |
100 | 100 | then true | |
101 | 101 | else throwErr("not in permission list")] | |
102 | 102 | if ((check == check)) | |
103 | 103 | then { | |
104 | 104 | let r_index = valueOrErrorMessage(indexOf(permissionList, address), (address + wrapErr("not in list"))) | |
105 | 105 | let newList = removeByIndex(permissionList, r_index) | |
106 | 106 | let newListString = makeString(newList, SEP) | |
107 | 107 | [StringEntry(keyPermissionList(), newListString)] | |
108 | 108 | } | |
109 | 109 | else throw("Strict value is not equal to itself.") | |
110 | 110 | } | |
111 | 111 | ||
112 | 112 | ||
113 | 113 | @Verifier(tx) | |
114 | 114 | func verify () = { | |
115 | 115 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
116 | 116 | case pk: ByteVector => | |
117 | 117 | pk | |
118 | 118 | case _: Unit => | |
119 | 119 | tx.senderPublicKey | |
120 | 120 | case _ => | |
121 | 121 | throw("Match error") | |
122 | 122 | } | |
123 | 123 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
124 | 124 | } | |
125 | 125 |
github/deemru/w8io/169f3d6 25.94 ms ◑