tx · EVK7g52TfiX2eSMaZeAxPGCEDV6M7g3untjQGkxf4XSu 3Mwm6wcc5SBiMzF2dMWpTJpFFobA236iAZ7: -0.00300000 Waves 2022.09.01 12:30 [2209889] smart account 3Mwm6wcc5SBiMzF2dMWpTJpFFobA236iAZ7 > SELF 0.00000000 Waves
{ "type": 13, "id": "EVK7g52TfiX2eSMaZeAxPGCEDV6M7g3untjQGkxf4XSu", "fee": 300000, "feeAssetId": null, "timestamp": 1662024674274, "version": 2, "chainId": 84, "sender": "3Mwm6wcc5SBiMzF2dMWpTJpFFobA236iAZ7", "senderPublicKey": "BpvXf9toCinzcKiB63evew28WyjAZX5mTYcnAcRGMAH6", "proofs": [ "BY8qh2q16CenLTwjancPHM3zzm7WjxpiLpJNgQW9S6auBYYbJ4Znxbg8DHKnYFg6fA3R8h84cSqhKn43nBakQJq" ], "script": "base64:AAIFAAAAAAAAAB0IAhIFCgMBAgISBQoDAQICEgUKAwIBAhIECgIBCAAAAAcAAAAADGV4Y2hhbmdlUmF0ZQAAAAAAAAAACgAAAAAXZXhjaGFuZ2VSYXRlRGlmZlBlcmNlbnQAAAAAAAAAAAoAAAAAD1VTRE50b1dBVkVTcmF0ZQkAAGsAAAADBQAAAAxleGNoYW5nZVJhdGUJAABlAAAAAgAAAAAAAAAAZAUAAAAXZXhjaGFuZ2VSYXRlRGlmZlBlcmNlbnQAAAAAAAAAAGQAAAAABFVTRE4BAAAAIA/yHBKs5MQ8muxGGqslqLDsugcrRsxtiHLwteKSSQG0AAAAAAVXQVZFUwEAAAAAAAAAAA9VU0ROdG9XQVZFU1JhdGUAAAAAAAAAAAoAAAAADmxvYW5GZWVQZXJjZW50AAAAAAAAAAABAAAABAAAAAFpAQAAABNleGNoYW5nZVdBVkVTdG9VU0ROAAAAAwAAAAZhbW91bnQAAAAHYXNzZXRJZAAAAAZjYWxsZXIDCQAAAAAAAAIFAAAAB2Fzc2V0SWQFAAAABVdBVkVTCQAETAAAAAIJAQAAAA5TY3JpcHRUc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AAAAA25pbAkAAAIAAAABAgAAACRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4AAAAADieWRw==", "height": 2209889, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3kKQa3X1twvpZtjrLc1EEWkcsLerQHrLjsoL8Ss65LQj Next: none Diff:
Old | New | Differences | |
---|---|---|---|
7 | 7 | ||
8 | 8 | let c = fraction(a, (100 - b), 100) | |
9 | 9 | ||
10 | - | let d = base58' | |
10 | + | let d = base58'25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT' | |
11 | 11 | ||
12 | 12 | let e = base58'' | |
13 | 13 | ||
15 | 15 | ||
16 | 16 | let g = 1 | |
17 | 17 | ||
18 | - | func h (i,j,k) = if ((j == e)) | |
19 | - | then [ScriptTransfer(Address(k), (i / c), d)] | |
18 | + | @Callable(h) | |
19 | + | func exchangeWAVEStoUSDN (i,j,k) = if ((j == e)) | |
20 | + | then [ScriptTransfer(Address(k), fraction(i, (c - 1), 100), d), IntegerEntry("WAVEStoUSDN", i)] | |
20 | 21 | else throw("Unexpected Token") | |
21 | 22 | ||
22 | 23 | ||
23 | - | func l (i,j,k) = if ((j == d)) | |
24 | - | then [ScriptTransfer(Address(k), (i * f), e)] | |
24 | + | ||
25 | + | @Callable(h) | |
26 | + | func exchangeUSDNtoWAVES (i,j,k) = if ((j == d)) | |
27 | + | then [ScriptTransfer(Address(k), (i * f), unit), IntegerEntry("USDNtoWAVES", i)] | |
25 | 28 | else throw("Unexpected Token") | |
26 | 29 | ||
27 | 30 | ||
28 | - | func m (n,i,j) = { | |
29 | - | let o = if ((j == d)) | |
31 | + | ||
32 | + | @Callable(h) | |
33 | + | func trade (l,i,j) = { | |
34 | + | let m = if ((j == d)) | |
30 | 35 | then i | |
31 | 36 | else throw("Unexpected payment asset") | |
32 | - | let p = assetBalance(this, e) | |
33 | - | if ((p == p)) | |
37 | + | let n = wavesBalance(this).regular | |
38 | + | let o = reentrantInvoke(Address(base58'3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8'), "exchangeUSDNtoWAVES", [i, d, l], nil) | |
39 | + | if ((o == o)) | |
34 | 40 | then { | |
35 | - | let q = l(i, j, n) | |
36 | - | if ((q == q)) | |
37 | - | then { | |
38 | - | let r = (assetBalance(this, e) - p) | |
39 | - | if ((r == r)) | |
40 | - | then { | |
41 | - | let s = h(i, e, n) | |
42 | - | if ((s == s)) | |
43 | - | then { | |
44 | - | let t = fraction(o, (100 + g), 100) | |
45 | - | let u = (assetBalance(this, d) - t) | |
46 | - | [ScriptTransfer(Address(n), u, d), ScriptTransfer(this, t, d)] | |
47 | - | } | |
48 | - | else throw("Strict value is not equal to itself.") | |
49 | - | } | |
50 | - | else throw("Strict value is not equal to itself.") | |
51 | - | } | |
41 | + | let p = wavesBalance(this).regular | |
42 | + | let q = (p - n) | |
43 | + | let r = reentrantInvoke(Address(base58'3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8'), "exchangeWAVEStoUSDN", [i, e, l], nil) | |
44 | + | if ((r == r)) | |
45 | + | then [IntegerEntry("STARTBALANCEWAVES", n), IntegerEntry("diffWAVES", p), IntegerEntry("loanAmount", m), ScriptTransfer(Address(l), i, d)] | |
52 | 46 | else throw("Strict value is not equal to itself.") | |
53 | 47 | } | |
54 | 48 | else throw("Strict value is not equal to itself.") | |
55 | 49 | } | |
56 | 50 | ||
57 | 51 | ||
58 | - | @Callable(v) | |
59 | - | func flashloan (i,w) = { | |
60 | - | let x = assetBalance(this, d) | |
61 | - | if ((x == x)) | |
52 | + | ||
53 | + | @Callable(h) | |
54 | + | func flashloan (i,s) = { | |
55 | + | let t = assetBalance(this, d) | |
56 | + | let l = s | |
57 | + | let u = reentrantInvoke(Address(base58'3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8'), "trade", [fromBase58String(s), i, d], nil) | |
58 | + | if ((u == u)) | |
62 | 59 | then { | |
63 | - | let n = w | |
64 | - | let y = m(fromBase58String(w), i, d) | |
65 | - | if ((y == y)) | |
66 | - | then { | |
67 | - | let z = (assetBalance(this, d) - x) | |
68 | - | let u = fraction(i, g, 100) | |
69 | - | if ((u > z)) | |
70 | - | then throw(((("Debt not paid, because diff = " + toString(z)) + ". Expected diff = ") + toString(u))) | |
71 | - | else nil | |
72 | - | } | |
73 | - | else throw("Strict value is not equal to itself.") | |
60 | + | let v = assetBalance(this, d) | |
61 | + | let w = (v - t) | |
62 | + | let x = fraction(i, g, 100) | |
63 | + | if ((x > w)) | |
64 | + | then throw(((("Debt not paid, because diff = " + toString(v)) + ". Expected diff = ") + toString(x))) | |
65 | + | else [IntegerEntry("startBalance", t), IntegerEntry("balanceDiff", w), StringEntry("this", toString(this)), ScriptTransfer(Address(fromBase58String(s)), x, d)] | |
74 | 66 | } | |
75 | 67 | else throw("Strict value is not equal to itself.") | |
76 | 68 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = 10 | |
5 | 5 | ||
6 | 6 | let b = 10 | |
7 | 7 | ||
8 | 8 | let c = fraction(a, (100 - b), 100) | |
9 | 9 | ||
10 | - | let d = base58' | |
10 | + | let d = base58'25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT' | |
11 | 11 | ||
12 | 12 | let e = base58'' | |
13 | 13 | ||
14 | 14 | let f = 10 | |
15 | 15 | ||
16 | 16 | let g = 1 | |
17 | 17 | ||
18 | - | func h (i,j,k) = if ((j == e)) | |
19 | - | then [ScriptTransfer(Address(k), (i / c), d)] | |
18 | + | @Callable(h) | |
19 | + | func exchangeWAVEStoUSDN (i,j,k) = if ((j == e)) | |
20 | + | then [ScriptTransfer(Address(k), fraction(i, (c - 1), 100), d), IntegerEntry("WAVEStoUSDN", i)] | |
20 | 21 | else throw("Unexpected Token") | |
21 | 22 | ||
22 | 23 | ||
23 | - | func l (i,j,k) = if ((j == d)) | |
24 | - | then [ScriptTransfer(Address(k), (i * f), e)] | |
24 | + | ||
25 | + | @Callable(h) | |
26 | + | func exchangeUSDNtoWAVES (i,j,k) = if ((j == d)) | |
27 | + | then [ScriptTransfer(Address(k), (i * f), unit), IntegerEntry("USDNtoWAVES", i)] | |
25 | 28 | else throw("Unexpected Token") | |
26 | 29 | ||
27 | 30 | ||
28 | - | func m (n,i,j) = { | |
29 | - | let o = if ((j == d)) | |
31 | + | ||
32 | + | @Callable(h) | |
33 | + | func trade (l,i,j) = { | |
34 | + | let m = if ((j == d)) | |
30 | 35 | then i | |
31 | 36 | else throw("Unexpected payment asset") | |
32 | - | let p = assetBalance(this, e) | |
33 | - | if ((p == p)) | |
37 | + | let n = wavesBalance(this).regular | |
38 | + | let o = reentrantInvoke(Address(base58'3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8'), "exchangeUSDNtoWAVES", [i, d, l], nil) | |
39 | + | if ((o == o)) | |
34 | 40 | then { | |
35 | - | let q = l(i, j, n) | |
36 | - | if ((q == q)) | |
37 | - | then { | |
38 | - | let r = (assetBalance(this, e) - p) | |
39 | - | if ((r == r)) | |
40 | - | then { | |
41 | - | let s = h(i, e, n) | |
42 | - | if ((s == s)) | |
43 | - | then { | |
44 | - | let t = fraction(o, (100 + g), 100) | |
45 | - | let u = (assetBalance(this, d) - t) | |
46 | - | [ScriptTransfer(Address(n), u, d), ScriptTransfer(this, t, d)] | |
47 | - | } | |
48 | - | else throw("Strict value is not equal to itself.") | |
49 | - | } | |
50 | - | else throw("Strict value is not equal to itself.") | |
51 | - | } | |
41 | + | let p = wavesBalance(this).regular | |
42 | + | let q = (p - n) | |
43 | + | let r = reentrantInvoke(Address(base58'3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8'), "exchangeWAVEStoUSDN", [i, e, l], nil) | |
44 | + | if ((r == r)) | |
45 | + | then [IntegerEntry("STARTBALANCEWAVES", n), IntegerEntry("diffWAVES", p), IntegerEntry("loanAmount", m), ScriptTransfer(Address(l), i, d)] | |
52 | 46 | else throw("Strict value is not equal to itself.") | |
53 | 47 | } | |
54 | 48 | else throw("Strict value is not equal to itself.") | |
55 | 49 | } | |
56 | 50 | ||
57 | 51 | ||
58 | - | @Callable(v) | |
59 | - | func flashloan (i,w) = { | |
60 | - | let x = assetBalance(this, d) | |
61 | - | if ((x == x)) | |
52 | + | ||
53 | + | @Callable(h) | |
54 | + | func flashloan (i,s) = { | |
55 | + | let t = assetBalance(this, d) | |
56 | + | let l = s | |
57 | + | let u = reentrantInvoke(Address(base58'3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8'), "trade", [fromBase58String(s), i, d], nil) | |
58 | + | if ((u == u)) | |
62 | 59 | then { | |
63 | - | let n = w | |
64 | - | let y = m(fromBase58String(w), i, d) | |
65 | - | if ((y == y)) | |
66 | - | then { | |
67 | - | let z = (assetBalance(this, d) - x) | |
68 | - | let u = fraction(i, g, 100) | |
69 | - | if ((u > z)) | |
70 | - | then throw(((("Debt not paid, because diff = " + toString(z)) + ". Expected diff = ") + toString(u))) | |
71 | - | else nil | |
72 | - | } | |
73 | - | else throw("Strict value is not equal to itself.") | |
60 | + | let v = assetBalance(this, d) | |
61 | + | let w = (v - t) | |
62 | + | let x = fraction(i, g, 100) | |
63 | + | if ((x > w)) | |
64 | + | then throw(((("Debt not paid, because diff = " + toString(v)) + ". Expected diff = ") + toString(x))) | |
65 | + | else [IntegerEntry("startBalance", t), IntegerEntry("balanceDiff", w), StringEntry("this", toString(this)), ScriptTransfer(Address(fromBase58String(s)), x, d)] | |
74 | 66 | } | |
75 | 67 | else throw("Strict value is not equal to itself.") | |
76 | 68 | } | |
77 | 69 | ||
78 | 70 |
github/deemru/w8io/026f985 24.70 ms ◑