tx · HVXSysLEHeHuWvNiyf7sUMQrtahcQHDKhpr23ozLR5nS
3Mwm6wcc5SBiMzF2dMWpTJpFFobA236iAZ7: -0.01000000 Waves
2022.02.15 12:17 [1924553] smart account 3Mwm6wcc5SBiMzF2dMWpTJpFFobA236iAZ7 > SELF 0.00000000 Waves
{
"type": 13,
"id": "HVXSysLEHeHuWvNiyf7sUMQrtahcQHDKhpr23ozLR5nS",
"fee": 1000000,
"feeAssetId": null,
"timestamp": 1644916658831,
"version": 2,
"chainId": 84,
"sender": "3Mwm6wcc5SBiMzF2dMWpTJpFFobA236iAZ7",
"senderPublicKey": "BpvXf9toCinzcKiB63evew28WyjAZX5mTYcnAcRGMAH6",
"proofs": [
"2RvnvP4R2TV523JD7FSQH3t3wHUtZpZd6hLALsrEE4E1CWcX27DCi1WTzwaPqeqjFof8kXN1n5VniGJ1iooMUg4b"
],
"script": "base64:AAIFAAAAAAAAAAcIAhIDCgECAAAABgAAAAAObG9hbkZlZVBlcmNlbnQJAABpAAAAAgAAAAAAAAAACQAAAAAAAAAAZAAAAAAEVVNETgEAAAAgImQ/Hr5gRukRahMT3KYz/hZ+B/l36bPyFfyZSSowCjcAAAAABVdBVkVTAQAAAAQTq9kzAAAAABtleGNoYW5nZXJVU0ROdG9XYXZlc0FkZHJlc3MJAQAAAAdBZGRyZXNzAAAAAQEAAAAaAVRlO0iZAZuQgWXZn5GJMYy9wBUgW1m44o4AAAAAG2V4Y2hhbmdlcldhdmVzVG9VU0ROQWRkcmVzcwkBAAAAB0FkZHJlc3MAAAABAQAAABoBVN4Pvno4pLzl6yPdHWZAu26THq7fS7YWLAAAAAANbG9hbmVyQWRkcmVzcwkBAAAAB0FkZHJlc3MAAAABAQAAABoBVDdtURHBzP3NwchbOzttKqJMBcxR9RiMgwAAAAEAAAABaQEAAAAFdHJhZGUAAAABAAAACGJvcnJvd2VyBAAAAApsb2FuQW1vdW50AwkAAAAAAAACCAkAAZEAAAACCAUAAAABaQAAAAhwYXltZW50cwAA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mFuc2ZlcgAAAAMJAQAAAAdBZGRyZXNzAAAAAQUAAAAIYm9ycm93ZXIFAAAABnByb2ZpdAUAAAAEVVNETgkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAAA1sb2FuZXJBZGRyZXNzBQAAAARkZWJ0BQAAAARVU0ROBQAAAANuaWwJAAACAAAAAQIAAAAkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQAAAgAAAAECAAAAJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAAIAAAABAgAAACRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4JAAACAAAAAQIAAAAkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAAAAADUSNVE=",
"height": 1924553,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: DEwRoqdTFTubgoBPmNb5Zm7HjwXpHBRdHzhZfSqanoKm
Next: 41PXRGr3V5pYvwhBEiRqwE8ZcNyVWkbQCUekTdDGmNc9
Diff:
Old | New | | Differences |
---|
21 | 21 | | let startBalanceWAVES = assetBalance(this, WAVES) |
---|
22 | 22 | | if ((startBalanceWAVES == startBalanceWAVES)) |
---|
23 | 23 | | then { |
---|
24 | | - | let r1 = reentrantInvoke(exchangerUSDNtoWavesAddress, "exchangeUSDNtoWAVES", nil, [AttachedPayment(USDN, loanAmount)]) |
---|
| 24 | + | let r1 = invoke(exchangerUSDNtoWavesAddress, "exchangeUSDNtoWAVES", nil, [AttachedPayment(USDN, loanAmount)]) |
---|
25 | 25 | | if ((r1 == r1)) |
---|
26 | 26 | | then { |
---|
27 | 27 | | let diffWAVES = (assetBalance(this, WAVES) - startBalanceWAVES) |
---|
28 | 28 | | if ((diffWAVES == diffWAVES)) |
---|
29 | 29 | | then { |
---|
30 | | - | let r2 = reentrantInvoke(exchangerWavesToUSDNAddress, "exchangeWAVEStoUSDN", nil, [AttachedPayment(WAVES, diffWAVES)]) |
---|
| 30 | + | let r2 = invoke(exchangerWavesToUSDNAddress, "exchangeWAVEStoUSDN", nil, [AttachedPayment(WAVES, diffWAVES)]) |
---|
31 | 31 | | if ((r2 == r2)) |
---|
32 | 32 | | then { |
---|
33 | 33 | | let debt = fraction(loanAmount, (100 + loanFeePercent), 100) |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 5 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let loanFeePercent = (9 / 100) |
---|
5 | 5 | | |
---|
6 | 6 | | let USDN = base58'3KFXBGGLCjA5Z2DuW4Dq9fDDrHjJJP1ZEkaoajSzuKsC' |
---|
7 | 7 | | |
---|
8 | 8 | | let WAVES = base58'WAVES' |
---|
9 | 9 | | |
---|
10 | 10 | | let exchangerUSDNtoWavesAddress = Address(base58'3My9M3PdtDPdsvHwX4t1epYFJjhLDrQFP49') |
---|
11 | 11 | | |
---|
12 | 12 | | let exchangerWavesToUSDNAddress = Address(base58'3NAAEeRUgAj7D4pTPGR7n4yPCX2JGF3vUXm') |
---|
13 | 13 | | |
---|
14 | 14 | | let loanerAddress = Address(base58'3Mty9tvj2nMt3mudiJFGKqKh8Mai1o8oGCA') |
---|
15 | 15 | | |
---|
16 | 16 | | @Callable(i) |
---|
17 | 17 | | func trade (borrower) = { |
---|
18 | 18 | | let loanAmount = if ((i.payments[0].assetId == USDN)) |
---|
19 | 19 | | then i.payments[0].amount |
---|
20 | 20 | | else throw("Unexpected payment asset") |
---|
21 | 21 | | let startBalanceWAVES = assetBalance(this, WAVES) |
---|
22 | 22 | | if ((startBalanceWAVES == startBalanceWAVES)) |
---|
23 | 23 | | then { |
---|
24 | | - | let r1 = reentrantInvoke(exchangerUSDNtoWavesAddress, "exchangeUSDNtoWAVES", nil, [AttachedPayment(USDN, loanAmount)]) |
---|
| 24 | + | let r1 = invoke(exchangerUSDNtoWavesAddress, "exchangeUSDNtoWAVES", nil, [AttachedPayment(USDN, loanAmount)]) |
---|
25 | 25 | | if ((r1 == r1)) |
---|
26 | 26 | | then { |
---|
27 | 27 | | let diffWAVES = (assetBalance(this, WAVES) - startBalanceWAVES) |
---|
28 | 28 | | if ((diffWAVES == diffWAVES)) |
---|
29 | 29 | | then { |
---|
30 | | - | let r2 = reentrantInvoke(exchangerWavesToUSDNAddress, "exchangeWAVEStoUSDN", nil, [AttachedPayment(WAVES, diffWAVES)]) |
---|
| 30 | + | let r2 = invoke(exchangerWavesToUSDNAddress, "exchangeWAVEStoUSDN", nil, [AttachedPayment(WAVES, diffWAVES)]) |
---|
31 | 31 | | if ((r2 == r2)) |
---|
32 | 32 | | then { |
---|
33 | 33 | | let debt = fraction(loanAmount, (100 + loanFeePercent), 100) |
---|
34 | 34 | | let profit = (assetBalance(this, USDN) - debt) |
---|
35 | 35 | | [ScriptTransfer(Address(borrower), profit, USDN), ScriptTransfer(loanerAddress, debt, USDN)] |
---|
36 | 36 | | } |
---|
37 | 37 | | else throw("Strict value is not equal to itself.") |
---|
38 | 38 | | } |
---|
39 | 39 | | else throw("Strict value is not equal to itself.") |
---|
40 | 40 | | } |
---|
41 | 41 | | else throw("Strict value is not equal to itself.") |
---|
42 | 42 | | } |
---|
43 | 43 | | else throw("Strict value is not equal to itself.") |
---|
44 | 44 | | } |
---|
45 | 45 | | |
---|
46 | 46 | | |
---|