tx · EQuo8NH3xQWgnA3qNkjT2ak4ewtbuq17kT7yNNQNicYj 3N5VfD2XM5qmKShusAwKdbbfrbSJ71pyoVM: -0.01000000 Waves 2019.08.21 10:06 [640558] smart account 3N5VfD2XM5qmKShusAwKdbbfrbSJ71pyoVM > SELF 0.00000000 Waves
{ "type": 13, "id": "EQuo8NH3xQWgnA3qNkjT2ak4ewtbuq17kT7yNNQNicYj", "fee": 1000000, "feeAssetId": null, "timestamp": 1566371076429, "version": 1, "sender": "3N5VfD2XM5qmKShusAwKdbbfrbSJ71pyoVM", "senderPublicKey": "CL2SZMPLfQmhX3i4kMAakV6mSLJNGVgfqGEGyUWaX4Uz", "proofs": [ "27CNeASkASKqXQttZjFc3uHhsUXMwmmvMSa8ectN4JB7uJY8GMQDCrrFUzB8ewV6yTEquoGMzYAT35oPLTpyJVsu" ], "script": "base64:AAIDAAAAAAAAAAAAAAAAAAAABAAAAAFpAQAAAA1hcHByb3ZlQ3JlZGl0AAAABAAAAAZjbGllbnQAAAAGYW1vdW50AAAABnRhcmdldAAAAAhsb2NrSGFzaAMDCQAAAAAAAAIFAAAABHRoaXMIBQAAAAFpAAAABmNhbGxlcgkBAAAAASEAAAABCQEAAAAJaXNEZWZpbmVkAAAAAQkABBsAAAACBQAAAAR0aGlzCQABLAAAAAIFAAAABmNsaWVudAIAAAAHX3N0YXR1cwcJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgUAAAAGY2xpZW50AgAAAAdfc3RhdHVzAgAAAAhhcHByb3ZlZAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACBQAAAAZjbGllbnQCAAAAB19hbW91bnQFAAAABmFtb3VudAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACBQAAAAZjbGllbnQCAAAAB190YXJnZXQFAAAABnRhcmdldAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACB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RhVHJhbnNhY3Rpb24EAAAAAXQFAAAAByRtYXRjaDAHAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABRTZXRTY3JpcHRUcmFuc2FjdGlvbgQAAAABdAUAAAAHJG1hdGNoMAcJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5vFl39w==", "chainId": 84, "height": 640558, "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/026f985 16.82 ms ◑