tx · 9fK4VBQBZfUTLuKaYcRH15oqrF3u1MRnbKVGRyxpu5gv
3N8QXkBJ9Cw5SKQN9XrAvj6TQm3LQTJXMik: -0.01000000 Waves
2023.08.14 11:59 [2710025] smart account 3N8QXkBJ9Cw5SKQN9XrAvj6TQm3LQTJXMik > SELF 0.00000000 Waves
{
"type": 13,
"id": "9fK4VBQBZfUTLuKaYcRH15oqrF3u1MRnbKVGRyxpu5gv",
"fee": 1000000,
"feeAssetId": null,
"timestamp": 1692003630867,
"version": 2,
"chainId": 84,
"sender": "3N8QXkBJ9Cw5SKQN9XrAvj6TQm3LQTJXMik",
"senderPublicKey": "3k1UfguhLASyNRUsyixsBqDL7EMm2UZqEsUMcZf9yQoW",
"proofs": [
"3x9VT6bJDd4DEAUbfFxxE4Y7Anykm37qbF9VXHMRAb2MqKkScyLqZnYi9qp7Fbu5tsTmRbnjD19t5kgjmikx53aS"
],
"script": "base64:AAIFAAAAAAAAAAcIAhIDCgEBAAAAAgEAAAAHZ2V0RGF0YQAAAAIAAAADYWRyAAAAA2tleQQAAAAEZGF0YQQAAAAHJG1hdGNoMAkABB0AAAACBQAAAANhZHIFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAgAAAAAFAAAABGRhdGEBAAAACGF1dGhVc2VyAAAAAQAAAA9jYWxsZXJQdWJsaWNLZXkEAAAAE2NhbGxlclB1YmxpY0tleUhhc2gJAAJYAAAAAQkAAfcAAAABBQAAAA9jYWxsZXJQdWJsaWNLZXkEAAAACWRhdGFWYWx1ZQkBAAAAB2dldERhdGEAAAACBQAAAAR0aGlzCQABLAAAAAIJAAEsAAAAAgIAAAALY29ubmVjdGlvbi4FAAAAE2NhbGxlclB1YmxpY0tleUhhc2gCAAAABy5zY3JpcHQEAAAADWV4cGVjdGVkVmFsdWUCAAAACmF1dGhvcml6ZWQDCQAAAAAAAAIFAAAACWRhdGFWYWx1ZQUAAAANZXhwZWN0ZWRWYWx1ZQYHAAAAAQAAAAFpAQAAAAtyZWZ1bmRXYXZlcwAAAAEAAAAEY29zdAQAAAANYXV0aGVudGljYXRlZAkBAAAACGF1dGhVc2VyAAAAAQgFAAAAAWkAAAAPY2FsbGVyUHVibGljS2V5AwkBAAAAASEAAAABBQAAAA1hdXRoZW50aWNhdGVkCQAAAgAAAAECAAAAPUFjY291bnQgaGF0IG5pY2h0IGRpZSBuw7Z0aWdlIEJlcmVjaHRpZ3VuZyBmw7xyIGRpZXNlIEFrdGlvbi4JAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAARjb3N0BQAAAAR1bml0BQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleagB5D8=",
"height": 2710025,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: 5kysFUKjUgCt1gk6YNhjiRMhGLu4cgbyidyRrEiRtzNB
Next: none
Diff:
Old | New | | Differences |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | func getData (adr,key) = { |
---|
5 | | - | let data = match getBoolean(adr, key) { |
---|
6 | | - | case a: Boolean => |
---|
| 5 | + | let data = match getString(adr, key) { |
---|
| 6 | + | case a: String => |
---|
7 | 7 | | a |
---|
8 | 8 | | case _ => |
---|
9 | | - | false |
---|
| 9 | + | "" |
---|
10 | 10 | | } |
---|
11 | 11 | | data |
---|
12 | 12 | | } |
---|
13 | 13 | | |
---|
14 | 14 | | |
---|
| 15 | + | func authUser (callerPublicKey) = { |
---|
| 16 | + | let callerPublicKeyHash = toBase58String(sha256(callerPublicKey)) |
---|
| 17 | + | let dataValue = getData(this, (("connection." + callerPublicKeyHash) + ".script")) |
---|
| 18 | + | let expectedValue = "authorized" |
---|
| 19 | + | if ((dataValue == expectedValue)) |
---|
| 20 | + | then true |
---|
| 21 | + | else false |
---|
| 22 | + | } |
---|
| 23 | + | |
---|
| 24 | + | |
---|
15 | 25 | | @Callable(i) |
---|
16 | | - | func refundWaves (timestamp,cost) = { |
---|
17 | | - | let key = ((timestamp + ".") + toBase58String(i.callerPublicKey)) |
---|
18 | | - | let data = getData(this, key) |
---|
19 | | - | if (data) |
---|
20 | | - | then throw("Wurde bereits ausgezahlt.") |
---|
21 | | - | else [BooleanEntry(key, true), ScriptTransfer(i.caller, cost, unit)] |
---|
| 26 | + | func refundWaves (cost) = { |
---|
| 27 | + | let authenticated = authUser(i.callerPublicKey) |
---|
| 28 | + | if (!(authenticated)) |
---|
| 29 | + | then throw("Account hat nicht die nötige Berechtigung für diese Aktion.") |
---|
| 30 | + | else [ScriptTransfer(i.caller, cost, unit)] |
---|
22 | 31 | | } |
---|
23 | 32 | | |
---|
24 | 33 | | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 5 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | func getData (adr,key) = { |
---|
5 | | - | let data = match getBoolean(adr, key) { |
---|
6 | | - | case a: Boolean => |
---|
| 5 | + | let data = match getString(adr, key) { |
---|
| 6 | + | case a: String => |
---|
7 | 7 | | a |
---|
8 | 8 | | case _ => |
---|
9 | | - | false |
---|
| 9 | + | "" |
---|
10 | 10 | | } |
---|
11 | 11 | | data |
---|
12 | 12 | | } |
---|
13 | 13 | | |
---|
14 | 14 | | |
---|
| 15 | + | func authUser (callerPublicKey) = { |
---|
| 16 | + | let callerPublicKeyHash = toBase58String(sha256(callerPublicKey)) |
---|
| 17 | + | let dataValue = getData(this, (("connection." + callerPublicKeyHash) + ".script")) |
---|
| 18 | + | let expectedValue = "authorized" |
---|
| 19 | + | if ((dataValue == expectedValue)) |
---|
| 20 | + | then true |
---|
| 21 | + | else false |
---|
| 22 | + | } |
---|
| 23 | + | |
---|
| 24 | + | |
---|
15 | 25 | | @Callable(i) |
---|
16 | | - | func refundWaves (timestamp,cost) = { |
---|
17 | | - | let key = ((timestamp + ".") + toBase58String(i.callerPublicKey)) |
---|
18 | | - | let data = getData(this, key) |
---|
19 | | - | if (data) |
---|
20 | | - | then throw("Wurde bereits ausgezahlt.") |
---|
21 | | - | else [BooleanEntry(key, true), ScriptTransfer(i.caller, cost, unit)] |
---|
| 26 | + | func refundWaves (cost) = { |
---|
| 27 | + | let authenticated = authUser(i.callerPublicKey) |
---|
| 28 | + | if (!(authenticated)) |
---|
| 29 | + | then throw("Account hat nicht die nötige Berechtigung für diese Aktion.") |
---|
| 30 | + | else [ScriptTransfer(i.caller, cost, unit)] |
---|
22 | 31 | | } |
---|
23 | 32 | | |
---|
24 | 33 | | |
---|
25 | 34 | | @Verifier(tx) |
---|
26 | 35 | | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) |
---|
27 | 36 | | |
---|