tx · H3Ps2DpcnSkvWMZwgPrUc7AH59fe5ZoA4KM1MTX6on4C

3MwLcJy3MSb2kq6dUaUR5uBgm8zCKZMjz2S:  -0.01400000 Waves

2021.04.03 20:52 [1466585] smart account 3MwLcJy3MSb2kq6dUaUR5uBgm8zCKZMjz2S > SELF 0.00000000 Waves

{ "type": 13, "id": "H3Ps2DpcnSkvWMZwgPrUc7AH59fe5ZoA4KM1MTX6on4C", "fee": 1400000, "feeAssetId": null, "timestamp": 1617472364134, "version": 2, "chainId": 84, "sender": "3MwLcJy3MSb2kq6dUaUR5uBgm8zCKZMjz2S", "senderPublicKey": "CgByewRUvLk7UtWSfRMLSYw4Ap2wT5dcdVYKideqDp9M", "proofs": [ "46FJDGJhUfGrUERF4brd5cVnWRGi94JivuTHoFGikr4cYXxdMLWq9kU1fGwPoK7gpP9xxAfFSJ5FJizg85CrjaiY" ], "script": "base64:AAIEAAAAAAAAAAYIAhIAEgAAAAAVAAAAABJ1c2RuRHl6QUJhbGFuY2VLZXkCAAAAGHVzZG5fZHl6X2FfYXNzZXRfYmFsYW5jZQAAAAASdXNkbkR5ekJCYWxhbmNlS2V5AgAAABh1c2RuX2R5el9iX2Fzc2V0X2JhbGFuY2UAAAAAEWV0aER5ekFCYWxhbmNlS2V5AgAAABdldGhfZHl6X2FfYXNzZXRfYmFsYW5jZQAAAAARZXRoRHl6QkJhbGFuY2VLZXkCAAAAF2V0aF9keXpfYl9hc3NldF9iYWxhbmNlAAAAABZ1c2RuRHl6UGFpcklzQWN0aXZlS2V5AgAAABJ1c2RuX2R5el9pc19hY3RpdmUAAAAAFWV0aER5elBhaXJJc0FjdGl2ZUtleQIAAAARZXRoX2R5el9pc19hY3RpdmUAAAAABmZlZUtleQIAAAADZmVlAAAAAA50b3RhbEZlZUV0aEtleQIAAAANdG90YWxfZmVlX2V0aAAAAAAOdG90YWxGZWVVc2RLZXkCAAAADXRvdGFsX2ZlZV91c2QAAAAAEnRvdGFsRmVlRHl6cmFwdEtleQIAA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QWRkcmVzcwUAAAAJZmVlQW1vdW50BQAAAAdhc3NldElkCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAHckFtb3VudAUAAAAIckFzc2V0SWQFAAAAA25pbAAAAADm6rN6", "height": 1466585, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4dfpS3GLNgEQDED9XT9LX6zYJ2u1mggW8XRWXmU81PSn Next: 2oQ3QJHoAg5mVsXyP6N3VMg76M81bCkePLi3KJ1oU9KX Diff:
OldNewDifferences
1515
1616 let g = "fee"
1717
18-let h = base58'Bi4jxKEFjjYG2emeyxZfpkVMS88N7uAogHNsi1urkoJA'
18+let h = "total_fee_eth"
1919
20-let i = base58'3JJkzB4pFXcqdJvC9TcV8ys1FLgesr5SxbhmykkpceQp'
20+let i = "total_fee_usd"
2121
22-let j = base58'9Nf5wpj6jds3VRZKDryp6Dtf3R9d8MdbjNhencLogCr5'
22+let j = "total_fee_dyzrapt"
2323
24-let k = base58'7zDUSbBXZtec3E333b1fC2wR2MPrnzh69ZrH3rwpQj9S'
24+let k = base58'Bi4jxKEFjjYG2emeyxZfpkVMS88N7uAogHNsi1urkoJA'
2525
26-let l = Address(base58'3N7G2kVtBTh94aEnDHQ9dpi4EdsDxAiDXjB')
26+let l = base58'3JJkzB4pFXcqdJvC9TcV8ys1FLgesr5SxbhmykkpceQp'
2727
28-func m (n) = {
29- let o = valueOrErrorMessage(getInteger(this, n), "unable to read key")
30- o
28+let m = base58'9Nf5wpj6jds3VRZKDryp6Dtf3R9d8MdbjNhencLogCr5'
29+
30+let n = base58'7zDUSbBXZtec3E333b1fC2wR2MPrnzh69ZrH3rwpQj9S'
31+
32+let o = Address(base58'3N7G2kVtBTh94aEnDHQ9dpi4EdsDxAiDXjB')
33+
34+func p (q) = {
35+ let r = valueOrErrorMessage(getInteger(this, q), "unable to read key")
36+ r
3137 }
3238
3339
34-func p (q) = {
35- let r = m(g)
36- let s = fraction(q, r, 10000)
37- s
40+func s (q) = {
41+ let r = valueOrElse(getInteger(this, q), 0)
42+ r
3843 }
3944
4045
41-func t (u,q) = {
42- let s = p(q)
43- let v = (q - s)
44- let w = getIntegerValue(this, a)
45- let x = getIntegerValue(this, b)
46- if ((u == j))
46+func t (q) = s(q)
47+
48+
49+func u (v) = {
50+ let w = p(g)
51+ let x = fraction(v, w, 10000)
52+ x
53+ }
54+
55+
56+func y (z) = if ((z == m))
57+ then i
58+ else if ((z == l))
59+ then h
60+ else if ((z == k))
61+ then j
62+ else throw("Incorrect asset attached")
63+
64+
65+func A (z,v) = {
66+ let x = u(v)
67+ let B = (v - x)
68+ let C = getIntegerValue(this, a)
69+ let D = getIntegerValue(this, b)
70+ if ((z == m))
4771 then {
48- let y = fraction(x, v, (v + w))
49- throw(("usdn" + toString(y)))
72+ let E = fraction(D, B, (B + C))
73+ let F = k
74+ let G = (B + C)
75+ let H = (D - E)
76+ $Tuple5(x, E, F, G, H)
5077 }
51- else if ((u == h))
78+ else if ((z == k))
5279 then {
53- let y = fraction(w, v, (v + x))
54- throw(("dyzrupt " + toString(y)))
80+ let E = fraction(C, B, (B + D))
81+ let F = m
82+ let G = (C - E)
83+ let H = (D + B)
84+ $Tuple5(x, E, F, G, H)
5585 }
5686 else throw("Incorrect asset attached")
5787 }
5888
5989
60-@Callable(z)
90+@Callable(I)
6191 func initUsdnDyzPair () = if (isDefined(getBoolean(this, e)))
6292 then throw("Pair is already active")
63- else if ((z.callerPublicKey != k))
93+ else if ((I.callerPublicKey != n))
6494 then throw("Only admin can activate pair")
6595 else {
66- let A = $Tuple2(z.payments[0].amount, z.payments[0].assetId)
67- let B = A._1
68- let C = A._2
69- let D = $Tuple2(z.payments[1].amount, z.payments[1].assetId)
70- let E = D._1
71- let F = D._2
72- if ((C != j))
96+ let J = $Tuple2(I.payments[0].amount, I.payments[0].assetId)
97+ let K = J._1
98+ let L = J._2
99+ let M = $Tuple2(I.payments[1].amount, I.payments[1].assetId)
100+ let N = M._1
101+ let O = M._2
102+ if ((L != m))
73103 then throw("A asset is not a usdn")
74- else if ((F != h))
104+ else if ((O != k))
75105 then throw("B asset is not a dyzrupt")
76- else [BooleanEntry(e, true), IntegerEntry(a, B), IntegerEntry(b, E), IntegerEntry(g, 300)]
106+ else [BooleanEntry(e, true), IntegerEntry(a, K), IntegerEntry(b, N), IntegerEntry(g, 300)]
77107 }
78108
79109
80110
81-@Callable(z)
111+@Callable(I)
82112 func exchangeUsdnDyz () = if (!(isDefined(getBoolean(this, e))))
83113 then throw("Pair is not active")
84114 else {
85- let G = value(z.payments[0])
86- let u = G.assetId
87- let q = G.amount
88- if (if ((u != j))
89- then (u != h)
115+ let P = value(I.payments[0])
116+ let z = P.assetId
117+ let v = P.amount
118+ if (if ((z != m))
119+ then (z != k)
90120 else false)
91121 then throw("Only usdn and dyzrupt are supporting")
92122 else {
93- let y = t(u, q)
94- throw(y)
123+ let Q = A(z, v)
124+ let x = Q._1
125+ let E = Q._2
126+ let F = Q._3
127+ let G = Q._4
128+ let H = Q._5
129+ let R = y(z)
130+ let S = (t(R) + x)
131+[IntegerEntry(a, G), IntegerEntry(b, H), IntegerEntry(R, S), ScriptTransfer(o, x, z), ScriptTransfer(I.caller, E, F)]
95132 }
96133 }
97134
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let a = "usdn_dyz_a_asset_balance"
55
66 let b = "usdn_dyz_b_asset_balance"
77
88 let c = "eth_dyz_a_asset_balance"
99
1010 let d = "eth_dyz_b_asset_balance"
1111
1212 let e = "usdn_dyz_is_active"
1313
1414 let f = "eth_dyz_is_active"
1515
1616 let g = "fee"
1717
18-let h = base58'Bi4jxKEFjjYG2emeyxZfpkVMS88N7uAogHNsi1urkoJA'
18+let h = "total_fee_eth"
1919
20-let i = base58'3JJkzB4pFXcqdJvC9TcV8ys1FLgesr5SxbhmykkpceQp'
20+let i = "total_fee_usd"
2121
22-let j = base58'9Nf5wpj6jds3VRZKDryp6Dtf3R9d8MdbjNhencLogCr5'
22+let j = "total_fee_dyzrapt"
2323
24-let k = base58'7zDUSbBXZtec3E333b1fC2wR2MPrnzh69ZrH3rwpQj9S'
24+let k = base58'Bi4jxKEFjjYG2emeyxZfpkVMS88N7uAogHNsi1urkoJA'
2525
26-let l = Address(base58'3N7G2kVtBTh94aEnDHQ9dpi4EdsDxAiDXjB')
26+let l = base58'3JJkzB4pFXcqdJvC9TcV8ys1FLgesr5SxbhmykkpceQp'
2727
28-func m (n) = {
29- let o = valueOrErrorMessage(getInteger(this, n), "unable to read key")
30- o
28+let m = base58'9Nf5wpj6jds3VRZKDryp6Dtf3R9d8MdbjNhencLogCr5'
29+
30+let n = base58'7zDUSbBXZtec3E333b1fC2wR2MPrnzh69ZrH3rwpQj9S'
31+
32+let o = Address(base58'3N7G2kVtBTh94aEnDHQ9dpi4EdsDxAiDXjB')
33+
34+func p (q) = {
35+ let r = valueOrErrorMessage(getInteger(this, q), "unable to read key")
36+ r
3137 }
3238
3339
34-func p (q) = {
35- let r = m(g)
36- let s = fraction(q, r, 10000)
37- s
40+func s (q) = {
41+ let r = valueOrElse(getInteger(this, q), 0)
42+ r
3843 }
3944
4045
41-func t (u,q) = {
42- let s = p(q)
43- let v = (q - s)
44- let w = getIntegerValue(this, a)
45- let x = getIntegerValue(this, b)
46- if ((u == j))
46+func t (q) = s(q)
47+
48+
49+func u (v) = {
50+ let w = p(g)
51+ let x = fraction(v, w, 10000)
52+ x
53+ }
54+
55+
56+func y (z) = if ((z == m))
57+ then i
58+ else if ((z == l))
59+ then h
60+ else if ((z == k))
61+ then j
62+ else throw("Incorrect asset attached")
63+
64+
65+func A (z,v) = {
66+ let x = u(v)
67+ let B = (v - x)
68+ let C = getIntegerValue(this, a)
69+ let D = getIntegerValue(this, b)
70+ if ((z == m))
4771 then {
48- let y = fraction(x, v, (v + w))
49- throw(("usdn" + toString(y)))
72+ let E = fraction(D, B, (B + C))
73+ let F = k
74+ let G = (B + C)
75+ let H = (D - E)
76+ $Tuple5(x, E, F, G, H)
5077 }
51- else if ((u == h))
78+ else if ((z == k))
5279 then {
53- let y = fraction(w, v, (v + x))
54- throw(("dyzrupt " + toString(y)))
80+ let E = fraction(C, B, (B + D))
81+ let F = m
82+ let G = (C - E)
83+ let H = (D + B)
84+ $Tuple5(x, E, F, G, H)
5585 }
5686 else throw("Incorrect asset attached")
5787 }
5888
5989
60-@Callable(z)
90+@Callable(I)
6191 func initUsdnDyzPair () = if (isDefined(getBoolean(this, e)))
6292 then throw("Pair is already active")
63- else if ((z.callerPublicKey != k))
93+ else if ((I.callerPublicKey != n))
6494 then throw("Only admin can activate pair")
6595 else {
66- let A = $Tuple2(z.payments[0].amount, z.payments[0].assetId)
67- let B = A._1
68- let C = A._2
69- let D = $Tuple2(z.payments[1].amount, z.payments[1].assetId)
70- let E = D._1
71- let F = D._2
72- if ((C != j))
96+ let J = $Tuple2(I.payments[0].amount, I.payments[0].assetId)
97+ let K = J._1
98+ let L = J._2
99+ let M = $Tuple2(I.payments[1].amount, I.payments[1].assetId)
100+ let N = M._1
101+ let O = M._2
102+ if ((L != m))
73103 then throw("A asset is not a usdn")
74- else if ((F != h))
104+ else if ((O != k))
75105 then throw("B asset is not a dyzrupt")
76- else [BooleanEntry(e, true), IntegerEntry(a, B), IntegerEntry(b, E), IntegerEntry(g, 300)]
106+ else [BooleanEntry(e, true), IntegerEntry(a, K), IntegerEntry(b, N), IntegerEntry(g, 300)]
77107 }
78108
79109
80110
81-@Callable(z)
111+@Callable(I)
82112 func exchangeUsdnDyz () = if (!(isDefined(getBoolean(this, e))))
83113 then throw("Pair is not active")
84114 else {
85- let G = value(z.payments[0])
86- let u = G.assetId
87- let q = G.amount
88- if (if ((u != j))
89- then (u != h)
115+ let P = value(I.payments[0])
116+ let z = P.assetId
117+ let v = P.amount
118+ if (if ((z != m))
119+ then (z != k)
90120 else false)
91121 then throw("Only usdn and dyzrupt are supporting")
92122 else {
93- let y = t(u, q)
94- throw(y)
123+ let Q = A(z, v)
124+ let x = Q._1
125+ let E = Q._2
126+ let F = Q._3
127+ let G = Q._4
128+ let H = Q._5
129+ let R = y(z)
130+ let S = (t(R) + x)
131+[IntegerEntry(a, G), IntegerEntry(b, H), IntegerEntry(R, S), ScriptTransfer(o, x, z), ScriptTransfer(I.caller, E, F)]
95132 }
96133 }
97134
98135

github/deemru/w8io/169f3d6 
47.88 ms