tx · 2f5rrpzXBFCh2nCnNnQGkjYSicPyUA1vPHpcS6r16gWS 3N93XuDT7GvzMZdp8WGTbqYxiGY9JQmiWAG: -0.00300000 Waves 2023.09.01 02:16 [2735501] smart account 3N93XuDT7GvzMZdp8WGTbqYxiGY9JQmiWAG > SELF 0.00000000 Waves
{ "type": 13, "id": "2f5rrpzXBFCh2nCnNnQGkjYSicPyUA1vPHpcS6r16gWS", "fee": 300000, "feeAssetId": null, "timestamp": 1693523828867, "version": 2, "chainId": 84, "sender": "3N93XuDT7GvzMZdp8WGTbqYxiGY9JQmiWAG", "senderPublicKey": "3MV6QZNSjqH7Ctc3BGRQJJyZ3DJgCJ6Tqn7LXRgneZ5B", "proofs": [ "LYM2V8Rx2EMVX4bNb4os4KSXV3KukqpbFrZ2Xuyp9MtV1La78N86S6RvzDGcsh7Avh8gbZzzVsQJd9GNhCU2P23" ], "script": "base64:BgISCAISBAoCCAESABIGCgQIAQgICQAKbGltaXRSYXRpbwCgjQYAA2ZlZQBkAAZzY2FsZTUAoI0GAAxmZWVDb2xsZWN0b3ICAAEKZ2V0QXNzZXRJZAEDYXN0BAckbWF0Y2gwBQNhc3QDCQABAgUHJG1hdGNoMAIKQnl0ZVZlY3RvcgQBcAUHJG1hdGNoMAUDYXN0BQR1bml0AQ5nZXRBc3NldFN0cmluZwEHYXNzZXRJZAQHJG1hdGNoMAUHYXNzZXRJZAMJAAECBQckbWF0Y2gwAgpCeXRlVmVjdG9yBAFiBQckbWF0Y2gwCQDYBAEFAWICBVdBVkVTAQ1nZXRBc3NldEJ5dGVzAQdhc3NldElkAwkAAAIFB2Fzc2V0SWQCBVdBVkVTBQR1bml0CQDZBAEFB2Fzc2V0SWQBCmdldEJhbGFuY2UBB2Fzc2V0SWQEByRtYXRjaDAFB2Fzc2V0SWQDCQABAgUHJG1hdGNoMAIKQnl0ZVZlY3RvcgQBYgUHJG1hdGNoMAkA8AcCBQR0aGlzBQFiCAkA7wcBBQR0aGlzCWF2YWlsYWJsZ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bW91bnQFA2ZlZQUGc2NhbGU1BA1hbW91bnRUb1JlcGF5CQBkAgUGYW1vdW50BQlmZWVBbW91bnQECm5ld0JhbGFuY2UJAQpnZXRCYWxhbmNlAQkBDWdldEFzc2V0Qnl0ZXMBBQdhc3NldElkAwkAAAIFCm5ld0JhbGFuY2UFCm5ld0JhbGFuY2UDCQBnAgUKbmV3QmFsYW5jZQUNYW1vdW50VG9SZXBheQkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDCQEHQWRkcmVzcwEJANkEAQUMZmVlQ29sbGVjdG9yBQlmZWVBbW91bnQJAQ1nZXRBc3NldEJ5dGVzAQUHYXNzZXRJZAUDbmlsCQACAQkArAICCQCsAgIJAKwCAgIoUmVqZWN0ZWQgZHVlIHRvIGxvdyByZXBheSBhbW91bnQuIE5lZWQ6IAkApAMBBQ1hbW91bnRUb1JlcGF5AgwsIHByb3ZpZGVkOiAJAKQDAQkAZQIFCm5ld0JhbGFuY2UFDmN1cnJlbnRCYWxhbmNlCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAK8CrtM=", "height": 2735501, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: 5V6cDcYegLTCkEb3paZ8qocycrVxdr4MrzapLRuq8Jit Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let a = 100000 | |
5 | + | ||
6 | + | let b = 100 | |
7 | + | ||
8 | + | let c = 100000 | |
9 | + | ||
10 | + | let d = "" | |
11 | + | ||
12 | + | func e (f) = { | |
13 | + | let g = f | |
14 | + | if ($isInstanceOf(g, "ByteVector")) | |
15 | + | then { | |
16 | + | let h = g | |
17 | + | f | |
18 | + | } | |
19 | + | else unit | |
20 | + | } | |
21 | + | ||
22 | + | ||
23 | + | func i (j) = { | |
24 | + | let g = j | |
25 | + | if ($isInstanceOf(g, "ByteVector")) | |
26 | + | then { | |
27 | + | let k = g | |
28 | + | toBase58String(k) | |
29 | + | } | |
30 | + | else "WAVES" | |
31 | + | } | |
32 | + | ||
33 | + | ||
34 | + | func l (j) = if ((j == "WAVES")) | |
35 | + | then unit | |
36 | + | else fromBase58String(j) | |
37 | + | ||
38 | + | ||
39 | + | func m (j) = { | |
40 | + | let g = j | |
41 | + | if ($isInstanceOf(g, "ByteVector")) | |
42 | + | then { | |
43 | + | let k = g | |
44 | + | assetBalance(this, k) | |
45 | + | } | |
46 | + | else wavesBalance(this).available | |
47 | + | } | |
48 | + | ||
49 | + | ||
50 | + | func n (o,p) = { | |
51 | + | let g = getInteger(p, o) | |
52 | + | if ($isInstanceOf(g, "Int")) | |
53 | + | then { | |
54 | + | let k = g | |
55 | + | k | |
56 | + | } | |
57 | + | else 0 | |
58 | + | } | |
59 | + | ||
60 | + | ||
61 | + | @Callable(q) | |
62 | + | func borrow (j,r) = { | |
63 | + | let s = m(l(j)) | |
64 | + | if ((s == s)) | |
65 | + | then { | |
66 | + | let t = fraction(s, a, c) | |
67 | + | if ((t >= r)) | |
68 | + | then [IntegerEntry(((("borrowed_" + toString(q.caller)) + "_") + j), r), ScriptTransfer(q.caller, r, l(j))] | |
69 | + | else throw(((("Requested amount " + toString(r)) + " is bigger than limit: ") + toString(t))) | |
70 | + | } | |
71 | + | else throw("Strict value is not equal to itself.") | |
72 | + | } | |
73 | + | ||
74 | + | ||
75 | + | ||
76 | + | @Callable(q) | |
77 | + | func repay () = { | |
78 | + | let r = value(q.payments[0].amount) | |
79 | + | let j = q.payments[0].assetId | |
80 | + | let u = n(((("borrowed_" + toString(q.caller)) + "_") + i(j)), this) | |
81 | + | if ((u > 0)) | |
82 | + | then { | |
83 | + | let v = min([r, u]) | |
84 | + | let w = (r - v) | |
85 | + | let x = if ((w > 0)) | |
86 | + | then ScriptTransfer(q.caller, w, j) | |
87 | + | else unit | |
88 | + | [IntegerEntry(((("borrowed_" + toString(q.caller)) + "_") + i(j)), (u - v))] | |
89 | + | } | |
90 | + | else throw("You shouldn't repay") | |
91 | + | } | |
92 | + | ||
93 | + | ||
94 | + | ||
95 | + | @Callable(q) | |
96 | + | func flash (j,r,y,z) = { | |
97 | + | let A = Address(fromBase58String(y)) | |
98 | + | let s = m(l(j)) | |
99 | + | if ((s == s)) | |
100 | + | then { | |
101 | + | let B = invoke(this, "borrow", [j, r], nil) | |
102 | + | if ((B == B)) | |
103 | + | then { | |
104 | + | let C = invoke(Address(fromBase58String(y)), z, nil, [AttachedPayment(l(j), r)]) | |
105 | + | if ((C == C)) | |
106 | + | then { | |
107 | + | let D = fraction(r, b, c) | |
108 | + | let E = (r + D) | |
109 | + | let F = m(l(j)) | |
110 | + | if ((F == F)) | |
111 | + | then if ((F >= E)) | |
112 | + | then [ScriptTransfer(Address(fromBase58String(d)), D, l(j))] | |
113 | + | else throw(((("Rejected due to low repay amount. Need: " + toString(E)) + ", provided: ") + toString((F - s)))) | |
114 | + | else throw("Strict value is not equal to itself.") | |
115 | + | } | |
116 | + | else throw("Strict value is not equal to itself.") | |
117 | + | } | |
118 | + | else throw("Strict value is not equal to itself.") | |
119 | + | } | |
120 | + | else throw("Strict value is not equal to itself.") | |
121 | + | } | |
122 | + | ||
123 | + |
github/deemru/w8io/169f3d6 15.85 ms ◑