tx · 76P5DacsbzZJgyU8699u2EDCk99F6FiquQyANm7cDgMC 3MqsDXvFU9WM8hEzCcrw2aVGtVimCgbNeXD: -0.00700000 Waves 2024.04.24 09:45 [3076571] smart account 3MqsDXvFU9WM8hEzCcrw2aVGtVimCgbNeXD > SELF 0.00000000 Waves
{ "type": 13, "id": "76P5DacsbzZJgyU8699u2EDCk99F6FiquQyANm7cDgMC", "fee": 700000, "feeAssetId": null, "timestamp": 1713941131400, "version": 1, "sender": "3MqsDXvFU9WM8hEzCcrw2aVGtVimCgbNeXD", "senderPublicKey": "4dNR2Up6mpwUEcy9WQuE2wAzR7HRURa6Pk9jrFKgcHqB", "proofs": [ "kiNtSZNpqAXrDEM8Ngyuueh4pbU9auGTuznsWeVNJE6BP8mno2varurGVZc1c2xWyFQVWkF7pJGZSTXqevJHQVA" ], "script": "base64:BgISCAISBAoCCAQSAwoBCBIDCgEIDgAQY29udHJhY3RGaWxlbmFtZQIOZm9yY2VzdG9wLnJpZGUAA1NFUAICX18BB3dyYXBFcnIBA21zZwkAuQkCCQDMCAIFEGNvbnRyYWN0RmlsZW5hbWUJAMwIAgICOiAJAMwIAgUDbXNnBQNuaWwCAAEIdGhyb3dFcnIBA21zZwkAAgEJAQd3cmFwRXJyAQUDbXNnARZrZXlNYW5hZ2VyVmF1bHRBZGRyZXNzAAkAuQkCCQDMCAICAiVzCQDMCAICE21hbmFnZXJWYXVsdEFkZHJlc3MFA25pbAUDU0VQARNrZXlNYW5hZ2VyUHVibGljS2V5AAkAuQkCCQDMCAICAiVzCQDMCAICEG1hbmFnZXJQdWJsaWNLZXkFA25pbAUDU0VQARFrZXlQZXJtaXNzaW9uTGlzdAAJALkJAgkAzAgCAgIlcwkAzAgCAhNmb3JjZVN0b3BQZXJtaXNzaW9uBQNuaWwFA1NFUAEMa2V5Rm9yY2VTdG9wAQdhZGRyZXNzCQC5CQIJAMwIAgIEJXMlcwkAzAgCAgRzdG9wCQDMCAIFB2FkZHJlc3MFA25pbAUDU0V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ZHJlc3MJAKwCAgUHYWRkcmVzcwkBB3dyYXBFcnIBAgtub3QgaW4gbGlzdAQHbmV3TGlzdAkA0QgCBQ5wZXJtaXNzaW9uTGlzdAUHcl9pbmRleAQNbmV3TGlzdFN0cmluZwkAuQkCBQduZXdMaXN0BQNTRVAJAMwIAgkBC1N0cmluZ0VudHJ5AgkBEWtleVBlcm1pc3Npb25MaXN0AAUNbmV3TGlzdFN0cmluZwUDbmlsCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAQJ0eAEGdmVyaWZ5AAQPdGFyZ2V0UHVibGljS2V5BAckbWF0Y2gwCQEWbWFuYWdlclB1YmxpY0tleU9yVW5pdAADCQABAgUHJG1hdGNoMAIKQnl0ZVZlY3RvcgQCcGsFByRtYXRjaDAFAnBrAwkAAQIFByRtYXRjaDACBFVuaXQIBQJ0eA9zZW5kZXJQdWJsaWNLZXkJAAIBAgtNYXRjaCBlcnJvcgkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAUPdGFyZ2V0UHVibGljS2V5kgnKWQ==", "chainId": 84, "height": 3076571, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: HDCymHAoH3TDBuY6dM1xoUBTBURcxip5hR8ssJA7uzJa Next: 8Cx1HAbJUpWtxcSnu3NHbsMp3tVyZoAU9PEpbRpLugcm Diff:
Old | New | Differences | |
---|---|---|---|
77 | 77 | } | |
78 | 78 | ||
79 | 79 | ||
80 | + | ||
81 | + | @Callable(i) | |
82 | + | func addPermission (address) = { | |
83 | + | let check = [mustManager(i), if (!(containsElement(permissionList, address))) | |
84 | + | then true | |
85 | + | else throwErr("already in permission list")] | |
86 | + | if ((check == check)) | |
87 | + | then { | |
88 | + | let newList = (permissionList :+ address) | |
89 | + | let newListString = makeString(newList, SEP) | |
90 | + | [StringEntry(keyPermissionList(), newListString)] | |
91 | + | } | |
92 | + | else throw("Strict value is not equal to itself.") | |
93 | + | } | |
94 | + | ||
95 | + | ||
96 | + | ||
97 | + | @Callable(i) | |
98 | + | func removePermission (address) = { | |
99 | + | let check = [mustManager(i), if (containsElement(permissionList, address)) | |
100 | + | then true | |
101 | + | else throwErr("not in permission list")] | |
102 | + | if ((check == check)) | |
103 | + | then { | |
104 | + | let r_index = valueOrErrorMessage(indexOf(permissionList, address), (address + wrapErr("not in list"))) | |
105 | + | let newList = removeByIndex(permissionList, r_index) | |
106 | + | let newListString = makeString(newList, SEP) | |
107 | + | [StringEntry(keyPermissionList(), newListString)] | |
108 | + | } | |
109 | + | else throw("Strict value is not equal to itself.") | |
110 | + | } | |
111 | + | ||
112 | + | ||
80 | 113 | @Verifier(tx) | |
81 | 114 | func verify () = { | |
82 | 115 | let targetPublicKey = match managerPublicKeyOrUnit() { |
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 | 23 | func keyForceStop (address) = makeString(["%s%s", "stop", 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 | + | ||
81 | + | @Callable(i) | |
82 | + | func addPermission (address) = { | |
83 | + | let check = [mustManager(i), if (!(containsElement(permissionList, address))) | |
84 | + | then true | |
85 | + | else throwErr("already in permission list")] | |
86 | + | if ((check == check)) | |
87 | + | then { | |
88 | + | let newList = (permissionList :+ address) | |
89 | + | let newListString = makeString(newList, SEP) | |
90 | + | [StringEntry(keyPermissionList(), newListString)] | |
91 | + | } | |
92 | + | else throw("Strict value is not equal to itself.") | |
93 | + | } | |
94 | + | ||
95 | + | ||
96 | + | ||
97 | + | @Callable(i) | |
98 | + | func removePermission (address) = { | |
99 | + | let check = [mustManager(i), if (containsElement(permissionList, address)) | |
100 | + | then true | |
101 | + | else throwErr("not in permission list")] | |
102 | + | if ((check == check)) | |
103 | + | then { | |
104 | + | let r_index = valueOrErrorMessage(indexOf(permissionList, address), (address + wrapErr("not in list"))) | |
105 | + | let newList = removeByIndex(permissionList, r_index) | |
106 | + | let newListString = makeString(newList, SEP) | |
107 | + | [StringEntry(keyPermissionList(), newListString)] | |
108 | + | } | |
109 | + | else throw("Strict value is not equal to itself.") | |
110 | + | } | |
111 | + | ||
112 | + | ||
80 | 113 | @Verifier(tx) | |
81 | 114 | func verify () = { | |
82 | 115 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
83 | 116 | case pk: ByteVector => | |
84 | 117 | pk | |
85 | 118 | case _: Unit => | |
86 | 119 | tx.senderPublicKey | |
87 | 120 | case _ => | |
88 | 121 | throw("Match error") | |
89 | 122 | } | |
90 | 123 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
91 | 124 | } | |
92 | 125 |
github/deemru/w8io/169f3d6 49.12 ms ◑