tx · 4JZTx3w6Kh8sJ8HtPjqFxN2KJ5soKdQRFANWHtXDH4d8

3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8:  -0.01000000 Waves

2022.04.13 11:41 [2006572] smart account 3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8 > SELF 0.00000000 Waves

{ "type": 13, "id": "4JZTx3w6Kh8sJ8HtPjqFxN2KJ5soKdQRFANWHtXDH4d8", "fee": 1000000, "feeAssetId": null, "timestamp": 1649839265523, "version": 2, "chainId": 84, "sender": "3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8", "senderPublicKey": "7KdKmjfPuTXGRNZv4VEz9mZiC2qb9JPzuji5z6jszZyo", "proofs": [ "Ut4btJd4jJgygWfctv3oMjdJLcXr9CwotL4k5HtUXFXukioic4vbGA8CHMmZRMwCbiDSYBBNj63fpwL7cSL2VV2" ], "script": "base64:AAIFAAAAAAAAAB0IAhIFCgMBAgISBQoDAQICEgUKAwIBAhIECgIBCAAAAAcAAAAADGV4Y2hhbmdlUmF0ZQAAAAAAAAAACgAAAAAXZXhjaGFuZ2VSYXRlRGlmZlBlcmNlbnQAAAAAAAAAAAoAAAAAD1VTRE50b1dBVkVTcmF0ZQkAAGsAAAADBQAAAAxleGNoYW5nZVJhdGUJAABlAAAAAgAAAAAAAAAAZAUAAAAXZXhjaGFuZ2VSYXRlRGlmZlBlcmNlbnQAAAAAAAAAAGQAAAAABFVTRE4BAAAAICJkPx6+YEbpEWoTE9ymM/4Wfgf5d+mz8hX8mUkqMAo3AAAAAAVXQVZFUwEAAAAAAAAAAA9VU0ROdG9XQVZFU1JhdGUAAAAAAAAAAAoAAAAADmxvYW5GZWVQZXJjZW50AAAAAAAAAAABAAAABAAAAAFpAQAAABNleGNoYW5nZVdBVkVTdG9VU0ROAAAAAwAAAAZhbW91bnQAAAAHYXNzZXRJZAAAAAZjYWxsZXIDCQAAAAAAAAIFAAAAB2Fzc2V0SWQFAAAABVdBVkVTCQAETAAAAAIJAQAAA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vd2VyBQAAAARib3JyBAAAAAR0ZXN0CQAD/QAAAAQJAQAAAAdBZGRyZXNzAAAAAQEAAAAaAVROBF4NzFzpgrQiDpEA1ezYX5uE8cLto0kCAAAABXRyYWRlCQAETAAAAAIJAAJZAAAAAQUAAAAEYm9ycgkABEwAAAACBQAAAAZhbW91bnQJAARMAAAAAgUAAAAEVVNETgUAAAADbmlsBQAAAANuaWwDCQAAAAAAAAIFAAAABHRlc3QFAAAABHRlc3QEAAAAC2JhbGFuY2VEaWZmCQAAZQAAAAIJAAPwAAAAAgUAAAAEdGhpcwUAAAAEVVNETgUAAAAMc3RhcnRCYWxhbmNlBAAAAAZwcm9maXQJAABrAAAAAwUAAAAGYW1vdW50BQAAAA5sb2FuRmVlUGVyY2VudAAAAAAAAAAAZAMJAABmAAAAAgUAAAAGcHJvZml0BQAAAAtiYWxhbmNlRGlmZgkAAAIAAAABCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAAB5EZWJ0IG5vdCBwYWlkLCBiZWNhdXNlIGRpZmYgPSAJAAGkAAAAAQUAAAALYmFsYW5jZURpZmYCAAAAEi4gRXhwZWN0ZWQgZGlmZiA9IAkAAaQAAAABBQAAAAZwcm9maXQJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAICAAAADHN0YXJ0QmFsYW5jZQUAAAAMc3RhcnRCYWxhbmNlBQAAAANuaWwJAAACAAAAAQIAAAAkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAAAAAOg/0+0=", "height": 2006572, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: EdYuYxHfdY42aXkHDbgTGXrBc5Naho3X3HcjV5XJFRN5 Next: 6fRQDKrTn2SyaqP82oqaibYdDHZBEU35EWn1SXe3Shk6 Diff:
OldNewDifferences
3535 then amount
3636 else throw("Unexpected payment asset")
3737 let startBalanceWAVES = assetBalance(this, WAVES)
38- if ((startBalanceWAVES == startBalanceWAVES))
38+ let r1 = reentrantInvoke(Address(base58'3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8'), "exchangeUSDNtoWAVES", [amount, USDN, borrower], nil)
39+ if ((r1 == r1))
3940 then {
40- let r1 = reentrantInvoke(Address(base58'3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8'), "exchangeUSDNtoWAVES", [amount, USDN, borrower], nil)
41- if ((r1 == r1))
41+ let diffWAVES = (assetBalance(this, WAVES) - startBalanceWAVES)
42+ let r2 = reentrantInvoke(Address(base58'3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8'), "exchangeWAVEStoUSDN", [amount, WAVES, borrower], nil)
43+ if ((r2 == r2))
4244 then {
43- let diffWAVES = (assetBalance(this, WAVES) - startBalanceWAVES)
44- if ((diffWAVES == diffWAVES))
45- then {
46- let r2 = reentrantInvoke(Address(base58'3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8'), "exchangeWAVEStoUSDN", [amount, WAVES, borrower], nil)
47- if ((r2 == r2))
48- then {
49- let debt = fraction(loanAmount, loanFeePercent, 100)
50- let profit = (assetBalance(this, USDN) - debt)
45+ let debt = fraction(loanAmount, loanFeePercent, 100)
46+ let profit = (assetBalance(this, USDN) - debt)
5147 [StringEntry("trade", ((toString(debt) + " ") + toString(profit))), ScriptTransfer(Address(borrower), profit, USDN)]
52- }
53- else throw("Strict value is not equal to itself.")
54- }
55- else throw("Strict value is not equal to itself.")
5648 }
5749 else throw("Strict value is not equal to itself.")
5850 }
6456 @Callable(i)
6557 func flashloan (amount,borr) = {
6658 let startBalance = assetBalance(this, USDN)
67- if ((startBalance == startBalance))
59+ let borrower = borr
60+ let test = reentrantInvoke(Address(base58'3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8'), "trade", [fromBase58String(borr), amount, USDN], nil)
61+ if ((test == test))
6862 then {
69- let borrower = borr
70- let test = reentrantInvoke(Address(base58'3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8'), "trade", [fromBase58String(borr), amount, USDN], nil)
71- if ((test == test))
72- then {
73- let balanceDiff = (assetBalance(this, USDN) - startBalance)
74- let profit = fraction(amount, loanFeePercent, 100)
75- if ((profit > balanceDiff))
76- then throw(((("Debt not paid, because diff = " + toString(balanceDiff)) + ". Expected diff = ") + toString(profit)))
77- else [IntegerEntry("startBalance", startBalance)]
78- }
79- else throw("Strict value is not equal to itself.")
63+ let balanceDiff = (assetBalance(this, USDN) - startBalance)
64+ let profit = fraction(amount, loanFeePercent, 100)
65+ if ((profit > balanceDiff))
66+ then throw(((("Debt not paid, because diff = " + toString(balanceDiff)) + ". Expected diff = ") + toString(profit)))
67+ else [IntegerEntry("startBalance", startBalance)]
8068 }
8169 else throw("Strict value is not equal to itself.")
8270 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let exchangeRate = 10
55
66 let exchangeRateDiffPercent = 10
77
88 let USDNtoWAVESrate = fraction(exchangeRate, (100 - exchangeRateDiffPercent), 100)
99
1010 let USDN = base58'3KFXBGGLCjA5Z2DuW4Dq9fDDrHjJJP1ZEkaoajSzuKsC'
1111
1212 let WAVES = base58''
1313
1414 let USDNtoWAVESRate = 10
1515
1616 let loanFeePercent = 1
1717
1818 @Callable(i)
1919 func exchangeWAVEStoUSDN (amount,assetId,caller) = if ((assetId == WAVES))
2020 then [ScriptTransfer(Address(caller), (amount / USDNtoWAVESrate), USDN), IntegerEntry("WAVEStoUSDN", amount)]
2121 else throw("Unexpected Token")
2222
2323
2424
2525 @Callable(i)
2626 func exchangeUSDNtoWAVES (amount,assetId,caller) = if ((assetId == USDN))
2727 then [ScriptTransfer(Address(caller), (amount * USDNtoWAVESRate), unit), IntegerEntry("USDNtoWAVES", amount)]
2828 else throw("Unexpected Token")
2929
3030
3131
3232 @Callable(i)
3333 func trade (borrower,amount,assetId) = {
3434 let loanAmount = if ((assetId == USDN))
3535 then amount
3636 else throw("Unexpected payment asset")
3737 let startBalanceWAVES = assetBalance(this, WAVES)
38- if ((startBalanceWAVES == startBalanceWAVES))
38+ let r1 = reentrantInvoke(Address(base58'3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8'), "exchangeUSDNtoWAVES", [amount, USDN, borrower], nil)
39+ if ((r1 == r1))
3940 then {
40- let r1 = reentrantInvoke(Address(base58'3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8'), "exchangeUSDNtoWAVES", [amount, USDN, borrower], nil)
41- if ((r1 == r1))
41+ let diffWAVES = (assetBalance(this, WAVES) - startBalanceWAVES)
42+ let r2 = reentrantInvoke(Address(base58'3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8'), "exchangeWAVEStoUSDN", [amount, WAVES, borrower], nil)
43+ if ((r2 == r2))
4244 then {
43- let diffWAVES = (assetBalance(this, WAVES) - startBalanceWAVES)
44- if ((diffWAVES == diffWAVES))
45- then {
46- let r2 = reentrantInvoke(Address(base58'3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8'), "exchangeWAVEStoUSDN", [amount, WAVES, borrower], nil)
47- if ((r2 == r2))
48- then {
49- let debt = fraction(loanAmount, loanFeePercent, 100)
50- let profit = (assetBalance(this, USDN) - debt)
45+ let debt = fraction(loanAmount, loanFeePercent, 100)
46+ let profit = (assetBalance(this, USDN) - debt)
5147 [StringEntry("trade", ((toString(debt) + " ") + toString(profit))), ScriptTransfer(Address(borrower), profit, USDN)]
52- }
53- else throw("Strict value is not equal to itself.")
54- }
55- else throw("Strict value is not equal to itself.")
5648 }
5749 else throw("Strict value is not equal to itself.")
5850 }
5951 else throw("Strict value is not equal to itself.")
6052 }
6153
6254
6355
6456 @Callable(i)
6557 func flashloan (amount,borr) = {
6658 let startBalance = assetBalance(this, USDN)
67- if ((startBalance == startBalance))
59+ let borrower = borr
60+ let test = reentrantInvoke(Address(base58'3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8'), "trade", [fromBase58String(borr), amount, USDN], nil)
61+ if ((test == test))
6862 then {
69- let borrower = borr
70- let test = reentrantInvoke(Address(base58'3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8'), "trade", [fromBase58String(borr), amount, USDN], nil)
71- if ((test == test))
72- then {
73- let balanceDiff = (assetBalance(this, USDN) - startBalance)
74- let profit = fraction(amount, loanFeePercent, 100)
75- if ((profit > balanceDiff))
76- then throw(((("Debt not paid, because diff = " + toString(balanceDiff)) + ". Expected diff = ") + toString(profit)))
77- else [IntegerEntry("startBalance", startBalance)]
78- }
79- else throw("Strict value is not equal to itself.")
63+ let balanceDiff = (assetBalance(this, USDN) - startBalance)
64+ let profit = fraction(amount, loanFeePercent, 100)
65+ if ((profit > balanceDiff))
66+ then throw(((("Debt not paid, because diff = " + toString(balanceDiff)) + ". Expected diff = ") + toString(profit)))
67+ else [IntegerEntry("startBalance", startBalance)]
8068 }
8169 else throw("Strict value is not equal to itself.")
8270 }
8371
8472

github/deemru/w8io/026f985 
23.17 ms