tx · 7zMtizKKWVwmCzdhAoDQDZMLsQtpDkNqCJtBVHZKNYe2

3N88HLHyQgayARc6MXuoJgYJM6Hp9q8AD4X:  -0.01000000 Waves

2021.06.25 11:48 [1585676] smart account 3N88HLHyQgayARc6MXuoJgYJM6Hp9q8AD4X > SELF 0.00000000 Waves

{ "type": 13, "id": "7zMtizKKWVwmCzdhAoDQDZMLsQtpDkNqCJtBVHZKNYe2", "fee": 1000000, "feeAssetId": null, "timestamp": 1624610866721, "version": 2, "chainId": 84, "sender": "3N88HLHyQgayARc6MXuoJgYJM6Hp9q8AD4X", "senderPublicKey": "7d8ot6oQCGQZb8ATJ6U8KciEiWMyGupkrdYRjcoRfNzs", "proofs": [ "46AcCxf9EL63EpqSXSZLS8RZ3CbNsHN82P7VychUK17ckZvs9ZK5CtYSe8DqnWf3Ww2kEWFQUm7RUPdcMxAcfAdW" ], "script": "base64:AAIEAAAAAAAAACAIAhIECgIBCBIECgIBCBIECgIBCBIECgIBCBIECgIBCAAAAAQBAAAACmdldEFzc2V0SUQAAAABAAAABWFzc2V0BAAAAAdhc3NldElEAwkAAAAAAAACBQAAAAVhc3NldAIAAAAAAgAAAAADCQAAAAAAAAIFAAAABWFzc2V0AgAAAARVU0ROAgAAACwzS0ZYQkdHTENqQTVaMkR1VzREcTlmRERySGpKSlAxWkVrYW9halN6dUtzQwkAAAIAAAABAgAAABFVbnN1cHBvcnRlZCBhc3NldAUAAAAHYXNzZXRJRAEAAAAQZ2V0RGVwb3NpdEFtb3VudAAAAAIAAAAJcHVibGljS2V5AAAABWFzc2V0BAAAAAl1c2VkQXNzZXQDCQAAAAAAAAIFAAAABWFzc2V0AgAAAAACAAAABVdBVkVTBQAAAAVhc3NldAQAAAAHYmFsYW5jZQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAAAhkZXBvc2l0XwUAAAAJcHVibGljS2V5AgAAAAFfBQAAAAl1c2VkQXNzZXQD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hbGxlclB1YmxpY0tleQQAAAAKY3VycmVudERlcAkBAAAAEGdldERlcG9zaXRBbW91bnQAAAACBQAAAAlwdWJsaWNLZXkFAAAACXVzZWRBc3NldAMJAABmAAAAAgAAAAAAAAAAAAUAAAAGYW1vdW50CQAAAgAAAAECAAAAHkNhbid0IHdpdGhkcmF3IG5lZ2F0aXZlIGFtb3VudAMDCQAAZgAAAAIFAAAACmN1cnJlbnREZXAAAAAAAAAAAAAJAABnAAAAAgUAAAAKY3VycmVudERlcAUAAAAGYW1vdW50BwkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAIZGVwb3NpdF8FAAAACXB1YmxpY0tleQIAAAABXwUAAAAJdXNlZEFzc2V0CQAAZQAAAAIFAAAACmN1cnJlbnREZXAFAAAABmFtb3VudAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAABR0cmFuc2FjdGlvblB1YmxpY0tleQUAAAAGYW1vdW50CAUAAAABaQAAAApmZWVBc3NldElkBQAAAANuaWwJAAACAAAAAQIAAAATTm90aGluZyB0byB3aXRoZHJhdwAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAEAAAAByRtYXRjaDAFAAAAAnR4AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAA9EYXRhVHJhbnNhY3Rpb24GAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABRTZXRTY3JpcHRUcmFuc2FjdGlvbgYG8isTqA==", "height": 1585676, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: ABqEYGbmUNvS8kZB9cxC4dRR1m4c4VbPf5NV9hpRvzBU Next: none Diff:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-func a (b,c) = {
5- let d = {
6- let e = getInteger(this, ((("deposit_" + b) + "_") + c))
7- if ($isInstanceOf(e, "Int"))
4+func a (b) = {
5+ let c = if ((b == ""))
6+ then ""
7+ else if ((b == "USDN"))
8+ then "3KFXBGGLCjA5Z2DuW4Dq9fDDrHjJJP1ZEkaoajSzuKsC"
9+ else throw("Unsupported asset")
10+ c
11+ }
12+
13+
14+func d (e,b) = {
15+ let f = if ((b == ""))
16+ then "WAVES"
17+ else b
18+ let g = {
19+ let h = getInteger(this, ((("deposit_" + e) + "_") + f))
20+ if ($isInstanceOf(h, "Int"))
821 then {
9- let f = e
10- f
22+ let i = h
23+ i
1124 }
1225 else 0
1326 }
14- d
27+ g
1528 }
1629
1730
18-func g (b,c) = {
19- let d = {
20- let e = getInteger(this, ((("borrow_" + b) + "_") + c))
21- if ($isInstanceOf(e, "Int"))
31+func j (e,b) = {
32+ let f = if ((b == ""))
33+ then "WAVES"
34+ else b
35+ let g = {
36+ let h = getInteger(this, ((("borrow_" + e) + "_") + f))
37+ if ($isInstanceOf(h, "Int"))
2238 then {
23- let f = e
24- f
39+ let i = h
40+ i
2541 }
2642 else 0
2743 }
28- d
44+ g
2945 }
3046
3147
32-func h (b,c) = if ((c == ""))
33- then {
34- let i = {
35- let e = getInteger(this, ((("collateral_" + b) + "_Waves") + c))
36- if ($isInstanceOf(e, "Int"))
37- then {
38- let f = e
39- f
40- }
41- else 0
42- }
43- i
48+func k (e,b) = {
49+ let f = if ((b == ""))
50+ then "WAVES"
51+ else b
52+ let l = {
53+ let h = getInteger(this, ((("collateral_" + e) + "_") + f))
54+ if ($isInstanceOf(h, "Int"))
55+ then {
56+ let i = h
57+ i
58+ }
59+ else 0
4460 }
45- else {
46- let i = {
47- let e = getInteger(this, ((("collateral_" + b) + "_") + c))
48- if ($isInstanceOf(e, "Int"))
49- then {
50- let f = e
51- f
52- }
53- else 0
54- }
55- i
56- }
61+ l
62+ }
5763
5864
59-@Callable(j)
60-func deposit (k,c) = {
61- let b = toBase58String(j.callerPublicKey)
62- let l = if ((c == ""))
65+@Callable(m)
66+func deposit (n,b) = {
67+ let e = toBase58String(m.callerPublicKey)
68+ let f = if ((b == ""))
6369 then "WAVES"
64- else c
65- let m = a(b, l)
66- let n = (m + k)
67-[IntegerEntry(((("deposit_" + b) + "_") + l), n)]
70+ else b
71+ let o = d(e, f)
72+ let p = (o + n)
73+[IntegerEntry(((("deposit_" + e) + "_") + f), p)]
6874 }
6975
7076
7177
72-@Callable(j)
73-func depositCollateral (k,c) = {
74- let b = toBase58String(j.callerPublicKey)
75- let o = h(b, c)
76- let p = (o + k)
77-[IntegerEntry(((("collateral_" + b) + "_") + c), p)]
78+@Callable(m)
79+func depositCollateral (n,b) = {
80+ let f = if ((b == ""))
81+ then "WAVES"
82+ else b
83+ let e = toBase58String(m.callerPublicKey)
84+ let q = k(e, f)
85+ let r = (q + n)
86+ if ((0 >= n))
87+ then throw("Ammount must be bigger than 0")
88+ else [IntegerEntry(((("collateral_" + e) + "_") + f), r)]
7889 }
7990
8091
8192
82-@Callable(j)
83-func borrow (k,c) = {
84- let b = toBase58String(j.callerPublicKey)
85- let q = g(b, c)
86- let i = h(b, c)
87- let r = ((i * 70) / 100)
88- let s = (q + k)
89- if ((i >= r))
90- then [IntegerEntry(((("borrow_" + b) + "_") + c), s)]
93+@Callable(m)
94+func borrow (n,b) = {
95+ let f = if ((b == ""))
96+ then "WAVES"
97+ else b
98+ let e = toBase58String(m.callerPublicKey)
99+ let s = addressFromPublicKey(m.callerPublicKey)
100+ let t = j(e, f)
101+ let l = k(e, f)
102+ let u = ((l * 70) / 100)
103+ let v = (t + n)
104+ let w = a(b)
105+ if ((l >= u))
106+ then [IntegerEntry(((("borrow_" + e) + "_") + f), v), ScriptTransfer(Address(toBytes(toBase58String(m.callerPublicKey))), n, toBytes(w))]
91107 else throw("Not enough collateral")
92108 }
93109
94110
95111
96-@Callable(j)
97-func repay (k,c) = {
98- let b = toBase58String(j.callerPublicKey)
99- let t = g(b, c)
100- if ((t > 0))
101- then [IntegerEntry(((("borrow_" + b) + "_") + c), (t - k))]
102- else throw("Nothing to repay")
112+@Callable(m)
113+func repay (n,b) = {
114+ let f = if ((b == ""))
115+ then "WAVES"
116+ else b
117+ let e = toBase58String(m.callerPublicKey)
118+ let x = j(e, f)
119+ if ((x > 0))
120+ then [IntegerEntry(((("borrow_" + e) + "_") + f), (x - n))]
121+ else [IntegerEntry(((("collateral_" + e) + "_") + f), n), throw("Nothing to repay, your Ammount has been deposit as Collateral")]
103122 }
104123
105124
106125
107-@Callable(j)
108-func withdraw (k,c) = {
109- let b = toBase58String(j.callerPublicKey)
110- let u = a(b, c)
111- if ((u > 0))
112- then [IntegerEntry(((("deposit_" + b) + "_") + c), (u - k))]
113- else throw("Nothing to withdraw")
126+@Callable(m)
127+func withdraw (n,b) = {
128+ let f = if ((b == ""))
129+ then "WAVES"
130+ else b
131+ let e = toBase58String(m.callerPublicKey)
132+ let s = addressFromPublicKey(m.callerPublicKey)
133+ let y = d(e, f)
134+ if ((0 > n))
135+ then throw("Can't withdraw negative amount")
136+ else if (if ((y > 0))
137+ then (y >= n)
138+ else false)
139+ then [IntegerEntry(((("deposit_" + e) + "_") + f), (y - n)), ScriptTransfer(s, n, m.feeAssetId)]
140+ else throw("Nothing to withdraw")
114141 }
115142
116143
117-@Verifier(v)
118-func w () = {
119- let e = v
120- if ($isInstanceOf(e, "DataTransaction"))
144+@Verifier(z)
145+func A () = {
146+ let h = z
147+ if ($isInstanceOf(h, "DataTransaction"))
121148 then true
122- else if ($isInstanceOf(e, "SetScriptTransaction"))
149+ else if ($isInstanceOf(h, "SetScriptTransaction"))
123150 then true
124151 else true
125152 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-func a (b,c) = {
5- let d = {
6- let e = getInteger(this, ((("deposit_" + b) + "_") + c))
7- if ($isInstanceOf(e, "Int"))
4+func a (b) = {
5+ let c = if ((b == ""))
6+ then ""
7+ else if ((b == "USDN"))
8+ then "3KFXBGGLCjA5Z2DuW4Dq9fDDrHjJJP1ZEkaoajSzuKsC"
9+ else throw("Unsupported asset")
10+ c
11+ }
12+
13+
14+func d (e,b) = {
15+ let f = if ((b == ""))
16+ then "WAVES"
17+ else b
18+ let g = {
19+ let h = getInteger(this, ((("deposit_" + e) + "_") + f))
20+ if ($isInstanceOf(h, "Int"))
821 then {
9- let f = e
10- f
22+ let i = h
23+ i
1124 }
1225 else 0
1326 }
14- d
27+ g
1528 }
1629
1730
18-func g (b,c) = {
19- let d = {
20- let e = getInteger(this, ((("borrow_" + b) + "_") + c))
21- if ($isInstanceOf(e, "Int"))
31+func j (e,b) = {
32+ let f = if ((b == ""))
33+ then "WAVES"
34+ else b
35+ let g = {
36+ let h = getInteger(this, ((("borrow_" + e) + "_") + f))
37+ if ($isInstanceOf(h, "Int"))
2238 then {
23- let f = e
24- f
39+ let i = h
40+ i
2541 }
2642 else 0
2743 }
28- d
44+ g
2945 }
3046
3147
32-func h (b,c) = if ((c == ""))
33- then {
34- let i = {
35- let e = getInteger(this, ((("collateral_" + b) + "_Waves") + c))
36- if ($isInstanceOf(e, "Int"))
37- then {
38- let f = e
39- f
40- }
41- else 0
42- }
43- i
48+func k (e,b) = {
49+ let f = if ((b == ""))
50+ then "WAVES"
51+ else b
52+ let l = {
53+ let h = getInteger(this, ((("collateral_" + e) + "_") + f))
54+ if ($isInstanceOf(h, "Int"))
55+ then {
56+ let i = h
57+ i
58+ }
59+ else 0
4460 }
45- else {
46- let i = {
47- let e = getInteger(this, ((("collateral_" + b) + "_") + c))
48- if ($isInstanceOf(e, "Int"))
49- then {
50- let f = e
51- f
52- }
53- else 0
54- }
55- i
56- }
61+ l
62+ }
5763
5864
59-@Callable(j)
60-func deposit (k,c) = {
61- let b = toBase58String(j.callerPublicKey)
62- let l = if ((c == ""))
65+@Callable(m)
66+func deposit (n,b) = {
67+ let e = toBase58String(m.callerPublicKey)
68+ let f = if ((b == ""))
6369 then "WAVES"
64- else c
65- let m = a(b, l)
66- let n = (m + k)
67-[IntegerEntry(((("deposit_" + b) + "_") + l), n)]
70+ else b
71+ let o = d(e, f)
72+ let p = (o + n)
73+[IntegerEntry(((("deposit_" + e) + "_") + f), p)]
6874 }
6975
7076
7177
72-@Callable(j)
73-func depositCollateral (k,c) = {
74- let b = toBase58String(j.callerPublicKey)
75- let o = h(b, c)
76- let p = (o + k)
77-[IntegerEntry(((("collateral_" + b) + "_") + c), p)]
78+@Callable(m)
79+func depositCollateral (n,b) = {
80+ let f = if ((b == ""))
81+ then "WAVES"
82+ else b
83+ let e = toBase58String(m.callerPublicKey)
84+ let q = k(e, f)
85+ let r = (q + n)
86+ if ((0 >= n))
87+ then throw("Ammount must be bigger than 0")
88+ else [IntegerEntry(((("collateral_" + e) + "_") + f), r)]
7889 }
7990
8091
8192
82-@Callable(j)
83-func borrow (k,c) = {
84- let b = toBase58String(j.callerPublicKey)
85- let q = g(b, c)
86- let i = h(b, c)
87- let r = ((i * 70) / 100)
88- let s = (q + k)
89- if ((i >= r))
90- then [IntegerEntry(((("borrow_" + b) + "_") + c), s)]
93+@Callable(m)
94+func borrow (n,b) = {
95+ let f = if ((b == ""))
96+ then "WAVES"
97+ else b
98+ let e = toBase58String(m.callerPublicKey)
99+ let s = addressFromPublicKey(m.callerPublicKey)
100+ let t = j(e, f)
101+ let l = k(e, f)
102+ let u = ((l * 70) / 100)
103+ let v = (t + n)
104+ let w = a(b)
105+ if ((l >= u))
106+ then [IntegerEntry(((("borrow_" + e) + "_") + f), v), ScriptTransfer(Address(toBytes(toBase58String(m.callerPublicKey))), n, toBytes(w))]
91107 else throw("Not enough collateral")
92108 }
93109
94110
95111
96-@Callable(j)
97-func repay (k,c) = {
98- let b = toBase58String(j.callerPublicKey)
99- let t = g(b, c)
100- if ((t > 0))
101- then [IntegerEntry(((("borrow_" + b) + "_") + c), (t - k))]
102- else throw("Nothing to repay")
112+@Callable(m)
113+func repay (n,b) = {
114+ let f = if ((b == ""))
115+ then "WAVES"
116+ else b
117+ let e = toBase58String(m.callerPublicKey)
118+ let x = j(e, f)
119+ if ((x > 0))
120+ then [IntegerEntry(((("borrow_" + e) + "_") + f), (x - n))]
121+ else [IntegerEntry(((("collateral_" + e) + "_") + f), n), throw("Nothing to repay, your Ammount has been deposit as Collateral")]
103122 }
104123
105124
106125
107-@Callable(j)
108-func withdraw (k,c) = {
109- let b = toBase58String(j.callerPublicKey)
110- let u = a(b, c)
111- if ((u > 0))
112- then [IntegerEntry(((("deposit_" + b) + "_") + c), (u - k))]
113- else throw("Nothing to withdraw")
126+@Callable(m)
127+func withdraw (n,b) = {
128+ let f = if ((b == ""))
129+ then "WAVES"
130+ else b
131+ let e = toBase58String(m.callerPublicKey)
132+ let s = addressFromPublicKey(m.callerPublicKey)
133+ let y = d(e, f)
134+ if ((0 > n))
135+ then throw("Can't withdraw negative amount")
136+ else if (if ((y > 0))
137+ then (y >= n)
138+ else false)
139+ then [IntegerEntry(((("deposit_" + e) + "_") + f), (y - n)), ScriptTransfer(s, n, m.feeAssetId)]
140+ else throw("Nothing to withdraw")
114141 }
115142
116143
117-@Verifier(v)
118-func w () = {
119- let e = v
120- if ($isInstanceOf(e, "DataTransaction"))
144+@Verifier(z)
145+func A () = {
146+ let h = z
147+ if ($isInstanceOf(h, "DataTransaction"))
121148 then true
122- else if ($isInstanceOf(e, "SetScriptTransaction"))
149+ else if ($isInstanceOf(h, "SetScriptTransaction"))
123150 then true
124151 else true
125152 }
126153

github/deemru/w8io/169f3d6 
102.83 ms