tx · s29KDqgCQT4zQAC4ZjHDqppWfiMyLLjZkRfgc3mGucP 3N61Cvq5XcnPk9rxpy2Rnp3bSr4syNGUJph: -0.01400000 Waves 2021.11.07 22:13 [1780999] smart account 3N61Cvq5XcnPk9rxpy2Rnp3bSr4syNGUJph > SELF 0.00000000 Waves
{ "type": 13, "id": "s29KDqgCQT4zQAC4ZjHDqppWfiMyLLjZkRfgc3mGucP", "fee": 1400000, "feeAssetId": null, "timestamp": 1636312425668, "version": 2, "chainId": 84, "sender": "3N61Cvq5XcnPk9rxpy2Rnp3bSr4syNGUJph", "senderPublicKey": "G7cNXePvAHUHmZfXa1eHnvFeH6DuykPC5wm9v9djTKgD", "proofs": [ "3C37yM1WNN7SSv4jP9Y5e9SoymDxMfPnepa4fdUVYb3MMGHGJoUcEQW29ao66jVJAejdhU8nMgVSeTAqBos5V3gH" ], "script": "base64:AAIFAAAAAAAAACEIAhIAEgYKBBgYGBESBgoECAgBARIAEgMKAQgSBAoCCAEAAAAGAAAAAApkZXBvc2l0RmVlAAAAAAAAAAPoAAAAAA1jb250cm9sbGVyRmVlAAAAAAAAACcQAAAAAAtwbGF0Zm9ybUZlZQAAAAAAAAAnEAAAAAAMYWRtaW5QdWJLZXkxAQAAACDgkMh3M2mpU305XK7y5b9J+9C9m7ycRhB7Y2h8D+QzGgAAAAAMYWRtaW5QdWJLZXkyAQAAACDgkMh3M2mpU305XK7y5b9J+9C9m7ycRhB7Y2h8D+QzGgAAAAAMYWRtaW5QdWJLZXkzAQAAACDgkMh3M2mpU305XK7y5b9J+9C9m7ycRhB7Y2h8D+QzGgAAAAYAAAACYTgBAAAABGluaXQAAAAACQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACAgAAADEzUFBIN3g3aXFvYlc1eml5aVJDaWMxOXJRcUtyNm5QWWFLMV9hc3NldF9iYWxhbmNlAAAAAAAAbdStBQAAAANuaWwAAAABaQEAAAAIYWRkUG9vbHMAAAAEAAAABXBvb2xzAAAAD2xpcX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nZXJFbnRyeQAAAAIFAAAAEXVzZXJQb29sQW1vdW50S2V5BQAAABFuZXdVc2VyUG9vbEFtb3VudAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgUAAAARdXNlclBvb2xFYXJuZWRLZXkFAAAAD3VzZXJFYXJuZWRUb3RhbAUAAAADbmlsCQAAAgAAAAECAAAAJllvdSBoYXZlIG5vdCBzdWNoIGJhbGFuY2UgZm9yIHdpdGhkcmF3AAAAAQAAAAJiNgEAAAACYjcAAAAACQAB9AAAAAMIBQAAAAJiNgAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAmI2AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAmI2AAAAD3NlbmRlclB1YmxpY0tlebt1vLE=", "height": 1780999, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8SmbJrz5LnovNbwHYWWhYqYoD7xpbueH2vg83GHXRsS1 Next: 3e9t4msHvrXRpz7AuNWH3RhouAMEKHZw6Q6fw2sr2t9h Diff:
Old | New | Differences | |
---|---|---|---|
19 | 19 | ||
20 | 20 | ||
21 | 21 | @Callable(i) | |
22 | - | func addPools (pools,liquidityTokens,serviceTokens,liquidityTokenDecimals) = { | |
23 | - | func generatePoolKeys (accumulated,pool) = IntegerEntry((pool + "_asset_balance"), 0) :: accumulated | |
22 | + | func addPools (pools,liquidityTokens,serviceTokens,liquidityTokenDecimals) = if (containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey)) | |
23 | + | then { | |
24 | + | func generatePoolKeys (accumulated,pool) = IntegerEntry((pool + "_asset_balance"), 0) :: accumulated | |
24 | 25 | ||
25 | - | func generatePoolLiquidityTokenKeys (accumulated,pool) = { | |
26 | - | let poolIndex = value(indexOf(pools, pool)) | |
27 | - | let liquidityToken = liquidityTokens[poolIndex] | |
26 | + | func generatePoolLiquidityTokenKeys (accumulated,pool) = { | |
27 | + | let poolIndex = value(indexOf(pools, pool)) | |
28 | + | let liquidityToken = liquidityTokens[poolIndex] | |
28 | 29 | StringEntry((pool + "_liquidity_token"), liquidityToken) :: accumulated | |
30 | + | } | |
31 | + | ||
32 | + | func generatePoolServiceTokenKeys (accumulated,pool) = { | |
33 | + | let poolIndex = value(indexOf(pools, pool)) | |
34 | + | let liquidityToken = serviceTokens[poolIndex] | |
35 | + | StringEntry((pool + "_service_token"), liquidityToken) :: accumulated | |
36 | + | } | |
37 | + | ||
38 | + | func generatePoolLiquidityTokenDecimalKeys (accumulated,pool) = { | |
39 | + | let poolIndex = value(indexOf(pools, pool)) | |
40 | + | let liquidityToken = liquidityTokenDecimals[poolIndex] | |
41 | + | IntegerEntry((pool + "_service_token"), liquidityToken) :: accumulated | |
42 | + | } | |
43 | + | ||
44 | + | func generatePoolActiveKeys (accumulated,pool) = BooleanEntry((pool + "_active"), true) :: accumulated | |
45 | + | ||
46 | + | let poolBalanceKeys = { | |
47 | + | let $l = pools | |
48 | + | let $s = size($l) | |
49 | + | let $acc0 = nil | |
50 | + | func 1 ($a,$i) = if (($i >= $s)) | |
51 | + | then $a | |
52 | + | else generatePoolKeys($a, $l[$i]) | |
53 | + | ||
54 | + | func 2 ($a,$i) = if (($i >= $s)) | |
55 | + | then $a | |
56 | + | else throw("List size exceeds 20") | |
57 | + | ||
58 | + | 2(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
59 | + | } | |
60 | + | let poolLiquidityTokenKeys = { | |
61 | + | let $l = pools | |
62 | + | let $s = size($l) | |
63 | + | let $acc0 = nil | |
64 | + | func 1 ($a,$i) = if (($i >= $s)) | |
65 | + | then $a | |
66 | + | else generatePoolLiquidityTokenKeys($a, $l[$i]) | |
67 | + | ||
68 | + | func 2 ($a,$i) = if (($i >= $s)) | |
69 | + | then $a | |
70 | + | else throw("List size exceeds 20") | |
71 | + | ||
72 | + | 2(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
73 | + | } | |
74 | + | let poolServiceTokenKeys = { | |
75 | + | let $l = pools | |
76 | + | let $s = size($l) | |
77 | + | let $acc0 = nil | |
78 | + | func 1 ($a,$i) = if (($i >= $s)) | |
79 | + | then $a | |
80 | + | else generatePoolServiceTokenKeys($a, $l[$i]) | |
81 | + | ||
82 | + | func 2 ($a,$i) = if (($i >= $s)) | |
83 | + | then $a | |
84 | + | else throw("List size exceeds 20") | |
85 | + | ||
86 | + | 2(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
87 | + | } | |
88 | + | let poolLiquidityTokenDecimalKeys = { | |
89 | + | let $l = pools | |
90 | + | let $s = size($l) | |
91 | + | let $acc0 = nil | |
92 | + | func 1 ($a,$i) = if (($i >= $s)) | |
93 | + | then $a | |
94 | + | else generatePoolLiquidityTokenDecimalKeys($a, $l[$i]) | |
95 | + | ||
96 | + | func 2 ($a,$i) = if (($i >= $s)) | |
97 | + | then $a | |
98 | + | else throw("List size exceeds 20") | |
99 | + | ||
100 | + | 2(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
101 | + | } | |
102 | + | let poolActiveKeys = { | |
103 | + | let $l = pools | |
104 | + | let $s = size($l) | |
105 | + | let $acc0 = nil | |
106 | + | func 1 ($a,$i) = if (($i >= $s)) | |
107 | + | then $a | |
108 | + | else generatePoolActiveKeys($a, $l[$i]) | |
109 | + | ||
110 | + | func 2 ($a,$i) = if (($i >= $s)) | |
111 | + | then $a | |
112 | + | else throw("List size exceeds 20") | |
113 | + | ||
114 | + | 2(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
115 | + | } | |
116 | + | ((((poolBalanceKeys ++ poolLiquidityTokenKeys) ++ poolServiceTokenKeys) ++ poolLiquidityTokenDecimalKeys) ++ poolActiveKeys) | |
29 | 117 | } | |
30 | - | ||
31 | - | func generatePoolServiceTokenKeys (accumulated,pool) = { | |
32 | - | let poolIndex = value(indexOf(pools, pool)) | |
33 | - | let liquidityToken = serviceTokens[poolIndex] | |
34 | - | StringEntry((pool + "_service_token"), liquidityToken) :: accumulated | |
35 | - | } | |
36 | - | ||
37 | - | func generatePoolLiquidityTokenDecimalKeys (accumulated,pool) = { | |
38 | - | let poolIndex = value(indexOf(pools, pool)) | |
39 | - | let liquidityToken = liquidityTokenDecimals[poolIndex] | |
40 | - | IntegerEntry((pool + "_service_token"), liquidityToken) :: accumulated | |
41 | - | } | |
42 | - | ||
43 | - | func generatePoolActiveKeys (accumulated,pool) = BooleanEntry((pool + "_active"), true) :: accumulated | |
44 | - | ||
45 | - | let poolBalanceKeys = { | |
46 | - | let $l = pools | |
47 | - | let $s = size($l) | |
48 | - | let $acc0 = nil | |
49 | - | func 1 ($a,$i) = if (($i >= $s)) | |
50 | - | then $a | |
51 | - | else generatePoolKeys($a, $l[$i]) | |
52 | - | ||
53 | - | func 2 ($a,$i) = if (($i >= $s)) | |
54 | - | then $a | |
55 | - | else throw("List size exceeds 20") | |
56 | - | ||
57 | - | 2(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
58 | - | } | |
59 | - | let poolLiquidityTokenKeys = { | |
60 | - | let $l = pools | |
61 | - | let $s = size($l) | |
62 | - | let $acc0 = nil | |
63 | - | func 1 ($a,$i) = if (($i >= $s)) | |
64 | - | then $a | |
65 | - | else generatePoolLiquidityTokenKeys($a, $l[$i]) | |
66 | - | ||
67 | - | func 2 ($a,$i) = if (($i >= $s)) | |
68 | - | then $a | |
69 | - | else throw("List size exceeds 20") | |
70 | - | ||
71 | - | 2(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
72 | - | } | |
73 | - | let poolServiceTokenKeys = { | |
74 | - | let $l = pools | |
75 | - | let $s = size($l) | |
76 | - | let $acc0 = nil | |
77 | - | func 1 ($a,$i) = if (($i >= $s)) | |
78 | - | then $a | |
79 | - | else generatePoolServiceTokenKeys($a, $l[$i]) | |
80 | - | ||
81 | - | func 2 ($a,$i) = if (($i >= $s)) | |
82 | - | then $a | |
83 | - | else throw("List size exceeds 20") | |
84 | - | ||
85 | - | 2(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
86 | - | } | |
87 | - | let poolLiquidityTokenDecimalKeys = { | |
88 | - | let $l = pools | |
89 | - | let $s = size($l) | |
90 | - | let $acc0 = nil | |
91 | - | func 1 ($a,$i) = if (($i >= $s)) | |
92 | - | then $a | |
93 | - | else generatePoolLiquidityTokenDecimalKeys($a, $l[$i]) | |
94 | - | ||
95 | - | func 2 ($a,$i) = if (($i >= $s)) | |
96 | - | then $a | |
97 | - | else throw("List size exceeds 20") | |
98 | - | ||
99 | - | 2(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
100 | - | } | |
101 | - | let poolActiveKeys = { | |
102 | - | let $l = pools | |
103 | - | let $s = size($l) | |
104 | - | let $acc0 = nil | |
105 | - | func 1 ($a,$i) = if (($i >= $s)) | |
106 | - | then $a | |
107 | - | else generatePoolActiveKeys($a, $l[$i]) | |
108 | - | ||
109 | - | func 2 ($a,$i) = if (($i >= $s)) | |
110 | - | then $a | |
111 | - | else throw("List size exceeds 20") | |
112 | - | ||
113 | - | 2(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
114 | - | } | |
115 | - | ((((poolBalanceKeys ++ poolLiquidityTokenKeys) ++ poolServiceTokenKeys) ++ poolLiquidityTokenDecimalKeys) ++ poolActiveKeys) | |
116 | - | } | |
118 | + | else throw("Only admin can call this function") | |
117 | 119 | ||
118 | 120 | ||
119 | 121 | ||
140 | 142 | let poolAmountKey = (pool + "_asset_balance") | |
141 | 143 | let userAddress = toString(i.caller) | |
142 | 144 | let userPoolAmountKey = (((pool + "_") + userAddress) + "_asset_balance") | |
143 | - | let dAppAssetAddress = getStringValue(this, (pool + "_service_token")) | |
145 | + | let dAppAssetAddress = match getString((pool + "_service_token")) { | |
146 | + | case string: String => | |
147 | + | string | |
148 | + | case nothing => | |
149 | + | throw("You try to exchange on unsupported pool") | |
150 | + | } | |
144 | 151 | let poolAmount = getIntegerValue(this, poolAmountKey) | |
145 | 152 | let userAmount = match getInteger(userPoolAmountKey) { | |
146 | 153 | case int: Int => |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let depositFee = 1000 | |
5 | 5 | ||
6 | 6 | let controllerFee = 10000 | |
7 | 7 | ||
8 | 8 | let platformFee = 10000 | |
9 | 9 | ||
10 | 10 | let adminPubKey1 = base58'G7cNXePvAHUHmZfXa1eHnvFeH6DuykPC5wm9v9djTKgD' | |
11 | 11 | ||
12 | 12 | let adminPubKey2 = base58'G7cNXePvAHUHmZfXa1eHnvFeH6DuykPC5wm9v9djTKgD' | |
13 | 13 | ||
14 | 14 | let adminPubKey3 = base58'G7cNXePvAHUHmZfXa1eHnvFeH6DuykPC5wm9v9djTKgD' | |
15 | 15 | ||
16 | 16 | @Callable(a8) | |
17 | 17 | func init () = [IntegerEntry("3PPH7x7iqobW5ziyiRCic19rQqKr6nPYaK1_asset_balance", 7197869)] | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | ||
21 | 21 | @Callable(i) | |
22 | - | func addPools (pools,liquidityTokens,serviceTokens,liquidityTokenDecimals) = { | |
23 | - | func generatePoolKeys (accumulated,pool) = IntegerEntry((pool + "_asset_balance"), 0) :: accumulated | |
22 | + | func addPools (pools,liquidityTokens,serviceTokens,liquidityTokenDecimals) = if (containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey)) | |
23 | + | then { | |
24 | + | func generatePoolKeys (accumulated,pool) = IntegerEntry((pool + "_asset_balance"), 0) :: accumulated | |
24 | 25 | ||
25 | - | func generatePoolLiquidityTokenKeys (accumulated,pool) = { | |
26 | - | let poolIndex = value(indexOf(pools, pool)) | |
27 | - | let liquidityToken = liquidityTokens[poolIndex] | |
26 | + | func generatePoolLiquidityTokenKeys (accumulated,pool) = { | |
27 | + | let poolIndex = value(indexOf(pools, pool)) | |
28 | + | let liquidityToken = liquidityTokens[poolIndex] | |
28 | 29 | StringEntry((pool + "_liquidity_token"), liquidityToken) :: accumulated | |
30 | + | } | |
31 | + | ||
32 | + | func generatePoolServiceTokenKeys (accumulated,pool) = { | |
33 | + | let poolIndex = value(indexOf(pools, pool)) | |
34 | + | let liquidityToken = serviceTokens[poolIndex] | |
35 | + | StringEntry((pool + "_service_token"), liquidityToken) :: accumulated | |
36 | + | } | |
37 | + | ||
38 | + | func generatePoolLiquidityTokenDecimalKeys (accumulated,pool) = { | |
39 | + | let poolIndex = value(indexOf(pools, pool)) | |
40 | + | let liquidityToken = liquidityTokenDecimals[poolIndex] | |
41 | + | IntegerEntry((pool + "_service_token"), liquidityToken) :: accumulated | |
42 | + | } | |
43 | + | ||
44 | + | func generatePoolActiveKeys (accumulated,pool) = BooleanEntry((pool + "_active"), true) :: accumulated | |
45 | + | ||
46 | + | let poolBalanceKeys = { | |
47 | + | let $l = pools | |
48 | + | let $s = size($l) | |
49 | + | let $acc0 = nil | |
50 | + | func 1 ($a,$i) = if (($i >= $s)) | |
51 | + | then $a | |
52 | + | else generatePoolKeys($a, $l[$i]) | |
53 | + | ||
54 | + | func 2 ($a,$i) = if (($i >= $s)) | |
55 | + | then $a | |
56 | + | else throw("List size exceeds 20") | |
57 | + | ||
58 | + | 2(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
59 | + | } | |
60 | + | let poolLiquidityTokenKeys = { | |
61 | + | let $l = pools | |
62 | + | let $s = size($l) | |
63 | + | let $acc0 = nil | |
64 | + | func 1 ($a,$i) = if (($i >= $s)) | |
65 | + | then $a | |
66 | + | else generatePoolLiquidityTokenKeys($a, $l[$i]) | |
67 | + | ||
68 | + | func 2 ($a,$i) = if (($i >= $s)) | |
69 | + | then $a | |
70 | + | else throw("List size exceeds 20") | |
71 | + | ||
72 | + | 2(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
73 | + | } | |
74 | + | let poolServiceTokenKeys = { | |
75 | + | let $l = pools | |
76 | + | let $s = size($l) | |
77 | + | let $acc0 = nil | |
78 | + | func 1 ($a,$i) = if (($i >= $s)) | |
79 | + | then $a | |
80 | + | else generatePoolServiceTokenKeys($a, $l[$i]) | |
81 | + | ||
82 | + | func 2 ($a,$i) = if (($i >= $s)) | |
83 | + | then $a | |
84 | + | else throw("List size exceeds 20") | |
85 | + | ||
86 | + | 2(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
87 | + | } | |
88 | + | let poolLiquidityTokenDecimalKeys = { | |
89 | + | let $l = pools | |
90 | + | let $s = size($l) | |
91 | + | let $acc0 = nil | |
92 | + | func 1 ($a,$i) = if (($i >= $s)) | |
93 | + | then $a | |
94 | + | else generatePoolLiquidityTokenDecimalKeys($a, $l[$i]) | |
95 | + | ||
96 | + | func 2 ($a,$i) = if (($i >= $s)) | |
97 | + | then $a | |
98 | + | else throw("List size exceeds 20") | |
99 | + | ||
100 | + | 2(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
101 | + | } | |
102 | + | let poolActiveKeys = { | |
103 | + | let $l = pools | |
104 | + | let $s = size($l) | |
105 | + | let $acc0 = nil | |
106 | + | func 1 ($a,$i) = if (($i >= $s)) | |
107 | + | then $a | |
108 | + | else generatePoolActiveKeys($a, $l[$i]) | |
109 | + | ||
110 | + | func 2 ($a,$i) = if (($i >= $s)) | |
111 | + | then $a | |
112 | + | else throw("List size exceeds 20") | |
113 | + | ||
114 | + | 2(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
115 | + | } | |
116 | + | ((((poolBalanceKeys ++ poolLiquidityTokenKeys) ++ poolServiceTokenKeys) ++ poolLiquidityTokenDecimalKeys) ++ poolActiveKeys) | |
29 | 117 | } | |
30 | - | ||
31 | - | func generatePoolServiceTokenKeys (accumulated,pool) = { | |
32 | - | let poolIndex = value(indexOf(pools, pool)) | |
33 | - | let liquidityToken = serviceTokens[poolIndex] | |
34 | - | StringEntry((pool + "_service_token"), liquidityToken) :: accumulated | |
35 | - | } | |
36 | - | ||
37 | - | func generatePoolLiquidityTokenDecimalKeys (accumulated,pool) = { | |
38 | - | let poolIndex = value(indexOf(pools, pool)) | |
39 | - | let liquidityToken = liquidityTokenDecimals[poolIndex] | |
40 | - | IntegerEntry((pool + "_service_token"), liquidityToken) :: accumulated | |
41 | - | } | |
42 | - | ||
43 | - | func generatePoolActiveKeys (accumulated,pool) = BooleanEntry((pool + "_active"), true) :: accumulated | |
44 | - | ||
45 | - | let poolBalanceKeys = { | |
46 | - | let $l = pools | |
47 | - | let $s = size($l) | |
48 | - | let $acc0 = nil | |
49 | - | func 1 ($a,$i) = if (($i >= $s)) | |
50 | - | then $a | |
51 | - | else generatePoolKeys($a, $l[$i]) | |
52 | - | ||
53 | - | func 2 ($a,$i) = if (($i >= $s)) | |
54 | - | then $a | |
55 | - | else throw("List size exceeds 20") | |
56 | - | ||
57 | - | 2(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
58 | - | } | |
59 | - | let poolLiquidityTokenKeys = { | |
60 | - | let $l = pools | |
61 | - | let $s = size($l) | |
62 | - | let $acc0 = nil | |
63 | - | func 1 ($a,$i) = if (($i >= $s)) | |
64 | - | then $a | |
65 | - | else generatePoolLiquidityTokenKeys($a, $l[$i]) | |
66 | - | ||
67 | - | func 2 ($a,$i) = if (($i >= $s)) | |
68 | - | then $a | |
69 | - | else throw("List size exceeds 20") | |
70 | - | ||
71 | - | 2(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
72 | - | } | |
73 | - | let poolServiceTokenKeys = { | |
74 | - | let $l = pools | |
75 | - | let $s = size($l) | |
76 | - | let $acc0 = nil | |
77 | - | func 1 ($a,$i) = if (($i >= $s)) | |
78 | - | then $a | |
79 | - | else generatePoolServiceTokenKeys($a, $l[$i]) | |
80 | - | ||
81 | - | func 2 ($a,$i) = if (($i >= $s)) | |
82 | - | then $a | |
83 | - | else throw("List size exceeds 20") | |
84 | - | ||
85 | - | 2(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
86 | - | } | |
87 | - | let poolLiquidityTokenDecimalKeys = { | |
88 | - | let $l = pools | |
89 | - | let $s = size($l) | |
90 | - | let $acc0 = nil | |
91 | - | func 1 ($a,$i) = if (($i >= $s)) | |
92 | - | then $a | |
93 | - | else generatePoolLiquidityTokenDecimalKeys($a, $l[$i]) | |
94 | - | ||
95 | - | func 2 ($a,$i) = if (($i >= $s)) | |
96 | - | then $a | |
97 | - | else throw("List size exceeds 20") | |
98 | - | ||
99 | - | 2(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
100 | - | } | |
101 | - | let poolActiveKeys = { | |
102 | - | let $l = pools | |
103 | - | let $s = size($l) | |
104 | - | let $acc0 = nil | |
105 | - | func 1 ($a,$i) = if (($i >= $s)) | |
106 | - | then $a | |
107 | - | else generatePoolActiveKeys($a, $l[$i]) | |
108 | - | ||
109 | - | func 2 ($a,$i) = if (($i >= $s)) | |
110 | - | then $a | |
111 | - | else throw("List size exceeds 20") | |
112 | - | ||
113 | - | 2(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1(1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
114 | - | } | |
115 | - | ((((poolBalanceKeys ++ poolLiquidityTokenKeys) ++ poolServiceTokenKeys) ++ poolLiquidityTokenDecimalKeys) ++ poolActiveKeys) | |
116 | - | } | |
118 | + | else throw("Only admin can call this function") | |
117 | 119 | ||
118 | 120 | ||
119 | 121 | ||
120 | 122 | @Callable(i) | |
121 | 123 | func issueToken (name,description,quantity,decimals) = if (containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey)) | |
122 | 124 | then [Issue(name, description, quantity, decimals, true, unit, 0)] | |
123 | 125 | else throw("Only admin can call this function") | |
124 | 126 | ||
125 | 127 | ||
126 | 128 | ||
127 | 129 | @Callable(a8) | |
128 | 130 | func call () = { | |
129 | 131 | let a9 = Issue("Asset107112021", "Asset from dApp 1", 100000, 2, true, unit, 0) | |
130 | 132 | let a10 = Issue("Asset207112021", "Asset from dApp 2", 100000, 2, true, unit, 0) | |
131 | 133 | [a10, a9] | |
132 | 134 | } | |
133 | 135 | ||
134 | 136 | ||
135 | 137 | ||
136 | 138 | @Callable(i) | |
137 | 139 | func deposit (pool) = { | |
138 | 140 | let amount = i.payments[0].amount | |
139 | 141 | let assetId = i.payments[0].assetId | |
140 | 142 | let poolAmountKey = (pool + "_asset_balance") | |
141 | 143 | let userAddress = toString(i.caller) | |
142 | 144 | let userPoolAmountKey = (((pool + "_") + userAddress) + "_asset_balance") | |
143 | - | let dAppAssetAddress = getStringValue(this, (pool + "_service_token")) | |
145 | + | let dAppAssetAddress = match getString((pool + "_service_token")) { | |
146 | + | case string: String => | |
147 | + | string | |
148 | + | case nothing => | |
149 | + | throw("You try to exchange on unsupported pool") | |
150 | + | } | |
144 | 151 | let poolAmount = getIntegerValue(this, poolAmountKey) | |
145 | 152 | let userAmount = match getInteger(userPoolAmountKey) { | |
146 | 153 | case int: Int => | |
147 | 154 | int | |
148 | 155 | case nothing => | |
149 | 156 | 0 | |
150 | 157 | } | |
151 | 158 | let newPoolAmount = (poolAmount + amount) | |
152 | 159 | let userAmountWithoutFee = ((amount - fraction(amount, 1, depositFee, HALFUP)) - fraction(amount, 1, controllerFee, HALFUP)) | |
153 | 160 | let newUserPoolAmount = (userAmount + userAmountWithoutFee) | |
154 | 161 | [Reissue(fromBase58String(dAppAssetAddress), userAmountWithoutFee, true), ScriptTransfer(i.caller, userAmountWithoutFee, fromBase58String(dAppAssetAddress)), IntegerEntry(poolAmountKey, newPoolAmount), IntegerEntry(userPoolAmountKey, newUserPoolAmount)] | |
155 | 162 | } | |
156 | 163 | ||
157 | 164 | ||
158 | 165 | ||
159 | 166 | @Callable(i) | |
160 | 167 | func withdraw (pool,userEarned) = { | |
161 | 168 | let amount = i.payments[0].amount | |
162 | 169 | let assetId = i.payments[0].assetId | |
163 | 170 | let poolAmountKey = (pool + "_asset_balance") | |
164 | 171 | let userAddress = toString(i.caller) | |
165 | 172 | let userPoolAmountKey = (((pool + "_") + userAddress) + "_asset_balance") | |
166 | 173 | let userPoolEarnedKey = (((pool + "_") + userAddress) + "_earned") | |
167 | 174 | let poolAmount = getIntegerValue(this, poolAmountKey) | |
168 | 175 | let userAmount = match getInteger(userPoolAmountKey) { | |
169 | 176 | case int: Int => | |
170 | 177 | int | |
171 | 178 | case nothing => | |
172 | 179 | 0 | |
173 | 180 | } | |
174 | 181 | let userEarnedBefore = match getInteger(userPoolEarnedKey) { | |
175 | 182 | case int: Int => | |
176 | 183 | int | |
177 | 184 | case nothing => | |
178 | 185 | 0 | |
179 | 186 | } | |
180 | 187 | let liquidutyAssetAddress = getStringValue(this, (pool + "_liquidity_token")) | |
181 | 188 | let liquidityTokenDecimal = match assetInfo(fromBase58String(liquidutyAssetAddress)) { | |
182 | 189 | case asset: Asset => | |
183 | 190 | asset.decimals | |
184 | 191 | case _ => | |
185 | 192 | throw("Can't find asset") | |
186 | 193 | } | |
187 | 194 | let dAppAssetAddress = getStringValue(this, (pool + "_service_token")) | |
188 | 195 | let userEarnedTotal = (userEarned + userEarnedBefore) | |
189 | 196 | let amountWithoutFee = ((amount - fraction(amount, 1, platformFee, HALFUP)) - fraction(amount, 1, controllerFee, HALFUP)) | |
190 | 197 | let newPoolAmount = (poolAmount - amountWithoutFee) | |
191 | 198 | if ((userAmount >= amount)) | |
192 | 199 | then { | |
193 | 200 | let newUserPoolAmount = (userAmount - amountWithoutFee) | |
194 | 201 | [Burn(fromBase58String(dAppAssetAddress), amountWithoutFee), ScriptTransfer(i.caller, amountWithoutFee, fromBase58String(liquidutyAssetAddress)), IntegerEntry(poolAmountKey, newPoolAmount), IntegerEntry(userPoolAmountKey, newUserPoolAmount), IntegerEntry(userPoolEarnedKey, userEarnedTotal)] | |
195 | 202 | } | |
196 | 203 | else throw("You have not such balance for withdraw") | |
197 | 204 | } | |
198 | 205 | ||
199 | 206 | ||
200 | 207 | @Verifier(b6) | |
201 | 208 | func b7 () = sigVerify(b6.bodyBytes, b6.proofs[0], b6.senderPublicKey) | |
202 | 209 |
github/deemru/w8io/169f3d6 57.62 ms ◑