tx · HAUfWLssDENqiUaR6onWHgnLpTfu9XBmZtazG6JPgp7t

3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8:  -0.01000000 Waves

2022.03.28 14:41 [1983711] smart account 3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8 > SELF 0.00000000 Waves

{ "type": 13, "id": "HAUfWLssDENqiUaR6onWHgnLpTfu9XBmZtazG6JPgp7t", "fee": 1000000, "feeAssetId": null, "timestamp": 1648467691836, "version": 2, "chainId": 84, "sender": "3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8", "senderPublicKey": "7KdKmjfPuTXGRNZv4VEz9mZiC2qb9JPzuji5z6jszZyo", "proofs": [ "2cXLe5NPeRTNup78FLWYMC2UkFnM7DC1XjGruRnBaT8FY17CSPR6r7HchG7LyL3MKWZk7oY5T8jCzRHhrbDXTpTR" ], "script": "base64:AAIFAAAAAAAAAA8IAhIFCgMCAQISBAoCAQgAAAAJAAAAAAxleGNoYW5nZVJhdGUAAAAAAAAAAAoAAAAAF2V4Y2hhbmdlUmF0ZURpZmZQZXJjZW50AAAAAAAAAAAKAAAAAA9VU0ROdG9XQVZFU3JhdGUJAABrAAAAAwUAAAAMZXhjaGFuZ2VSYXRlCQAAZQAAAAIAAAAAAAAAAGQFAAAAF2V4Y2hhbmdlUmF0ZURpZmZQZXJjZW50AAAAAAAAAABkAAAAAARVU0ROAQAAACAiZD8evmBG6RFqExPcpjP+Fn4H+Xfps/IV/JlJKjAKNwAAAAAFV0FWRVMBAAAAAAAAAAAPVVNETnRvV0FWRVNSYXRlAAAAAAAAAAAKAAAAAA5sb2FuRmVlUGVyY2VudAAAAAAAAAAAAQEAAAATZXhjaGFuZ2VXQVZFU3RvVVNETgAAAAMAAAAGYW1vdW50AAAAB2Fzc2V0SWQAAAAGY2FsbGVyAwkAAAAAAAACBQAAAAdhc3NldElkBQAAAAVXQVZFUwkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCQEAAAAHQWRkcmV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gAAAACr/uj/", "height": 1983711, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4qyPw9m2NxBZJUvpSzSygwXoPLSvcLB43pHgb2HmeCKs Next: 8m9akKqEbdsvQ3Mi9vrrdFfFz2Qge13TgsN936erV3Li Diff:
OldNewDifferences
6363 if ((startBalance == startBalance))
6464 then {
6565 let borrower = borr
66- let test = invoke(Address(base58'3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8'), "trade", [fromBase58String(borr), amount, USDN], [AttachedPayment(base58'', 500000)])
66+ let test = invoke(Address(base58'3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8'), "trade", [fromBase58String(borr), amount, USDN], [AttachedPayment(base58'WAVES', 500000)])
6767 if ((test == test))
6868 then {
6969 let balanceDiff = ((assetBalance(this, USDN) + 100000) - startBalance)
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 @Callable(i)
2929 func trade (borrower,amount,assetId) = {
3030 let loanAmount = if ((assetId == USDN))
3131 then amount
3232 else throw("Unexpected payment asset")
3333 let startBalanceWAVES = assetBalance(this, WAVES)
3434 if ((startBalanceWAVES == startBalanceWAVES))
3535 then {
3636 let r1 = exchangeUSDNtoWAVES(amount, assetId, borrower)
3737 if ((r1 == r1))
3838 then {
3939 let diffWAVES = (assetBalance(this, WAVES) - startBalanceWAVES)
4040 if ((diffWAVES == diffWAVES))
4141 then {
4242 let r2 = exchangeWAVEStoUSDN(amount, WAVES, borrower)
4343 if ((r2 == r2))
4444 then {
4545 let debt = fraction(loanAmount, (100 + loanFeePercent), 100)
4646 let profit = (assetBalance(this, USDN) - debt)
4747 [ScriptTransfer(Address(borrower), profit, USDN), ScriptTransfer(this, debt, USDN), StringEntry("trade", ((toString(debt) + " ") + toString(profit)))]
4848 }
4949 else throw("Strict value is not equal to itself.")
5050 }
5151 else throw("Strict value is not equal to itself.")
5252 }
5353 else throw("Strict value is not equal to itself.")
5454 }
5555 else throw("Strict value is not equal to itself.")
5656 }
5757
5858
5959
6060 @Callable(i)
6161 func flashloan (amount,borr) = {
6262 let startBalance = assetBalance(this, USDN)
6363 if ((startBalance == startBalance))
6464 then {
6565 let borrower = borr
66- let test = invoke(Address(base58'3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8'), "trade", [fromBase58String(borr), amount, USDN], [AttachedPayment(base58'', 500000)])
66+ let test = invoke(Address(base58'3Mw2biLQi5ygMk7zexboNGrnMYuaSfrziY8'), "trade", [fromBase58String(borr), amount, USDN], [AttachedPayment(base58'WAVES', 500000)])
6767 if ((test == test))
6868 then {
6969 let balanceDiff = ((assetBalance(this, USDN) + 100000) - startBalance)
7070 let profit = fraction(amount, loanFeePercent, 100)
7171 if ((profit > balanceDiff))
7272 then throw(((("Debt not paid, because diff = " + toString(balanceDiff)) + ". Expected diff = ") + toString(profit)))
7373 else [StringEntry("test", "test")]
7474 }
7575 else throw("Strict value is not equal to itself.")
7676 }
7777 else throw("Strict value is not equal to itself.")
7878 }
7979
8080

github/deemru/w8io/026f985 
26.97 ms