tx · DCEqFhc7FHgYtHouoTq1SG1y4KYuMyZXeUdVvRn8rBwZ

3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8:  -0.01000000 Waves

2022.03.14 21:46 [1964011] smart account 3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8 > SELF 0.00000000 Waves

{ "type": 13, "id": "DCEqFhc7FHgYtHouoTq1SG1y4KYuMyZXeUdVvRn8rBwZ", "fee": 1000000, "feeAssetId": null, "timestamp": 1647283699126, "version": 2, "chainId": 84, "sender": "3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8", "senderPublicKey": "7KdKmjfPuTXGRNZv4VEz9mZiC2qb9JPzuji5z6jszZyo", "proofs": [ "5iCyw7wG3z8n56HcAX1UoNR5HQTvqbfTHv3EiF9BT4rucLujMfHZzvYJmSqbSHhZDaYvSnqh7qvCb3NgFrZoU5rB" ], "script": "base64:AAIFAAAAAAAAAAkIAhIFCgMBAgIAAAAKAAAAAAxleGNoYW5nZVJhdGUAAAAAAAAAAAoAAAAAF2V4Y2hhbmdlUmF0ZURpZmZQZXJjZW50AAAAAAAAAAAUAAAAAA9VU0ROdG9XQVZFU3JhdGUJAABrAAAAAwUAAAAMZXhjaGFuZ2VSYXRlCQAAZQAAAAIAAAAAAAAAAGQFAAAAF2V4Y2hhbmdlUmF0ZURpZmZQZXJjZW50AAAAAAAAAABkAAAAAARVU0ROAQAAACAiZD8evmBG6RFqExPcpjP+Fn4H+Xfps/IV/JlJKjAKNwAAAAAFV0FWRVMBAAAABBOr2TMAAAAAD1VTRE50b1dBVkVTUmF0ZQAAAAAAAAAABQAAAAAObG9hbkZlZVBlcmNlbnQJAABpAAAAAgAAAAAAAAAACQAAAAAAAAAAZAEAAAATZXhjaGFuZ2VXQVZFU3RvVVNETgAAAAMAAAAGYW1vdW50AAAAB2Fzc2V0SWQAAAAGY2FsbGVyAwkAAAAAAAACBQAAAAdhc3NldElkBQAAAAVXQVZFUwkABEwAAAACCQEAAAAOU2NyaXB0VH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AAAEdGVzdAQAAAALYmFsYW5jZURpZmYJAABlAAAAAgkAA/AAAAACBQAAAAR0aGlzBQAAAARVU0ROBQAAAAxzdGFydEJhbGFuY2UEAAAABnByb2ZpdAkAAGsAAAADBQAAAAZhbW91bnQFAAAADmxvYW5GZWVQZXJjZW50AAAAAAAAAABkAwkAAGYAAAACBQAAAAZwcm9maXQFAAAAC2JhbGFuY2VEaWZmCQAAAgAAAAEJAAEsAAAAAgkAASwAAAACCQABLAAAAAICAAAAHkRlYnQgbm90IHBhaWQsIGJlY2F1c2UgZGlmZiA9IAkAAaQAAAABBQAAAAtiYWxhbmNlRGlmZgIAAAASLiBFeHBlY3RlZCBkaWZmID0gCQABpAAAAAEFAAAABnByb2ZpdAUAAAADbmlsCQAAAgAAAAECAAAAJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAAIAAAABAgAAACRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4AAAAAHrY64Q==", "height": 1964011, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9aoRaPpF9qKuMtm2i4xrpGnFF5uWWPvAQLttZ4awfqdq Next: HC7vdMwYPGpjpHGvHud1bEPJnnkshrccyNfda7kfx1E3 Diff:
OldNewDifferences
5656
5757
5858 @Callable(i)
59-func flashloan (amount,callback,borrower,assetId) = {
59+func flashloan (amount,borrower,assetId) = {
6060 let startBalance = assetBalance(this, USDN)
6161 if ((startBalance == startBalance))
6262 then {
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let exchangeRate = 10
55
66 let exchangeRateDiffPercent = 20
77
88 let USDNtoWAVESrate = fraction(exchangeRate, (100 - exchangeRateDiffPercent), 100)
99
1010 let USDN = base58'3KFXBGGLCjA5Z2DuW4Dq9fDDrHjJJP1ZEkaoajSzuKsC'
1111
1212 let WAVES = base58'WAVES'
1313
1414 let USDNtoWAVESRate = 5
1515
1616 let loanFeePercent = (9 / 100)
1717
1818 func exchangeWAVEStoUSDN (amount,assetId,caller) = if ((assetId == WAVES))
1919 then [ScriptTransfer(Address(caller), (amount / USDNtoWAVESrate), USDN)]
2020 else throw("Unexpected Token")
2121
2222
2323 func exchangeUSDNtoWAVES (amount,assetId,caller) = if ((assetId == USDN))
2424 then [ScriptTransfer(Address(caller), (amount * USDNtoWAVESRate), WAVES)]
2525 else throw("Unexpected Token")
2626
2727
2828 func trade (borrower,amount,assetId) = {
2929 let loanAmount = if ((assetId == USDN))
3030 then amount
3131 else throw("Unexpected payment asset")
3232 let startBalanceWAVES = assetBalance(this, WAVES)
3333 if ((startBalanceWAVES == startBalanceWAVES))
3434 then {
3535 let r1 = exchangeUSDNtoWAVES(amount, assetId, borrower)
3636 if ((r1 == r1))
3737 then {
3838 let diffWAVES = (assetBalance(this, WAVES) - startBalanceWAVES)
3939 if ((diffWAVES == diffWAVES))
4040 then {
4141 let r2 = exchangeWAVEStoUSDN(amount, assetId, borrower)
4242 if ((r2 == r2))
4343 then {
4444 let debt = fraction(loanAmount, (100 + loanFeePercent), 100)
4545 let profit = (assetBalance(this, USDN) - debt)
4646 [ScriptTransfer(Address(borrower), profit, USDN), ScriptTransfer(this, debt, USDN)]
4747 }
4848 else throw("Strict value is not equal to itself.")
4949 }
5050 else throw("Strict value is not equal to itself.")
5151 }
5252 else throw("Strict value is not equal to itself.")
5353 }
5454 else throw("Strict value is not equal to itself.")
5555 }
5656
5757
5858 @Callable(i)
59-func flashloan (amount,callback,borrower,assetId) = {
59+func flashloan (amount,borrower,assetId) = {
6060 let startBalance = assetBalance(this, USDN)
6161 if ((startBalance == startBalance))
6262 then {
6363 let test = trade(borrower, amount, assetId)
6464 if ((test == test))
6565 then {
6666 let balanceDiff = (assetBalance(this, USDN) - startBalance)
6767 let profit = fraction(amount, loanFeePercent, 100)
6868 if ((profit > balanceDiff))
6969 then throw(((("Debt not paid, because diff = " + toString(balanceDiff)) + ". Expected diff = ") + toString(profit)))
7070 else nil
7171 }
7272 else throw("Strict value is not equal to itself.")
7373 }
7474 else throw("Strict value is not equal to itself.")
7575 }
7676
7777

github/deemru/w8io/169f3d6 
32.05 ms