tx · 44X4jSLhfTQpCREh8xMZzGqZXf5FFUZX9UqGTNDMnXtP 3NBbFNBed9tcU5AmsJAuExWvgJyNmJxqjWq: -0.01000000 Waves 2023.09.10 00:02 [2748367] smart account 3NBbFNBed9tcU5AmsJAuExWvgJyNmJxqjWq > SELF 0.00000000 Waves
{ "type": 13, "id": "44X4jSLhfTQpCREh8xMZzGqZXf5FFUZX9UqGTNDMnXtP", "fee": 1000000, "feeAssetId": null, "timestamp": 1694293420922, "version": 2, "chainId": 84, "sender": "3NBbFNBed9tcU5AmsJAuExWvgJyNmJxqjWq", "senderPublicKey": "ERewvWFUFQfR1eCnipNAv9n7SdQhof2ESP6PGVjTueLd", "proofs": [ "3u913xrsSY8G7wZWzoH5BHiRpYMyp4XYxbh1KWq1sCSMuGU9hE92UXBLYJaDPj97ZuAVGSMLVuquqLbJEN46Wd9u" ], "script": "base64:BgIJCAISABIDCgEBBwAGdXNkbklkASAP8hwSrOTEPJrsRhqrJaiw7LoHK0bMbYhy8LXikkkBtAAOd2F2ZXMyTFRva2VuSWQBIOTNKeq7wReVNlE2S+RpfYhOUVOtu4YUhfwJjtl3b86xAAxwdXp6bGVMZW5kU0MCIzNOM0RuVmZmblV5WnR6Mk1SYms1VTdnaU4xMTJXZW1wTU5kABBmYWtlUHV6emxlU3dhcFNDAiMzTXM4ZnFiWE00UmhtTTZDUFRyNDRoVXdIZTJDQ21WQ2ZWQQAOdXNkbkFkZHJlc3NTdHICLDI1RkVxRWpSa3FLNnlDa2lUN0x6NlNBWXo3Z1VGQ3R4ZkNDaG5yVkZENUFUAA93YXZlczJMVG9rZW5TdHICLEdROVFOVkxHZllTYk5aNGRTOE5SeXZHR0VMWkw0c1dQS2lWajg4Q1YxckpMAQ10cnlHZXRJbnRlZ2VyAQNrZXkEByRtYXRjaDAJAJoIAgUEdGhpcwUDa2V5AwkAAQIFByRtYXRjaDACA0ludAQBYgUHJG1hdGNoMAUBYgAAAgFpAQltaW50TG9uZzIAAwMJAQIhPQIJA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CBlcXVhbCB0byBpdHNlbGYuAQJ0eAEGdmVyaWZ5AAkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleW/G2IM=", "height": 2748367, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 6eEPoDirfGq2crsDLiyhBf5Z2jAeNVNbZrvZtAhjARuD Next: GvKuhrEBbGn7DCmj1WbE3nbkHWkiyTjwpWpK2MYa8oPP Diff:
Old | New | Differences | |
---|---|---|---|
22 | 22 | ||
23 | 23 | ||
24 | 24 | @Callable(i) | |
25 | - | func mintLong2 () = { | |
26 | - | let firstAmountIn = i.payments[0].amount | |
27 | - | let callerId = toString(i.caller) | |
28 | - | let firstSwappedWavesAmount = invoke(addressFromStringValue(fakePuzzleSwapSC), "swapToWaves", [toString(i.caller), firstAmountIn], nil) | |
29 | - | if ((firstSwappedWavesAmount == firstSwappedWavesAmount)) | |
30 | - | then match firstSwappedWavesAmount { | |
31 | - | case firstSwappedAmountValue: Int => | |
32 | - | let firstDepositedWavesAmount = invoke(addressFromStringValue(puzzleLendSC), "supply", nil, [AttachedPayment(unit, firstSwappedAmountValue)]) | |
33 | - | if ((firstDepositedWavesAmount == firstDepositedWavesAmount)) | |
34 | - | then { | |
35 | - | let listPercentage = [70000, 49000, 34300, 24010, 16807] | |
36 | - | func repeatFunc (accum,next) = { | |
37 | - | let borrowedUsdn = invoke(addressFromStringValue(puzzleLendSC), "borrow", [usdnAddressStr, ((firstAmountIn * accum) / 100000)], nil) | |
38 | - | if ((borrowedUsdn == borrowedUsdn)) | |
39 | - | then { | |
40 | - | let swappedAmount = invoke(addressFromStringValue(fakePuzzleSwapSC), "swapToWaves", [toString(i.caller), ((firstSwappedAmountValue * accum) / 100000)], nil) | |
41 | - | if ((swappedAmount == swappedAmount)) | |
42 | - | then match swappedAmount { | |
43 | - | case swappedAmountValue: Int => | |
44 | - | let depositedWaves = invoke(addressFromStringValue(puzzleLendSC), "supply", nil, [AttachedPayment(unit, swappedAmountValue)]) | |
45 | - | if ((depositedWaves == depositedWaves)) | |
46 | - | then (((firstSwappedAmountValue * accum) / 100000) + ((firstSwappedAmountValue * next) / 100000)) | |
47 | - | else throw("Strict value is not equal to itself.") | |
48 | - | case _ => | |
49 | - | throw("Incorrect invoke result") | |
25 | + | func mintLong2 () = if (if ((size(i.payments) != 1)) | |
26 | + | then true | |
27 | + | else (i.payments[0].amount == 0)) | |
28 | + | then throw("1 payment has to be attached mint") | |
29 | + | else { | |
30 | + | let firstAmountIn = i.payments[0].amount | |
31 | + | let callerId = toString(i.caller) | |
32 | + | let firstSwappedWavesAmount = invoke(addressFromStringValue(fakePuzzleSwapSC), "swapToWaves", [toString(i.caller), firstAmountIn], nil) | |
33 | + | if ((firstSwappedWavesAmount == firstSwappedWavesAmount)) | |
34 | + | then match firstSwappedWavesAmount { | |
35 | + | case firstSwappedAmountValue: Int => | |
36 | + | let firstDepositedWavesAmount = invoke(addressFromStringValue(puzzleLendSC), "supply", nil, [AttachedPayment(unit, firstSwappedAmountValue)]) | |
37 | + | if ((firstDepositedWavesAmount == firstDepositedWavesAmount)) | |
38 | + | then { | |
39 | + | let listPercentage = [70000, 49000, 34300, 24010, 16807] | |
40 | + | func repeatFunc (accum,next) = { | |
41 | + | let borrowedUsdn = invoke(addressFromStringValue(puzzleLendSC), "borrow", [usdnAddressStr, ((firstAmountIn * accum) / 100000)], nil) | |
42 | + | if ((borrowedUsdn == borrowedUsdn)) | |
43 | + | then { | |
44 | + | let swappedAmount = invoke(addressFromStringValue(fakePuzzleSwapSC), "swapToWaves", [toString(i.caller), ((firstSwappedAmountValue * accum) / 100000)], nil) | |
45 | + | if ((swappedAmount == swappedAmount)) | |
46 | + | then match swappedAmount { | |
47 | + | case swappedAmountValue: Int => | |
48 | + | let depositedWaves = invoke(addressFromStringValue(puzzleLendSC), "supply", nil, [AttachedPayment(unit, swappedAmountValue)]) | |
49 | + | if ((depositedWaves == depositedWaves)) | |
50 | + | then (((firstSwappedAmountValue * accum) / 100000) + ((firstSwappedAmountValue * next) / 100000)) | |
51 | + | else throw("Strict value is not equal to itself.") | |
52 | + | case _ => | |
53 | + | throw("Incorrect invoke result") | |
54 | + | } | |
55 | + | else throw("Strict value is not equal to itself.") | |
50 | 56 | } | |
51 | - | else throw("Strict value is not equal to itself.") | |
52 | - | } | |
53 | - | else throw("Strict value is not equal to itself.") | |
57 | + | else throw("Strict value is not equal to itself.") | |
58 | + | } | |
59 | + | ||
60 | + | let res = { | |
61 | + | let $l = listPercentage | |
62 | + | let $s = size($l) | |
63 | + | let $acc0 = 0 | |
64 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
65 | + | then $a | |
66 | + | else repeatFunc($a, $l[$i]) | |
67 | + | ||
68 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
69 | + | then $a | |
70 | + | else throw("List size exceeds 5") | |
71 | + | ||
72 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
73 | + | } | |
74 | + | [ScriptTransfer(i.caller, res, waves2LTokenId)] | |
54 | 75 | } | |
55 | - | ||
56 | - | let res = { | |
57 | - | let $l = listPercentage | |
58 | - | let $s = size($l) | |
59 | - | let $acc0 = 0 | |
60 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
61 | - | then $a | |
62 | - | else repeatFunc($a, $l[$i]) | |
63 | - | ||
64 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
65 | - | then $a | |
66 | - | else throw("List size exceeds 5") | |
67 | - | ||
68 | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
69 | - | } | |
70 | - | [ScriptTransfer(i.caller, res, waves2LTokenId)] | |
71 | - | } | |
72 | - | else throw("Strict value is not equal to itself.") | |
73 | - | case _ => | |
74 | - | throw("Incorrect invoke result") | |
76 | + | else throw("Strict value is not equal to itself.") | |
77 | + | case _ => | |
78 | + | throw("Incorrect invoke result") | |
79 | + | } | |
80 | + | else throw("Strict value is not equal to itself.") | |
75 | 81 | } | |
76 | - | else throw("Strict value is not equal to itself.") | |
77 | - | } | |
78 | 82 | ||
79 | 83 | ||
80 | 84 |
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 | - | func mintLong2 () = { | |
26 | - | let firstAmountIn = i.payments[0].amount | |
27 | - | let callerId = toString(i.caller) | |
28 | - | let firstSwappedWavesAmount = invoke(addressFromStringValue(fakePuzzleSwapSC), "swapToWaves", [toString(i.caller), firstAmountIn], nil) | |
29 | - | if ((firstSwappedWavesAmount == firstSwappedWavesAmount)) | |
30 | - | then match firstSwappedWavesAmount { | |
31 | - | case firstSwappedAmountValue: Int => | |
32 | - | let firstDepositedWavesAmount = invoke(addressFromStringValue(puzzleLendSC), "supply", nil, [AttachedPayment(unit, firstSwappedAmountValue)]) | |
33 | - | if ((firstDepositedWavesAmount == firstDepositedWavesAmount)) | |
34 | - | then { | |
35 | - | let listPercentage = [70000, 49000, 34300, 24010, 16807] | |
36 | - | func repeatFunc (accum,next) = { | |
37 | - | let borrowedUsdn = invoke(addressFromStringValue(puzzleLendSC), "borrow", [usdnAddressStr, ((firstAmountIn * accum) / 100000)], nil) | |
38 | - | if ((borrowedUsdn == borrowedUsdn)) | |
39 | - | then { | |
40 | - | let swappedAmount = invoke(addressFromStringValue(fakePuzzleSwapSC), "swapToWaves", [toString(i.caller), ((firstSwappedAmountValue * accum) / 100000)], nil) | |
41 | - | if ((swappedAmount == swappedAmount)) | |
42 | - | then match swappedAmount { | |
43 | - | case swappedAmountValue: Int => | |
44 | - | let depositedWaves = invoke(addressFromStringValue(puzzleLendSC), "supply", nil, [AttachedPayment(unit, swappedAmountValue)]) | |
45 | - | if ((depositedWaves == depositedWaves)) | |
46 | - | then (((firstSwappedAmountValue * accum) / 100000) + ((firstSwappedAmountValue * next) / 100000)) | |
47 | - | else throw("Strict value is not equal to itself.") | |
48 | - | case _ => | |
49 | - | throw("Incorrect invoke result") | |
25 | + | func mintLong2 () = if (if ((size(i.payments) != 1)) | |
26 | + | then true | |
27 | + | else (i.payments[0].amount == 0)) | |
28 | + | then throw("1 payment has to be attached mint") | |
29 | + | else { | |
30 | + | let firstAmountIn = i.payments[0].amount | |
31 | + | let callerId = toString(i.caller) | |
32 | + | let firstSwappedWavesAmount = invoke(addressFromStringValue(fakePuzzleSwapSC), "swapToWaves", [toString(i.caller), firstAmountIn], nil) | |
33 | + | if ((firstSwappedWavesAmount == firstSwappedWavesAmount)) | |
34 | + | then match firstSwappedWavesAmount { | |
35 | + | case firstSwappedAmountValue: Int => | |
36 | + | let firstDepositedWavesAmount = invoke(addressFromStringValue(puzzleLendSC), "supply", nil, [AttachedPayment(unit, firstSwappedAmountValue)]) | |
37 | + | if ((firstDepositedWavesAmount == firstDepositedWavesAmount)) | |
38 | + | then { | |
39 | + | let listPercentage = [70000, 49000, 34300, 24010, 16807] | |
40 | + | func repeatFunc (accum,next) = { | |
41 | + | let borrowedUsdn = invoke(addressFromStringValue(puzzleLendSC), "borrow", [usdnAddressStr, ((firstAmountIn * accum) / 100000)], nil) | |
42 | + | if ((borrowedUsdn == borrowedUsdn)) | |
43 | + | then { | |
44 | + | let swappedAmount = invoke(addressFromStringValue(fakePuzzleSwapSC), "swapToWaves", [toString(i.caller), ((firstSwappedAmountValue * accum) / 100000)], nil) | |
45 | + | if ((swappedAmount == swappedAmount)) | |
46 | + | then match swappedAmount { | |
47 | + | case swappedAmountValue: Int => | |
48 | + | let depositedWaves = invoke(addressFromStringValue(puzzleLendSC), "supply", nil, [AttachedPayment(unit, swappedAmountValue)]) | |
49 | + | if ((depositedWaves == depositedWaves)) | |
50 | + | then (((firstSwappedAmountValue * accum) / 100000) + ((firstSwappedAmountValue * next) / 100000)) | |
51 | + | else throw("Strict value is not equal to itself.") | |
52 | + | case _ => | |
53 | + | throw("Incorrect invoke result") | |
54 | + | } | |
55 | + | else throw("Strict value is not equal to itself.") | |
50 | 56 | } | |
51 | - | else throw("Strict value is not equal to itself.") | |
52 | - | } | |
53 | - | else throw("Strict value is not equal to itself.") | |
57 | + | else throw("Strict value is not equal to itself.") | |
58 | + | } | |
59 | + | ||
60 | + | let res = { | |
61 | + | let $l = listPercentage | |
62 | + | let $s = size($l) | |
63 | + | let $acc0 = 0 | |
64 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
65 | + | then $a | |
66 | + | else repeatFunc($a, $l[$i]) | |
67 | + | ||
68 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
69 | + | then $a | |
70 | + | else throw("List size exceeds 5") | |
71 | + | ||
72 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
73 | + | } | |
74 | + | [ScriptTransfer(i.caller, res, waves2LTokenId)] | |
54 | 75 | } | |
55 | - | ||
56 | - | let res = { | |
57 | - | let $l = listPercentage | |
58 | - | let $s = size($l) | |
59 | - | let $acc0 = 0 | |
60 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
61 | - | then $a | |
62 | - | else repeatFunc($a, $l[$i]) | |
63 | - | ||
64 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
65 | - | then $a | |
66 | - | else throw("List size exceeds 5") | |
67 | - | ||
68 | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
69 | - | } | |
70 | - | [ScriptTransfer(i.caller, res, waves2LTokenId)] | |
71 | - | } | |
72 | - | else throw("Strict value is not equal to itself.") | |
73 | - | case _ => | |
74 | - | throw("Incorrect invoke result") | |
76 | + | else throw("Strict value is not equal to itself.") | |
77 | + | case _ => | |
78 | + | throw("Incorrect invoke result") | |
79 | + | } | |
80 | + | else throw("Strict value is not equal to itself.") | |
75 | 81 | } | |
76 | - | else throw("Strict value is not equal to itself.") | |
77 | - | } | |
78 | 82 | ||
79 | 83 | ||
80 | 84 | ||
81 | 85 | @Callable(i) | |
82 | 86 | func redeem (wavesAmount) = { | |
83 | 87 | let userAddress = toString(i.caller) | |
84 | 88 | let redeemedUSDNAmount = invoke(addressFromStringValue(fakePuzzleSwapSC), "swapToUSDN", [wavesAmount, userAddress], nil) | |
85 | 89 | if ((redeemedUSDNAmount == redeemedUSDNAmount)) | |
86 | 90 | then match redeemedUSDNAmount { | |
87 | 91 | case redeemedAmountValue: Int => | |
88 | 92 | [IntegerEntry((userAddress + "_redeemed"), redeemedAmountValue)] | |
89 | 93 | case _ => | |
90 | 94 | throw("Incorrect invoke result") | |
91 | 95 | } | |
92 | 96 | else throw("Strict value is not equal to itself.") | |
93 | 97 | } | |
94 | 98 | ||
95 | 99 | ||
96 | 100 | @Verifier(tx) | |
97 | 101 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
98 | 102 |
github/deemru/w8io/169f3d6 38.23 ms ◑