tx · 556En4i6UP5gtpxpfpAraCRYzB8Qtw7eUm2p6PT2R7nn 3N1GFqbTMvLWDwx9UGw93Csxe4d6PxSGP3a: -0.07000000 Waves 2020.03.16 11:01 [911534] smart account 3N1GFqbTMvLWDwx9UGw93Csxe4d6PxSGP3a > SELF 0.00000000 Waves
{ "type": 13, "id": "556En4i6UP5gtpxpfpAraCRYzB8Qtw7eUm2p6PT2R7nn", "fee": 7000000, "feeAssetId": null, "timestamp": 1584345716387, "version": 1, "sender": "3N1GFqbTMvLWDwx9UGw93Csxe4d6PxSGP3a", "senderPublicKey": "A55HbjC3kNmKc5YREN4cDWUL4VpR92UFktxoHu3DvNDm", "proofs": [ "5nH96rrPiWYMemd94Shvr57bGQqHAyJvGB3rXJrRCoB9Mz6QjWQxBrNrbwyiAjex71LfKyJxT83xKsKKqyDAN25g" ], "script": "base64:AAIDAAAAAAAAABAIARIGCgQIAQECEgASABIAAAAAAAAAAAQAAAABaQEAAAANYXBwcm92ZUNyZWRpdAAAAAQAAAAGY2xpZW50AAAABmFtb3VudAAAAAZ0YXJnZXQAAAAIbG9ja0hhc2gDAwkAAAAAAAACBQAAAAR0aGlzCAUAAAABaQAAAAZjYWxsZXIJAQAAAAEhAAAAAQkBAAAACWlzRGVmaW5lZAAAAAEJAAQbAAAAAgUAAAAEdGhpcwkAASwAAAACBQAAAAZjbGllbnQCAAAAB19zdGF0dXMHCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIFAAAABmNsaWVudAIAAAAHX3N0YXR1cwIAAAAIYXBwcm92ZWQJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgUAAAAGY2xpZW50AgAAAAdfYW1vdW50BQAAAAZhbW91bnQJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgUAAAAGY2xpZW50AgAAAAdfdGFyZ2V0BQAAAAZ0YXJnZXQJAARMAAAAAgkBAAAACURh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ckbWF0Y2gwBQAAAAJ0eAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAPRGF0YVRyYW5zYWN0aW9uBAAAAAF0BQAAAAckbWF0Y2gwBwMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAUU2V0U2NyaXB0VHJhbnNhY3Rpb24EAAAAAXQFAAAAByRtYXRjaDAHCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleRS4c0k=", "chainId": 84, "height": 911534, "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | ||
5 | + | ||
6 | + | @Callable(a) | |
7 | + | func approveCredit (b,c,d,e) = if (if ((this == a.caller)) | |
8 | + | then !(isDefined(getBoolean(this, (b + "_status")))) | |
9 | + | else false) | |
10 | + | then WriteSet([DataEntry((b + "_status"), "approved"), DataEntry((b + "_amount"), c), DataEntry((b + "_target"), d), DataEntry((b + "_lockScriptId"), e)]) | |
11 | + | else throw((("Credit for " + b) + " has already been approved or caller is not dApp owner")) | |
12 | + | ||
13 | + | ||
14 | + | ||
15 | + | @Callable(a) | |
16 | + | func getMoney () = { | |
17 | + | let f = toBase58String(a.caller.bytes) | |
18 | + | let g = { | |
19 | + | let h = getString(this, (f + "_status")) | |
20 | + | if ($isInstanceOf(h, "Unit")) | |
21 | + | then { | |
22 | + | let i = h | |
23 | + | "unset" | |
24 | + | } | |
25 | + | else if ($isInstanceOf(h, "String")) | |
26 | + | then { | |
27 | + | let i = h | |
28 | + | i | |
29 | + | } | |
30 | + | else throw() | |
31 | + | } | |
32 | + | let j = extract(getString(this, (f + "_lockScriptId"))) | |
33 | + | let k = transactionHeightById(fromBase58String(j)) | |
34 | + | let l = { | |
35 | + | let h = k | |
36 | + | if ($isInstanceOf(h, "Int")) | |
37 | + | then { | |
38 | + | let m = h | |
39 | + | true | |
40 | + | } | |
41 | + | else throw("Lock has not been set") | |
42 | + | } | |
43 | + | let c = extract(getInteger(this, (f + "_amount"))) | |
44 | + | if (if ((g == "approved")) | |
45 | + | then l | |
46 | + | else false) | |
47 | + | then ScriptResult(WriteSet([DataEntry((f + "_status"), "borrowed")]), TransferSet([ScriptTransfer(a.caller, c, unit)])) | |
48 | + | else throw("Credit was not approved or money has already been taken") | |
49 | + | } | |
50 | + | ||
51 | + | ||
52 | + | ||
53 | + | @Callable(a) | |
54 | + | func returnMoney () = { | |
55 | + | let f = toBase58String(a.caller.bytes) | |
56 | + | let g = { | |
57 | + | let h = getString(this, (f + "_status")) | |
58 | + | if ($isInstanceOf(h, "Unit")) | |
59 | + | then { | |
60 | + | let i = h | |
61 | + | "unset" | |
62 | + | } | |
63 | + | else if ($isInstanceOf(h, "String")) | |
64 | + | then { | |
65 | + | let i = h | |
66 | + | i | |
67 | + | } | |
68 | + | else throw() | |
69 | + | } | |
70 | + | let n = extract(a.payment) | |
71 | + | let o = getInteger(this, (f + "_amount")) | |
72 | + | if ((g != "borrowed")) | |
73 | + | then throw("Cannot return, nothing was borrowed") | |
74 | + | else if (isDefined(n.assetId)) | |
75 | + | then throw("Can return only WAVES at the moment") | |
76 | + | else if ((o != n.amount)) | |
77 | + | then throw("Should return borrowed amount") | |
78 | + | else WriteSet([DataEntry((f + "_status"), "returned")]) | |
79 | + | } | |
80 | + | ||
81 | + | ||
82 | + | ||
83 | + | @Callable(a) | |
84 | + | func cancelContract () = { | |
85 | + | let f = toBase58String(a.caller.bytes) | |
86 | + | let g = { | |
87 | + | let h = getString(this, (f + "_status")) | |
88 | + | if ($isInstanceOf(h, "Unit")) | |
89 | + | then { | |
90 | + | let i = h | |
91 | + | "unset" | |
92 | + | } | |
93 | + | else if ($isInstanceOf(h, "String")) | |
94 | + | then { | |
95 | + | let i = h | |
96 | + | i | |
97 | + | } | |
98 | + | else throw() | |
99 | + | } | |
100 | + | if (if ((g == "approved")) | |
101 | + | then true | |
102 | + | else (g == "unset")) | |
103 | + | then WriteSet([DataEntry((f + "_status"), "canceled")]) | |
104 | + | else throw("Cannot cancel credit. Money has already been taken") | |
105 | + | } | |
106 | + | ||
107 | + | ||
108 | + | @Verifier(p) | |
109 | + | func q () = { | |
110 | + | let h = p | |
111 | + | if ($isInstanceOf(h, "DataTransaction")) | |
112 | + | then { | |
113 | + | let m = h | |
114 | + | false | |
115 | + | } | |
116 | + | else if ($isInstanceOf(h, "SetScriptTransaction")) | |
117 | + | then { | |
118 | + | let m = h | |
119 | + | false | |
120 | + | } | |
121 | + | else sigVerify(p.bodyBytes, p.proofs[0], p.senderPublicKey) | |
122 | + | } | |
123 | + |
github/deemru/w8io/169f3d6 30.05 ms ◑