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