tx · DNeFe6dQefHNtjr2TMwcKqeTMJyXSEa8zPRP53tLTsDU

3MwLcJy3MSb2kq6dUaUR5uBgm8zCKZMjz2S:  -0.01400000 Waves

2021.04.03 19:52 [1466525] smart account 3MwLcJy3MSb2kq6dUaUR5uBgm8zCKZMjz2S > SELF 0.00000000 Waves

{ "type": 13, "id": "DNeFe6dQefHNtjr2TMwcKqeTMJyXSEa8zPRP53tLTsDU", "fee": 1400000, "feeAssetId": null, "timestamp": 1617468785982, "version": 2, "chainId": 84, "sender": "3MwLcJy3MSb2kq6dUaUR5uBgm8zCKZMjz2S", "senderPublicKey": "CgByewRUvLk7UtWSfRMLSYw4Ap2wT5dcdVYKideqDp9M", "proofs": [ "5RLn38mGdRsz9mxmg8jmqLgGd6s64cCZ9qJixK3EumnS7RJkrVMbXDoKh8EzozLfFsqNV3oM6jWFk2VJQafs3dzQ" ], "script": "base64:AAIEAAAAAAAAAAYIAhIAEgAAAAAPAAAAABJ1c2RuRHl6QUJhbGFuY2VLZXkCAAAAGHVzZG5fZHl6X2FfYXNzZXRfYmFsYW5jZQAAAAASdXNkbkR5ekJCYWxhbmNlS2V5AgAAABh1c2RuX2R5el9iX2Fzc2V0X2JhbGFuY2UAAAAAEWV0aER5ekFCYWxhbmNlS2V5AgAAABdldGhfZHl6X2FfYXNzZXRfYmFsYW5jZQAAAAARZXRoRHl6QkJhbGFuY2VLZXkCAAAAF2V0aF9keXpfYl9hc3NldF9iYWxhbmNlAAAAABZ1c2RuRHl6UGFpcklzQWN0aXZlS2V5AgAAABJ1c2RuX2R5el9pc19hY3RpdmUAAAAAFWV0aER5elBhaXJJc0FjdGl2ZUtleQIAAAARZXRoX2R5el9pc19hY3RpdmUAAAAABmZlZUtleQIAAAADZmVlAAAAAA5keXpyYXB0QXNzZXRJZAEAAAAgnxnpc9km71BHiGYaP3+jsvIwnjyNE9APQJ48k4SnBCMAAAAACmV0aEFzc2V0SWQBAAAAICImU7qSm/1VgN3CrHN9jStFD2u0cA4gGz96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BQAAAAdhc3NldElkBQAAAAt1c2RuQXNzZXRJZAYJAQAAAAIhPQAAAAIFAAAAB2Fzc2V0SWQFAAAADmR5enJhcHRBc3NldElkCQAAAgAAAAECAAAAJE9ubHkgdXNkbiBhbmQgZHl6cnVwdCBhcmUgc3VwcG9ydGluZwQAAAAHckFtb3VudAkBAAAAEGdldFVzZG5EeXpBbW91bnQAAAACBQAAAAdhc3NldElkBQAAAAZhbW91bnQJAQAAAAV0aHJvdwAAAAAAAAAAujefNQ==", "height": 1466525, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 7SLtRq6DWjUvBpCPkKddSz5u1vFwmFezZFTYvrXvJ2o Next: 8jFHQcDxsxospWLNmL5RxpL3CoXmRCGG7J9nVqGqbHse Diff:
OldNewDifferences
1313
1414 let f = "eth_dyz_is_active"
1515
16-let g = base58'Bi4jxKEFjjYG2emeyxZfpkVMS88N7uAogHNsi1urkoJA'
16+let g = "fee"
1717
18-let h = base58'3JJkzB4pFXcqdJvC9TcV8ys1FLgesr5SxbhmykkpceQp'
18+let h = base58'Bi4jxKEFjjYG2emeyxZfpkVMS88N7uAogHNsi1urkoJA'
1919
20-let i = base58'9Nf5wpj6jds3VRZKDryp6Dtf3R9d8MdbjNhencLogCr5'
20+let i = base58'3JJkzB4pFXcqdJvC9TcV8ys1FLgesr5SxbhmykkpceQp'
2121
22-let j = base58'CgByewRUvLk7UtWSfRMLSYw4Ap2wT5dcdVYKideqDp9M'
22+let j = base58'9Nf5wpj6jds3VRZKDryp6Dtf3R9d8MdbjNhencLogCr5'
2323
24-@Callable(k)
24+let k = base58'CgByewRUvLk7UtWSfRMLSYw4Ap2wT5dcdVYKideqDp9M'
25+
26+let l = Address(base58'3N7G2kVtBTh94aEnDHQ9dpi4EdsDxAiDXjB')
27+
28+func m (n) = {
29+ let o = valueOrErrorMessage(getInteger(this, n), "unable to read key")
30+ o
31+ }
32+
33+
34+func p (q) = {
35+ let r = m(g)
36+ let s = fraction(q, r, 10000)
37+ r
38+ }
39+
40+
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))
47+ then {
48+ let y = fraction(x, v, (v + w))
49+ throw(("usdn" + toString(y)))
50+ }
51+ else if ((u == h))
52+ then {
53+ let y = fraction(w, v, (v + x))
54+ throw(("dyzrupt " + toString(y)))
55+ }
56+ else throw("Incorrect asset attached")
57+ }
58+
59+
60+@Callable(z)
2561 func initUsdnDyzPair () = if (isDefined(getBoolean(this, e)))
2662 then throw("Pair is already active")
27- else if ((k.callerPublicKey != j))
63+ else if ((z.callerPublicKey != k))
2864 then throw("Only admin can activate pair")
2965 else {
30- let l = $Tuple2(k.payments[0].amount, k.payments[0].assetId)
31- let m = l._1
32- let n = l._2
33- let o = $Tuple2(k.payments[1].amount, k.payments[1].assetId)
34- let p = o._1
35- let q = o._2
36- if ((n != i))
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))
3773 then throw("A asset is not a usdn")
38- else if ((q != g))
74+ else if ((F != h))
3975 then throw("B asset is not a dyzrupt")
40- else throw("hello")
76+ else [BooleanEntry(e, true), IntegerEntry(a, B), IntegerEntry(b, E), IntegerEntry(g, 300)]
4177 }
78+
79+
80+
81+@Callable(z)
82+func exchangeUsdnDyz () = if (!(isDefined(getBoolean(this, e))))
83+ then throw("Pair is not active")
84+ 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 true
90+ else (u != h))
91+ then throw("Only usdn and dyzrupt are supporting")
92+ else {
93+ let y = t(u, q)
94+ throw()
95+ }
96+ }
4297
4398
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
16-let g = base58'Bi4jxKEFjjYG2emeyxZfpkVMS88N7uAogHNsi1urkoJA'
16+let g = "fee"
1717
18-let h = base58'3JJkzB4pFXcqdJvC9TcV8ys1FLgesr5SxbhmykkpceQp'
18+let h = base58'Bi4jxKEFjjYG2emeyxZfpkVMS88N7uAogHNsi1urkoJA'
1919
20-let i = base58'9Nf5wpj6jds3VRZKDryp6Dtf3R9d8MdbjNhencLogCr5'
20+let i = base58'3JJkzB4pFXcqdJvC9TcV8ys1FLgesr5SxbhmykkpceQp'
2121
22-let j = base58'CgByewRUvLk7UtWSfRMLSYw4Ap2wT5dcdVYKideqDp9M'
22+let j = base58'9Nf5wpj6jds3VRZKDryp6Dtf3R9d8MdbjNhencLogCr5'
2323
24-@Callable(k)
24+let k = base58'CgByewRUvLk7UtWSfRMLSYw4Ap2wT5dcdVYKideqDp9M'
25+
26+let l = Address(base58'3N7G2kVtBTh94aEnDHQ9dpi4EdsDxAiDXjB')
27+
28+func m (n) = {
29+ let o = valueOrErrorMessage(getInteger(this, n), "unable to read key")
30+ o
31+ }
32+
33+
34+func p (q) = {
35+ let r = m(g)
36+ let s = fraction(q, r, 10000)
37+ r
38+ }
39+
40+
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))
47+ then {
48+ let y = fraction(x, v, (v + w))
49+ throw(("usdn" + toString(y)))
50+ }
51+ else if ((u == h))
52+ then {
53+ let y = fraction(w, v, (v + x))
54+ throw(("dyzrupt " + toString(y)))
55+ }
56+ else throw("Incorrect asset attached")
57+ }
58+
59+
60+@Callable(z)
2561 func initUsdnDyzPair () = if (isDefined(getBoolean(this, e)))
2662 then throw("Pair is already active")
27- else if ((k.callerPublicKey != j))
63+ else if ((z.callerPublicKey != k))
2864 then throw("Only admin can activate pair")
2965 else {
30- let l = $Tuple2(k.payments[0].amount, k.payments[0].assetId)
31- let m = l._1
32- let n = l._2
33- let o = $Tuple2(k.payments[1].amount, k.payments[1].assetId)
34- let p = o._1
35- let q = o._2
36- if ((n != i))
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))
3773 then throw("A asset is not a usdn")
38- else if ((q != g))
74+ else if ((F != h))
3975 then throw("B asset is not a dyzrupt")
40- else throw("hello")
76+ else [BooleanEntry(e, true), IntegerEntry(a, B), IntegerEntry(b, E), IntegerEntry(g, 300)]
4177 }
78+
79+
80+
81+@Callable(z)
82+func exchangeUsdnDyz () = if (!(isDefined(getBoolean(this, e))))
83+ then throw("Pair is not active")
84+ 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 true
90+ else (u != h))
91+ then throw("Only usdn and dyzrupt are supporting")
92+ else {
93+ let y = t(u, q)
94+ throw()
95+ }
96+ }
4297
4398

github/deemru/w8io/169f3d6 
64.01 ms