tx · EAVRc1WPDyCA2VxFME8M65VAH3zQH9KK1Q8J2GuHNEpa 3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8: -0.01000000 Waves 2022.04.13 10:30 [2006508] smart account 3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8 > SELF 0.00000000 Waves
{ "type": 13, "id": "EAVRc1WPDyCA2VxFME8M65VAH3zQH9KK1Q8J2GuHNEpa", "fee": 1000000, "feeAssetId": null, "timestamp": 1649835014661, "version": 2, "chainId": 84, "sender": "3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8", "senderPublicKey": "7KdKmjfPuTXGRNZv4VEz9mZiC2qb9JPzuji5z6jszZyo", "proofs": [ "55iwxAHJuM9Rot88SXAP8BvjKo5CQ9tNZY8xFAcRasZMaSHvFtMsVVVknzxvzn7QqB6r2Wyxrya7Yxo3Pe1PdJwm" ], "script": "base64:AAIFAAAAAAAAAB0IAhIFCgMBAgISBQoDAQICEgUKAwIBAhIECgIBCAAAAAcAAAAADGV4Y2hhbmdlUmF0ZQAAAAAAAAAACgAAAAAXZXhjaGFuZ2VSYXRlRGlmZlBlcmNlbnQAAAAAAAAAAAoAAAAAD1VTRE50b1dBVkVTcmF0ZQkAAGsAAAADBQAAAAxleGNoYW5nZVJhdGUJAABlAAAAAgAAAAAAAAAAZAUAAAAXZXhjaGFuZ2VSYXRlRGlmZlBlcmNlbnQAAAAAAAAAAGQAAAAABFVTRE4BAAAAICJkPx6+YEbpEWoTE9ymM/4Wfgf5d+mz8hX8mUkqMAo3AAAAAAVXQVZFUwEAAAAAAAAAAA9VU0ROdG9XQVZFU1JhdGUAAAAAAAAAAAoAAAAADmxvYW5GZWVQZXJjZW50AAAAAAAAAAABAAAABAAAAAFpAQAAABNleGNoYW5nZVdBVkVTdG9VU0ROAAAAAwAAAAZhbW91bnQAAAAHYXNzZXRJZAAAAAZjYWxsZXIDCQAAAAAAAAIFAAAAB2Fzc2V0SWQFAAAABVdBVkVTCQAETAAAAAIJAQAA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ml0CQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAICAAAABHRlc3QCAAAABHRlc3QFAAAAA25pbAkAAAIAAAABAgAAACRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4JAAACAAAAAQIAAAAkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAAAAADKlXkc=", "height": 2006508, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4NPboJj9cyp9TFCWN7Zpd4V6sD7Umwhtw1cqbdv8Zmcs Next: GNTaLc9Qh9YveDvCsRtQ7uqYQA5qsE7HzxWdb4CRUYBu Diff:
Old | New | Differences | |
---|---|---|---|
37 | 37 | let startBalanceWAVES = assetBalance(this, WAVES) | |
38 | 38 | if ((startBalanceWAVES == startBalanceWAVES)) | |
39 | 39 | then { | |
40 | - | let r1 = reentrantInvoke(Address(base58'3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8'), "exchangeUSDNtoWAVES", [amount, assetId, borrower], | |
40 | + | let r1 = reentrantInvoke(Address(base58'3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8'), "exchangeUSDNtoWAVES", [amount, assetId, borrower], nil) | |
41 | 41 | if ((r1 == r1)) | |
42 | 42 | then { | |
43 | 43 | let diffWAVES = (assetBalance(this, WAVES) - startBalanceWAVES) | |
44 | 44 | if ((diffWAVES == diffWAVES)) | |
45 | 45 | then { | |
46 | - | let r2 = reentrantInvoke(Address(base58'3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8'), "exchangeWAVEStoUSDN", [amount, assetId, borrower], | |
46 | + | let r2 = reentrantInvoke(Address(base58'3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8'), "exchangeWAVEStoUSDN", [amount, assetId, borrower], nil) | |
47 | 47 | if ((r2 == r2)) | |
48 | 48 | then { | |
49 | 49 | let debt = fraction(loanAmount, (100 + loanFeePercent), 100) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let exchangeRate = 10 | |
5 | 5 | ||
6 | 6 | let exchangeRateDiffPercent = 10 | |
7 | 7 | ||
8 | 8 | let USDNtoWAVESrate = fraction(exchangeRate, (100 - exchangeRateDiffPercent), 100) | |
9 | 9 | ||
10 | 10 | let USDN = base58'3KFXBGGLCjA5Z2DuW4Dq9fDDrHjJJP1ZEkaoajSzuKsC' | |
11 | 11 | ||
12 | 12 | let WAVES = base58'' | |
13 | 13 | ||
14 | 14 | let USDNtoWAVESRate = 10 | |
15 | 15 | ||
16 | 16 | let loanFeePercent = 1 | |
17 | 17 | ||
18 | 18 | @Callable(i) | |
19 | 19 | func exchangeWAVEStoUSDN (amount,assetId,caller) = if ((assetId == WAVES)) | |
20 | 20 | then [ScriptTransfer(Address(caller), (amount / USDNtoWAVESrate), USDN), IntegerEntry("WAVEStoUSDN", amount)] | |
21 | 21 | else throw("Unexpected Token") | |
22 | 22 | ||
23 | 23 | ||
24 | 24 | ||
25 | 25 | @Callable(i) | |
26 | 26 | func exchangeUSDNtoWAVES (amount,assetId,caller) = if ((assetId == USDN)) | |
27 | 27 | then [ScriptTransfer(Address(caller), (amount * USDNtoWAVESRate), WAVES), IntegerEntry("USDNtoWAVES", amount)] | |
28 | 28 | else throw("Unexpected Token") | |
29 | 29 | ||
30 | 30 | ||
31 | 31 | ||
32 | 32 | @Callable(i) | |
33 | 33 | func trade (borrower,amount,assetId) = { | |
34 | 34 | let loanAmount = if ((assetId == USDN)) | |
35 | 35 | then amount | |
36 | 36 | else throw("Unexpected payment asset") | |
37 | 37 | let startBalanceWAVES = assetBalance(this, WAVES) | |
38 | 38 | if ((startBalanceWAVES == startBalanceWAVES)) | |
39 | 39 | then { | |
40 | - | let r1 = reentrantInvoke(Address(base58'3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8'), "exchangeUSDNtoWAVES", [amount, assetId, borrower], | |
40 | + | let r1 = reentrantInvoke(Address(base58'3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8'), "exchangeUSDNtoWAVES", [amount, assetId, borrower], nil) | |
41 | 41 | if ((r1 == r1)) | |
42 | 42 | then { | |
43 | 43 | let diffWAVES = (assetBalance(this, WAVES) - startBalanceWAVES) | |
44 | 44 | if ((diffWAVES == diffWAVES)) | |
45 | 45 | then { | |
46 | - | let r2 = reentrantInvoke(Address(base58'3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8'), "exchangeWAVEStoUSDN", [amount, assetId, borrower], | |
46 | + | let r2 = reentrantInvoke(Address(base58'3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8'), "exchangeWAVEStoUSDN", [amount, assetId, borrower], nil) | |
47 | 47 | if ((r2 == r2)) | |
48 | 48 | then { | |
49 | 49 | let debt = fraction(loanAmount, (100 + loanFeePercent), 100) | |
50 | 50 | let profit = (assetBalance(this, USDN) - debt) | |
51 | 51 | [StringEntry("trade", ((toString(debt) + " ") + toString(profit))), ScriptTransfer(Address(borrower), profit, USDN)] | |
52 | 52 | } | |
53 | 53 | else throw("Strict value is not equal to itself.") | |
54 | 54 | } | |
55 | 55 | else throw("Strict value is not equal to itself.") | |
56 | 56 | } | |
57 | 57 | else throw("Strict value is not equal to itself.") | |
58 | 58 | } | |
59 | 59 | else throw("Strict value is not equal to itself.") | |
60 | 60 | } | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | ||
64 | 64 | @Callable(i) | |
65 | 65 | func flashloan (amount,borr) = { | |
66 | 66 | let startBalance = assetBalance(this, USDN) | |
67 | 67 | if ((startBalance == startBalance)) | |
68 | 68 | then { | |
69 | 69 | let borrower = borr | |
70 | 70 | let test = reentrantInvoke(Address(base58'3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8'), "trade", [fromBase58String(borr), amount, USDN], [AttachedPayment(unit, 0)]) | |
71 | 71 | if ((test == test)) | |
72 | 72 | then { | |
73 | 73 | let balanceDiff = ((assetBalance(this, USDN) + 100000) - startBalance) | |
74 | 74 | let profit = fraction(amount, loanFeePercent, 100) | |
75 | 75 | if ((profit > balanceDiff)) | |
76 | 76 | then throw(((("Debt not paid, because diff = " + toString(balanceDiff)) + ". Expected diff = ") + toString(profit))) | |
77 | 77 | else [StringEntry("test", "test")] | |
78 | 78 | } | |
79 | 79 | else throw("Strict value is not equal to itself.") | |
80 | 80 | } | |
81 | 81 | else throw("Strict value is not equal to itself.") | |
82 | 82 | } | |
83 | 83 | ||
84 | 84 |
github/deemru/w8io/026f985 37.84 ms ◑