tx · B4tnRQ2TBWtppTtDbfCg3HgfYefbtgEKR9Ny13xra758 3NBbFNBed9tcU5AmsJAuExWvgJyNmJxqjWq: -0.01000000 Waves 2023.09.10 00:12 [2748377] smart account 3NBbFNBed9tcU5AmsJAuExWvgJyNmJxqjWq > SELF 0.00000000 Waves
{ "type": 13, "id": "B4tnRQ2TBWtppTtDbfCg3HgfYefbtgEKR9Ny13xra758", "fee": 1000000, "feeAssetId": null, "timestamp": 1694294029695, "version": 2, "chainId": 84, "sender": "3NBbFNBed9tcU5AmsJAuExWvgJyNmJxqjWq", "senderPublicKey": "ERewvWFUFQfR1eCnipNAv9n7SdQhof2ESP6PGVjTueLd", "proofs": [ "3BbDjdyg1c36ptV1NCAS7HsM7bdPT4o8vuRJ1Juw7xzA77EgEZtBSA1uZNQEcvFz7afZwNFBZ5cRFYLdgXdNxHkf" ], "script": "base64:BgILCAISABIAEgMKAQEHAAZ1c2RuSWQBIA/yHBKs5MQ8muxGGqslqLDsugcrRsxtiHLwteKSSQG0AA53YXZlczJMVG9rZW5JZAEg5M0p6rvBF5U2UTZL5Gl9iE5RU627hhSF/AmO2XdvzrEADHB1enpsZUxlbmRTQwIjM04zRG5WZmZuVXladHoyTVJiazVVN2dpTjExMldlbXBNTmQAEGZha2VQdXp6bGVTd2FwU0MCIzNNczhmcWJYTTRSaG1NNkNQVHI0NGhVd0hlMkNDbVZDZlZBAA51c2RuQWRkcmVzc1N0cgIsMjVGRXFFalJrcUs2eUNraVQ3THo2U0FZejdnVUZDdHhmQ0NobnJWRkQ1QVQAD3dhdmVzMkxUb2tlblN0cgIsR1E5UU5WTEdmWVNiTlo0ZFM4TlJ5dkdHRUxaTDRzV1BLaVZqODhDVjFySkwBDXRyeUdldEludGVnZXIBA2tleQQHJG1hdGNoMAkAmggCBQR0aGlzBQNrZXkDCQABAgUHJG1hdGNoMAIDSW50BAFiBQckbWF0Y2gwBQFiAAADAWkBCW1pbnRMb25nMgADAwkBAiE9AgkAkAMBCAUBaQhwY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CQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAQJ0eAEGdmVyaWZ5AAkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tledChFWs=", "height": 2748377, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GvKuhrEBbGn7DCmj1WbE3nbkHWkiyTjwpWpK2MYa8oPP Next: 9yLQ1vUKDFyZ9mPibbB1p45CRFnSUpY5m8Lb6rNabk3W Diff:
Old | New | Differences | |
---|---|---|---|
96 | 96 | case firstSwappedAmountValue: Int => | |
97 | 97 | let firstDepositedWavesAmount = invoke(addressFromStringValue(puzzleLendSC), "supply", nil, [AttachedPayment(unit, firstSwappedAmountValue)]) | |
98 | 98 | if ((firstDepositedWavesAmount == firstDepositedWavesAmount)) | |
99 | - | then nil | |
99 | + | then { | |
100 | + | let listPercentage = [70000, 49000, 34300, 24010, 16807] | |
101 | + | func repeatFunc (accum,next) = { | |
102 | + | let borrowedUsdn = invoke(addressFromStringValue(puzzleLendSC), "borrow", [usdnAddressStr, ((firstAmountIn * accum) / 100000)], nil) | |
103 | + | if ((borrowedUsdn == borrowedUsdn)) | |
104 | + | then { | |
105 | + | let swappedAmount = invoke(addressFromStringValue(fakePuzzleSwapSC), "swapToWaves", [toString(i.caller), ((firstSwappedAmountValue * accum) / 100000)], nil) | |
106 | + | if ((swappedAmount == swappedAmount)) | |
107 | + | then 100000000 | |
108 | + | else throw("Strict value is not equal to itself.") | |
109 | + | } | |
110 | + | else throw("Strict value is not equal to itself.") | |
111 | + | } | |
112 | + | ||
113 | + | let res = { | |
114 | + | let $l = listPercentage | |
115 | + | let $s = size($l) | |
116 | + | let $acc0 = 0 | |
117 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
118 | + | then $a | |
119 | + | else repeatFunc($a, $l[$i]) | |
120 | + | ||
121 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
122 | + | then $a | |
123 | + | else throw("List size exceeds 5") | |
124 | + | ||
125 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
126 | + | } | |
127 | + | [ScriptTransfer(i.caller, res, waves2LTokenId)] | |
128 | + | } | |
100 | 129 | else throw("Strict value is not equal to itself.") | |
101 | 130 | case _ => | |
102 | 131 | throw("Incorrect invoke result") |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let usdnId = base58'25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT' | |
5 | 5 | ||
6 | 6 | let waves2LTokenId = base58'GQ9QNVLGfYSbNZ4dS8NRyvGGELZL4sWPKiVj88CV1rJL' | |
7 | 7 | ||
8 | 8 | let puzzleLendSC = "3N3DnVffnUyZtz2MRbk5U7giN112WempMNd" | |
9 | 9 | ||
10 | 10 | let fakePuzzleSwapSC = "3Ms8fqbXM4RhmM6CPTr44hUwHe2CCmVCfVA" | |
11 | 11 | ||
12 | 12 | let usdnAddressStr = "25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT" | |
13 | 13 | ||
14 | 14 | let waves2LTokenStr = "GQ9QNVLGfYSbNZ4dS8NRyvGGELZL4sWPKiVj88CV1rJL" | |
15 | 15 | ||
16 | 16 | func tryGetInteger (key) = match getInteger(this, key) { | |
17 | 17 | case b: Int => | |
18 | 18 | b | |
19 | 19 | case _ => | |
20 | 20 | 0 | |
21 | 21 | } | |
22 | 22 | ||
23 | 23 | ||
24 | 24 | @Callable(i) | |
25 | 25 | func mintLong2 () = if (if ((size(i.payments) != 1)) | |
26 | 26 | then true | |
27 | 27 | else (i.payments[0].amount == 0)) | |
28 | 28 | then throw("1 payment has to be attached mint") | |
29 | 29 | else { | |
30 | 30 | let firstAmountIn = i.payments[0].amount | |
31 | 31 | let callerId = toString(i.caller) | |
32 | 32 | let firstSwappedWavesAmount = invoke(addressFromStringValue(fakePuzzleSwapSC), "swapToWaves", [toString(i.caller), firstAmountIn], nil) | |
33 | 33 | if ((firstSwappedWavesAmount == firstSwappedWavesAmount)) | |
34 | 34 | then match firstSwappedWavesAmount { | |
35 | 35 | case firstSwappedAmountValue: Int => | |
36 | 36 | let firstDepositedWavesAmount = invoke(addressFromStringValue(puzzleLendSC), "supply", nil, [AttachedPayment(unit, firstSwappedAmountValue)]) | |
37 | 37 | if ((firstDepositedWavesAmount == firstDepositedWavesAmount)) | |
38 | 38 | then { | |
39 | 39 | let listPercentage = [70000, 49000, 34300, 24010, 16807] | |
40 | 40 | func repeatFunc (accum,next) = { | |
41 | 41 | let borrowedUsdn = invoke(addressFromStringValue(puzzleLendSC), "borrow", [usdnAddressStr, ((firstAmountIn * accum) / 100000)], nil) | |
42 | 42 | if ((borrowedUsdn == borrowedUsdn)) | |
43 | 43 | then { | |
44 | 44 | let swappedAmount = invoke(addressFromStringValue(fakePuzzleSwapSC), "swapToWaves", [toString(i.caller), ((firstSwappedAmountValue * accum) / 100000)], nil) | |
45 | 45 | if ((swappedAmount == swappedAmount)) | |
46 | 46 | then match swappedAmount { | |
47 | 47 | case swappedAmountValue: Int => | |
48 | 48 | let depositedWaves = invoke(addressFromStringValue(puzzleLendSC), "supply", nil, [AttachedPayment(unit, swappedAmountValue)]) | |
49 | 49 | if ((depositedWaves == depositedWaves)) | |
50 | 50 | then (((firstSwappedAmountValue * accum) / 100000) + ((firstSwappedAmountValue * next) / 100000)) | |
51 | 51 | else throw("Strict value is not equal to itself.") | |
52 | 52 | case _ => | |
53 | 53 | throw("Incorrect invoke result") | |
54 | 54 | } | |
55 | 55 | else throw("Strict value is not equal to itself.") | |
56 | 56 | } | |
57 | 57 | else throw("Strict value is not equal to itself.") | |
58 | 58 | } | |
59 | 59 | ||
60 | 60 | let res = { | |
61 | 61 | let $l = listPercentage | |
62 | 62 | let $s = size($l) | |
63 | 63 | let $acc0 = 0 | |
64 | 64 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
65 | 65 | then $a | |
66 | 66 | else repeatFunc($a, $l[$i]) | |
67 | 67 | ||
68 | 68 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
69 | 69 | then $a | |
70 | 70 | else throw("List size exceeds 5") | |
71 | 71 | ||
72 | 72 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
73 | 73 | } | |
74 | 74 | [ScriptTransfer(i.caller, res, waves2LTokenId)] | |
75 | 75 | } | |
76 | 76 | else throw("Strict value is not equal to itself.") | |
77 | 77 | case _ => | |
78 | 78 | throw("Incorrect invoke result") | |
79 | 79 | } | |
80 | 80 | else throw("Strict value is not equal to itself.") | |
81 | 81 | } | |
82 | 82 | ||
83 | 83 | ||
84 | 84 | ||
85 | 85 | @Callable(i) | |
86 | 86 | func mintLong2_test () = if (if ((size(i.payments) != 1)) | |
87 | 87 | then true | |
88 | 88 | else (i.payments[0].amount == 0)) | |
89 | 89 | then throw("1 payment has to be attached mint") | |
90 | 90 | else { | |
91 | 91 | let firstAmountIn = i.payments[0].amount | |
92 | 92 | let callerId = toString(i.caller) | |
93 | 93 | let firstSwappedWavesAmount = invoke(addressFromStringValue(fakePuzzleSwapSC), "swapToWaves", [toString(i.caller), firstAmountIn], nil) | |
94 | 94 | if ((firstSwappedWavesAmount == firstSwappedWavesAmount)) | |
95 | 95 | then match firstSwappedWavesAmount { | |
96 | 96 | case firstSwappedAmountValue: Int => | |
97 | 97 | let firstDepositedWavesAmount = invoke(addressFromStringValue(puzzleLendSC), "supply", nil, [AttachedPayment(unit, firstSwappedAmountValue)]) | |
98 | 98 | if ((firstDepositedWavesAmount == firstDepositedWavesAmount)) | |
99 | - | then nil | |
99 | + | then { | |
100 | + | let listPercentage = [70000, 49000, 34300, 24010, 16807] | |
101 | + | func repeatFunc (accum,next) = { | |
102 | + | let borrowedUsdn = invoke(addressFromStringValue(puzzleLendSC), "borrow", [usdnAddressStr, ((firstAmountIn * accum) / 100000)], nil) | |
103 | + | if ((borrowedUsdn == borrowedUsdn)) | |
104 | + | then { | |
105 | + | let swappedAmount = invoke(addressFromStringValue(fakePuzzleSwapSC), "swapToWaves", [toString(i.caller), ((firstSwappedAmountValue * accum) / 100000)], nil) | |
106 | + | if ((swappedAmount == swappedAmount)) | |
107 | + | then 100000000 | |
108 | + | else throw("Strict value is not equal to itself.") | |
109 | + | } | |
110 | + | else throw("Strict value is not equal to itself.") | |
111 | + | } | |
112 | + | ||
113 | + | let res = { | |
114 | + | let $l = listPercentage | |
115 | + | let $s = size($l) | |
116 | + | let $acc0 = 0 | |
117 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
118 | + | then $a | |
119 | + | else repeatFunc($a, $l[$i]) | |
120 | + | ||
121 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
122 | + | then $a | |
123 | + | else throw("List size exceeds 5") | |
124 | + | ||
125 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
126 | + | } | |
127 | + | [ScriptTransfer(i.caller, res, waves2LTokenId)] | |
128 | + | } | |
100 | 129 | else throw("Strict value is not equal to itself.") | |
101 | 130 | case _ => | |
102 | 131 | throw("Incorrect invoke result") | |
103 | 132 | } | |
104 | 133 | else throw("Strict value is not equal to itself.") | |
105 | 134 | } | |
106 | 135 | ||
107 | 136 | ||
108 | 137 | ||
109 | 138 | @Callable(i) | |
110 | 139 | func redeem (wavesAmount) = { | |
111 | 140 | let userAddress = toString(i.caller) | |
112 | 141 | let redeemedUSDNAmount = invoke(addressFromStringValue(fakePuzzleSwapSC), "swapToUSDN", [wavesAmount, userAddress], nil) | |
113 | 142 | if ((redeemedUSDNAmount == redeemedUSDNAmount)) | |
114 | 143 | then match redeemedUSDNAmount { | |
115 | 144 | case redeemedAmountValue: Int => | |
116 | 145 | [IntegerEntry((userAddress + "_redeemed"), redeemedAmountValue)] | |
117 | 146 | case _ => | |
118 | 147 | throw("Incorrect invoke result") | |
119 | 148 | } | |
120 | 149 | else throw("Strict value is not equal to itself.") | |
121 | 150 | } | |
122 | 151 | ||
123 | 152 | ||
124 | 153 | @Verifier(tx) | |
125 | 154 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
126 | 155 |
github/deemru/w8io/fabc49c 43.24 ms ◑