tx · E3R3TTS66eEPGB7KDa1W7FAEgeEhkn1ZUoU8WXc8g7mH

3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8:  -0.01000000 Waves

2022.03.25 12:50 [1979308] smart account 3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8 > SELF 0.00000000 Waves

{ "type": 13, "id": "E3R3TTS66eEPGB7KDa1W7FAEgeEhkn1ZUoU8WXc8g7mH", "fee": 1000000, "feeAssetId": null, "timestamp": 1648201897739, "version": 2, "chainId": 84, "sender": "3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8", "senderPublicKey": "7KdKmjfPuTXGRNZv4VEz9mZiC2qb9JPzuji5z6jszZyo", "proofs": [ "3zimUj9pmVPzGHkKZnDazVkdmh4JNcZWyB2PUSnYsUWJiZ8Snyvv9EjsXzyGft1QPWC4x38N5EaVEMigbEgRgjgN" ], "script": "base64:AAIFAAAAAAAAAAgIAhIECgIBCAAAAAoAAAAADGV4Y2hhbmdlUmF0ZQAAAAAAAAAACgAAAAAXZXhjaGFuZ2VSYXRlRGlmZlBlcmNlbnQAAAAAAAAAAAoAAAAAD1VTRE50b1dBVkVTcmF0ZQkAAGsAAAADBQAAAAxleGNoYW5nZVJhdGUJAABlAAAAAgAAAAAAAAAAZAUAAAAXZXhjaGFuZ2VSYXRlRGlmZlBlcmNlbnQAAAAAAAAAAGQAAAAABFVTRE4BAAAAICJkPx6+YEbpEWoTE9ymM/4Wfgf5d+mz8hX8mUkqMAo3AAAAAAVXQVZFUwEAAAAAAAAAAA9VU0ROdG9XQVZFU1JhdGUAAAAAAAAAAAoAAAAADmxvYW5GZWVQZXJjZW50AAAAAAAAAAABAQAAABNleGNoYW5nZVdBVkVTdG9VU0ROAAAAAwAAAAZhbW91bnQAAAAHYXNzZXRJZAAAAAZjYWxsZXIDCQAAAAAAAAIFAAAAB2Fzc2V0SWQFAAAABVdBVkVTCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMJAQAAAAdB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AAAAARib3JyBAAAAAxzdGFydEJhbGFuY2UJAAPwAAAAAgUAAAAEdGhpcwUAAAAEVVNETgMJAAAAAAAAAgUAAAAMc3RhcnRCYWxhbmNlBQAAAAxzdGFydEJhbGFuY2UEAAAACGJvcnJvd2VyBQAAAARib3JyBAAAAAR0ZXN0CQEAAAAFdHJhZGUAAAADCQACWQAAAAEFAAAABGJvcnIFAAAABmFtb3VudAUAAAAEVVNETgQAAAALYmFsYW5jZURpZmYJAABlAAAAAgkAAGQAAAACCQAD8AAAAAIFAAAABHRoaXMFAAAABFVTRE4AAAAAAAABhqAFAAAADHN0YXJ0QmFsYW5jZQQAAAAGcHJvZml0CQAAawAAAAMFAAAABmFtb3VudAUAAAAObG9hbkZlZVBlcmNlbnQAAAAAAAAAAGQDCQAAZgAAAAIFAAAABnByb2ZpdAUAAAALYmFsYW5jZURpZmYJAAACAAAAAQkAASwAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAeRGVidCBub3QgcGFpZCwgYmVjYXVzZSBkaWZmID0gCQABpAAAAAEFAAAAC2JhbGFuY2VEaWZmAgAAABIuIEV4cGVjdGVkIGRpZmYgPSAJAAGkAAAAAQUAAAAGcHJvZml0CQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAICAAAABHRlc3QCAAAABHRlc3QFAAAAA25pbAkAAAIAAAABAgAAACRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4AAAAAo6Cavw==", "height": 1979308, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4ynUTfunL87WYLJjyKmR7PUXoeXwGivVP3GrMkGXteb Next: 4qyPw9m2NxBZJUvpSzSygwXoPLSvcLB43pHgb2HmeCKs Diff:
OldNewDifferences
6262 then {
6363 let borrower = borr
6464 let test = trade(fromBase58String(borr), amount, USDN)
65- if ((test == test))
66- then {
67- let balanceDiff = ((assetBalance(this, USDN) + 100000) - startBalance)
68- let profit = fraction(amount, loanFeePercent, 100)
69- if ((profit > balanceDiff))
70- then throw(((("Debt not paid, because diff = " + toString(balanceDiff)) + ". Expected diff = ") + toString(profit)))
71- else [StringEntry("test", "test")]
72- }
73- else throw("Strict value is not equal to itself.")
65+ let balanceDiff = ((assetBalance(this, USDN) + 100000) - startBalance)
66+ let profit = fraction(amount, loanFeePercent, 100)
67+ if ((profit > balanceDiff))
68+ then throw(((("Debt not paid, because diff = " + toString(balanceDiff)) + ". Expected diff = ") + toString(profit)))
69+ else [StringEntry("test", "test")]
7470 }
7571 else throw("Strict value is not equal to itself.")
7672 }
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 func exchangeWAVEStoUSDN (amount,assetId,caller) = if ((assetId == WAVES))
1919 then [ScriptTransfer(Address(caller), (amount / USDNtoWAVESrate), USDN), IntegerEntry("WAVEStoUSDN", amount)]
2020 else throw("Unexpected Token")
2121
2222
2323 func exchangeUSDNtoWAVES (amount,assetId,caller) = if ((assetId == USDN))
2424 then [ScriptTransfer(Address(caller), (amount * USDNtoWAVESRate), WAVES), IntegerEntry("USDNtoWAVES", amount)]
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, WAVES, 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), StringEntry("trade", ((toString(debt) + " ") + toString(profit)))]
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)
5959 func flashloan (amount,borr) = {
6060 let startBalance = assetBalance(this, USDN)
6161 if ((startBalance == startBalance))
6262 then {
6363 let borrower = borr
6464 let test = trade(fromBase58String(borr), amount, USDN)
65- if ((test == test))
66- then {
67- let balanceDiff = ((assetBalance(this, USDN) + 100000) - startBalance)
68- let profit = fraction(amount, loanFeePercent, 100)
69- if ((profit > balanceDiff))
70- then throw(((("Debt not paid, because diff = " + toString(balanceDiff)) + ". Expected diff = ") + toString(profit)))
71- else [StringEntry("test", "test")]
72- }
73- else throw("Strict value is not equal to itself.")
65+ let balanceDiff = ((assetBalance(this, USDN) + 100000) - startBalance)
66+ let profit = fraction(amount, loanFeePercent, 100)
67+ if ((profit > balanceDiff))
68+ then throw(((("Debt not paid, because diff = " + toString(balanceDiff)) + ". Expected diff = ") + toString(profit)))
69+ else [StringEntry("test", "test")]
7470 }
7571 else throw("Strict value is not equal to itself.")
7672 }
7773
7874

github/deemru/w8io/026f985 
41.20 ms