tx · 9aKgg1s6G6M8LggGuanE44ip2HmKyDdX1eSzcVdUr6Cn 3MzDGFvPnXVbA4wCacqcVnfVJPwG952KVAg: -0.01400000 Waves 2022.01.31 23:20 [1903585] smart account 3MzDGFvPnXVbA4wCacqcVnfVJPwG952KVAg > SELF 0.00000000 Waves
{ "type": 13, "id": "9aKgg1s6G6M8LggGuanE44ip2HmKyDdX1eSzcVdUr6Cn", "fee": 1400000, "feeAssetId": null, "timestamp": 1643660431334, "version": 2, "chainId": 84, "sender": "3MzDGFvPnXVbA4wCacqcVnfVJPwG952KVAg", "senderPublicKey": "CViCXhHrygDDAtVc1uFczxe6ANj9tBz5PGQDS1yWZqgy", "proofs": [ "3kfNfa42guuESCdj5zLPbCJMNxDToG9JjECLYMnspZxbeMvk1ENnk5GKNQrEB8AhhfiVQUfnSeivuEojVvS5pvor", "3HZBM7eRuXtMbn67K723JizjbaWGmceTJVxwJuVhb6fhso2A3P3XWmratwXvMVWPdSDnafmVQiHjuHq7VxQXBom4" ], "script": "base64:AAIFAAAAAAAAAD4IAhIECgIBCBIDCgEIEhQKEggBAQgBAQEBAQEBARgEAQEEGBIFCgMBAQgSAwoBARIDCgEBEgQKAgEBEgASAAAAAEoAAAAACWtleUFjdGl2ZQIAAAAGYWN0aXZlAAAAAA9rZXlBZG1pblB1YktleTECAAAAC2FkbWluX3B1Yl8xAAAAAA9rZXlBZG1pblB1YktleTICAAAAC2FkbWluX3B1Yl8yAAAAAA9rZXlBZG1pblB1YktleTMCAAAAC2FkbWluX3B1Yl8zAAAAACFrZXlMYXVuY2hwYWREYXRhVHJhbnNhY3Rpb25TdGF0dXMCAAAAIWxhdW5jaHBhZF9kYXRhX3RyYW5zYWN0aW9uX3N0YXR1cwAAAAASa2V5TGF1bmNocGFkTmV4dElkAgAAABFsYXVuY2hwYWRfbmV4dF9pZAAAAAAUa2V5TGF1bmNocGFkQWN0aXZlSWQCAAAAE2xhdW5jaHBhZF9hY3RpdmVfaWQAAAAADWtleUluaXRDY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AAAAAFAAAADGFkbWluUHViS2V5MgYJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAABQAAAAxhZG1pblB1YktleTMGCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAUAAAASYWRtaW5QdWJLZXlTdGFraW5nBAAAAAckbWF0Y2gwBQAAAAJ0eAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAPRGF0YVRyYW5zYWN0aW9uBAAAAANkdHgFAAAAByRtYXRjaDADCQEAAAALdmFsdWVPckVsc2UAAAACCQAEGwAAAAIFAAAABm9yYWNsZQUAAAAha2V5TGF1bmNocGFkRGF0YVRyYW5zYWN0aW9uU3RhdHVzBwUAAAANc2lnbmVkQnlBZG1pbgcFAAAAE211bHRpU2lnbmVkQnlBZG1pbnOEiyQL", "height": 1903585, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9mHKMvrGPfnbPCYKVdf2n5RZQ36bMNzkUgqCkQsP81Tw Next: 5jnbopMRBeStmokxm3wZG2heTMxnh4GnESMLSNKAkVXn Diff:
Old | New | Differences | |
---|---|---|---|
31 | 31 | ||
32 | 32 | let keyTotalTokenAmount = "_total_token_amount" | |
33 | 33 | ||
34 | - | let | |
34 | + | let keyTotalAmountBuyAssetSold = "_total_buy_asset_sold" | |
35 | 35 | ||
36 | 36 | let keyTokensPerTicket = "_tokens_per_ticket" | |
37 | 37 | ||
55 | 55 | ||
56 | 56 | let keyDuration = "_duration" | |
57 | 57 | ||
58 | - | let | |
58 | + | let keyAmountBuyAssetInMarketing = "_total_purchased_buy_asset_in_marketing" | |
59 | 59 | ||
60 | - | let | |
60 | + | let keyAmountBuyAssetInMarketingFinalized = "_total_purchased_buy_asset_in_marketing_finalized" | |
61 | 61 | ||
62 | - | let | |
62 | + | let keyTransferBuyAsset = "_transfer_buy_asset" | |
63 | 63 | ||
64 | 64 | let keyFreezSwopDuration = "_freeze_swop_duration" | |
65 | 65 | ||
71 | 71 | ||
72 | 72 | let keyFreezeTokenPerTicket = "_freeze_token_per_ticket" | |
73 | 73 | ||
74 | + | let keyBuyToken = "_buy_token" | |
75 | + | ||
76 | + | let keyClaimParams = "_claim_params" | |
77 | + | ||
78 | + | let keyHighCompetitionComission = "_high_competition_comission" | |
79 | + | ||
80 | + | let keyHighCompetitionSale = "_high_competition_sale" | |
81 | + | ||
82 | + | let keyHCTicketLastNumber = "_high_competition_ticket_last_number" | |
83 | + | ||
84 | + | let keyHighCompetitionAmount = "_tickets_high_competition" | |
85 | + | ||
86 | + | let keyTotalAmountBuyAssetSoldHC = "_total_buy_asset_sold_high_competition" | |
87 | + | ||
88 | + | let keyUserClaimedTokens = "_claimed_tokens" | |
89 | + | ||
90 | + | let keyUserClaimedBuyTokens = "_claimed_buy_tokens" | |
91 | + | ||
74 | 92 | let keyUserBoughtTicketsAmount = "_bought_tickets" | |
75 | 93 | ||
76 | 94 | let keyUserTickets = "_tickets_number" | |
77 | 95 | ||
96 | + | let keyUserHCTickets = "_tickets_number_high_competition" | |
97 | + | ||
98 | + | let keyUserHCBoughtTicketsAmount = "_bought_tickets_high_competition" | |
99 | + | ||
78 | 100 | let keyUserAvailableAllocations = "_available_purchase_marketing" | |
79 | 101 | ||
80 | - | let | |
102 | + | let keyUserAmountBuyAssetInMarketing = "_purchased_buy_asset_in_marketing" | |
81 | 103 | ||
82 | 104 | let keyUserBoughtAllocations = "_bought_allocations" | |
83 | 105 | ||
85 | 107 | ||
86 | 108 | let keyUserWinnedTicketsAmount = "_tickets_result" | |
87 | 109 | ||
110 | + | let keyUserWinnedHighCompetitionTicketsAmount = "_tickets_result_high_competition" | |
111 | + | ||
88 | 112 | let keyUserFreezeToken = "_freeze_token_amount" | |
89 | - | ||
90 | - | let lauchpadDuration = 10000 | |
91 | 113 | ||
92 | 114 | let oracle = Address(base58'3NBBWfzZtZtszaXbitTKnrB2xXwv26Bn7H9') | |
93 | 115 | ||
102 | 124 | let adminPubKeyStaking = base58'Kn7NpzaG12dLZgcHf2ipUftU6hbJygmrhFqQYE4B7ZK' | |
103 | 125 | ||
104 | 126 | let maxAllocationsAmount = 2 | |
105 | - | ||
106 | - | let isActive = valueOrElse(getBoolean(this, keyActive), true) | |
107 | 127 | ||
108 | 128 | let activeLaunchpadId = valueOrElse(getIntegerValue(this, keyLaunchpadActiveId), -1) | |
109 | 129 | ||
139 | 159 | func stakedUsdnAmount () = valueOrElse(getInteger(stakingUSDNAddress, ((("rpd_balance_" + toBase58String(USDN)) + "_") + toString(this))), 0) | |
140 | 160 | ||
141 | 161 | ||
162 | + | let active = valueOrElse(getBoolean(this, keyActive), true) | |
163 | + | ||
164 | + | func isActive () = if (active) | |
165 | + | then unit | |
166 | + | else throw("DApp is inactive at this moment") | |
167 | + | ||
168 | + | ||
169 | + | func isAdminCall (i) = if (containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey)) | |
170 | + | then unit | |
171 | + | else throw("Only admin can call this function") | |
172 | + | ||
173 | + | ||
174 | + | func getAssetInfoFromString (assetStr) = if ((assetStr == "WAVES")) | |
175 | + | then $Tuple4(unit, "WAVES", "WAVES", 8) | |
176 | + | else { | |
177 | + | let stringId = assetStr | |
178 | + | let id = fromBase58String(assetStr) | |
179 | + | let info = valueOrErrorMessage(assetInfo(id), (("Asset " + stringId) + " doesn't exist")) | |
180 | + | $Tuple4(id, stringId, info.name, info.decimals) | |
181 | + | } | |
182 | + | ||
183 | + | ||
142 | 184 | @Callable(i) | |
143 | - | func hashingRandom (launchpadId,hash) = if (!(isActive)) | |
144 | - | then throw("DApp is inactive at this moment") | |
145 | - | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))) | |
146 | - | then throw("Only admin can call this function") | |
147 | - | else [StringEntry((toString(launchpadId) + keyVerifyHash), hash)] | |
185 | + | func hashingRandom (launchpadId,hash) = valueOrElse(isActive(), valueOrElse(isAdminCall(i), [StringEntry((toString(launchpadId) + keyVerifyHash), hash)])) | |
148 | 186 | ||
149 | 187 | ||
150 | 188 | ||
151 | 189 | @Callable(i) | |
152 | - | func initCaller (address) = if (!(isActive)) | |
153 | - | then throw("DApp is inactive at this moment") | |
154 | - | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))) | |
155 | - | then throw("Only admin can call this function") | |
156 | - | else [StringEntry(keyInitCaller, address)] | |
190 | + | func initCaller (address) = valueOrElse(isActive(), valueOrElse(isAdminCall(i), [StringEntry(keyInitCaller, address)])) | |
157 | 191 | ||
158 | 192 | ||
159 | 193 | ||
160 | 194 | @Callable(i) | |
161 | - | func init (projectAddress,startHeight,commission,tokensPerTicket,pricePerToken,swopfiTicketsAmount,campaignTokensAmount,tokensPerAllocation,swopPerTicket,swopFreezeDuration,freezeAdditionalToken,freezeParams) = if (!(isActive)) | |
162 | - | then throw("DApp is inactive at this moment") | |
163 | - | else if ((toString(i.caller) != valueOrElse(getString(this, keyInitCaller), ""))) | |
164 | - | then throw("Only project admin can call init function") | |
165 | - | else if ((size(i.payments) != 1)) | |
166 | - | then throw("One attached payment expected") | |
167 | - | else if ((height > startHeight)) | |
168 | - | then throw("Start height must be greater than blockchain height") | |
169 | - | else if (if (freezeAdditionalToken) | |
170 | - | then (size(freezeParams) != 3) | |
171 | - | else false) | |
172 | - | then throw("Freeze params list must have 3 items") | |
173 | - | else { | |
174 | - | let launchpadId = getLaunchpadNextId() | |
175 | - | let launchpadIdStr = toString(launchpadId) | |
176 | - | let $t053095384 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
177 | - | let pmtAmount = $t053095384._1 | |
178 | - | let pmtAssetId = $t053095384._2 | |
179 | - | let $t053935466 = getAssetInfo(pmtAssetId) | |
180 | - | let pmtStrAssetId = $t053935466._1 | |
181 | - | let pmtAssetName = $t053935466._2 | |
182 | - | let pmtDecimals = $t053935466._3 | |
183 | - | let freezeAdditionalEntry = if (freezeAdditionalToken) | |
184 | - | then [BooleanEntry((launchpadIdStr + keyFreezeAdditionalToken), true), StringEntry((launchpadIdStr + keyFreezeTokenId), freezeParams[0]), IntegerEntry((launchpadIdStr + keyFreezeTokenDuration), parseIntValue(freezeParams[1])), IntegerEntry((launchpadIdStr + keyFreezeTokenPerTicket), parseIntValue(freezeParams[2]))] | |
185 | - | else nil | |
186 | - | ([IntegerEntry((pmtStrAssetId + "_launchpad"), launchpadId), IntegerEntry(keyLaunchpadNextId, (launchpadId + 1)), StringEntry((launchpadIdStr + keyAddress), projectAddress), IntegerEntry((launchpadIdStr + keyInitHeight), height), IntegerEntry((launchpadIdStr + keyStartHeight), startHeight), IntegerEntry((launchpadIdStr + keyDuration), lauchpadDuration), IntegerEntry((launchpadIdStr + keyFreezSwopDuration), swopFreezeDuration), IntegerEntry((launchpadIdStr + keyTotalTokenAmount), pmtAmount), StringEntry((launchpadIdStr + keyAssetId), pmtStrAssetId), IntegerEntry((launchpadIdStr + keyComission), commission), IntegerEntry((launchpadIdStr + keyTicketLastNumber), 0), IntegerEntry((launchpadIdStr + keyTokensPerTicket), tokensPerTicket), IntegerEntry((launchpadIdStr + keyPricePerToken), pricePerToken), IntegerEntry((launchpadIdStr + keySwopPerTicket), swopPerTicket), IntegerEntry((launchpadIdStr + keySwopfiTicketsAmount), swopfiTicketsAmount), IntegerEntry((launchpadIdStr + keyCampaignTokensAmount), campaignTokensAmount), IntegerEntry((launchpadIdStr + keyTokensPerAllocation), tokensPerAllocation), IntegerEntry(keyLaunchpadActiveId, launchpadId), StringEntry(keyInitCaller, "")] ++ freezeAdditionalEntry) | |
187 | - | } | |
195 | + | func init (projectAddress,startHeight,duration,buyToken,commission,tokensPerTicket,pricePerToken,swopfiTicketsAmount,campaignTokensAmount,tokensPerAllocation,swopPerTicket,swopFreezeDuration,claimParams,HighCompetitionSale,highCompetitionComission,highCompetitionTicketsAmount,freezeAdditionalToken,freezeParams) = valueOrElse(isActive(), if ((toString(i.caller) != valueOrElse(getString(this, keyInitCaller), ""))) | |
196 | + | then throw("Only project admin can call init function") | |
197 | + | else if ((size(i.payments) != 1)) | |
198 | + | then throw("One attached payment expected") | |
199 | + | else if ((height > startHeight)) | |
200 | + | then throw("Start height must be greater than blockchain height") | |
201 | + | else if (if (freezeAdditionalToken) | |
202 | + | then (size(freezeParams) != 3) | |
203 | + | else false) | |
204 | + | then throw("Freeze params list must have 3 items") | |
205 | + | else { | |
206 | + | let launchpadId = getLaunchpadNextId() | |
207 | + | let launchpadIdStr = toString(launchpadId) | |
208 | + | let $t064026477 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
209 | + | let pmtAmount = $t064026477._1 | |
210 | + | let pmtAssetId = $t064026477._2 | |
211 | + | let $t064866559 = getAssetInfo(pmtAssetId) | |
212 | + | let pmtStrAssetId = $t064866559._1 | |
213 | + | let pmtAssetName = $t064866559._2 | |
214 | + | let pmtDecimals = $t064866559._3 | |
215 | + | let freezeAdditionalEntry = if (freezeAdditionalToken) | |
216 | + | then [BooleanEntry((launchpadIdStr + keyFreezeAdditionalToken), true), StringEntry((launchpadIdStr + keyFreezeTokenId), freezeParams[0]), IntegerEntry((launchpadIdStr + keyFreezeTokenDuration), parseIntValue(freezeParams[1])), IntegerEntry((launchpadIdStr + keyFreezeTokenPerTicket), parseIntValue(freezeParams[2]))] | |
217 | + | else nil | |
218 | + | ([IntegerEntry((pmtStrAssetId + "_launchpad"), launchpadId), IntegerEntry(keyLaunchpadNextId, (launchpadId + 1)), StringEntry((launchpadIdStr + keyAddress), projectAddress), IntegerEntry((launchpadIdStr + keyInitHeight), height), IntegerEntry((launchpadIdStr + keyStartHeight), startHeight), IntegerEntry((launchpadIdStr + keyDuration), duration), StringEntry((launchpadIdStr + keyBuyToken), buyToken), IntegerEntry((launchpadIdStr + keyFreezSwopDuration), swopFreezeDuration), IntegerEntry((launchpadIdStr + keyTotalTokenAmount), pmtAmount), StringEntry((launchpadIdStr + keyAssetId), pmtStrAssetId), IntegerEntry((launchpadIdStr + keyComission), commission), IntegerEntry((launchpadIdStr + keyTicketLastNumber), 0), IntegerEntry((launchpadIdStr + keyHCTicketLastNumber), 0), IntegerEntry((launchpadIdStr + keyTokensPerTicket), tokensPerTicket), IntegerEntry((launchpadIdStr + keyPricePerToken), pricePerToken), IntegerEntry((launchpadIdStr + keySwopPerTicket), swopPerTicket), IntegerEntry((launchpadIdStr + keySwopfiTicketsAmount), swopfiTicketsAmount), IntegerEntry((launchpadIdStr + keyCampaignTokensAmount), campaignTokensAmount), IntegerEntry((launchpadIdStr + keyTokensPerAllocation), tokensPerAllocation), StringEntry((launchpadIdStr + keyClaimParams), makeString(claimParams, ",")), BooleanEntry((launchpadIdStr + keyHighCompetitionSale), HighCompetitionSale), IntegerEntry((launchpadIdStr + keyHighCompetitionComission), highCompetitionComission), IntegerEntry((launchpadIdStr + keyHighCompetitionAmount), highCompetitionTicketsAmount), IntegerEntry(keyLaunchpadActiveId, launchpadId), StringEntry(keyInitCaller, "")] ++ freezeAdditionalEntry) | |
219 | + | }) | |
188 | 220 | ||
189 | 221 | ||
190 | 222 | ||
191 | 223 | @Callable(i) | |
192 | - | func commitSwopfiSale (launchpadId,refId) = { | |
193 | - | let $t075377612 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
194 | - | let pmtAmount = $t075377612._1 | |
195 | - | let pmtAssetId = $t075377612._2 | |
196 | - | let stakedSwops = valueOrElse(getInteger(governance, (toString(i.caller) + keyGovernanceStaked)), 0) | |
197 | - | let allowedTicketsAmountAll = (stakedSwops / getIntegerValue(this, (toString(launchpadId) + keySwopPerTicket))) | |
198 | - | let boughtTicketsAmount = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserBoughtTicketsAmount)), 0) | |
199 | - | let allowedTicketsAmount = (allowedTicketsAmountAll - boughtTicketsAmount) | |
200 | - | let startHeight = value(getInteger(this, (toString(launchpadId) + keyStartHeight))) | |
201 | - | let duration = value(getInteger(this, (toString(launchpadId) + keyDuration))) | |
202 | - | let freezeAdditionalToken = valueOrElse(getBoolean(this, (toString(launchpadId) + keyFreezeAdditionalToken)), false) | |
203 | - | if (!(isActive)) | |
204 | - | then throw("DApp is inactive at this moment") | |
205 | - | else if ((activeLaunchpadId != launchpadId)) | |
206 | - | then throw("There is no active launchpad or this launchpad is ended") | |
207 | - | else if ((startHeight > height)) | |
208 | - | then throw("Launchpad sale not started yet") | |
209 | - | else if ((height > (startHeight + duration))) | |
210 | - | then throw("Launchpad sale ended") | |
211 | - | else if (if (!(freezeAdditionalToken)) | |
212 | - | then if ((size(i.payments) != 1)) | |
213 | - | then true | |
214 | - | else (pmtAssetId != USDN) | |
215 | - | else false) | |
216 | - | then throw("One attached payment in USDN expected") | |
217 | - | else if (if (freezeAdditionalToken) | |
218 | - | then if ((size(i.payments) != 2)) | |
219 | - | then true | |
220 | - | else (pmtAssetId != USDN) | |
221 | - | else false) | |
222 | - | then { | |
223 | - | let freezeTokenId = getStringValue(this, (toString(launchpadId) + keyFreezeTokenId)) | |
224 | - | throw(("Two attached payments expected: First in USDN, second in " + freezeTokenId)) | |
225 | - | } | |
226 | - | else if (if ((0 >= allowedTicketsAmountAll)) | |
227 | - | then true | |
228 | - | else (0 >= allowedTicketsAmount)) | |
229 | - | then throw("Not enought SWOP in staking to buy tickets") | |
230 | - | else { | |
231 | - | let tokenPrice = getIntegerValue(this, (toString(launchpadId) + keyPricePerToken)) | |
232 | - | let tokensPerTicket = getIntegerValue(this, (toString(launchpadId) + keyTokensPerTicket)) | |
233 | - | let tokenId = fromBase58String(getStringValue(this, (toString(launchpadId) + keyAssetId))) | |
234 | - | let $t095549630 = getAssetInfo(tokenId) | |
235 | - | let tokenStrAssetId = $t095549630._1 | |
236 | - | let tokenAssetName = $t095549630._2 | |
237 | - | let tokenDecimals = $t095549630._3 | |
238 | - | let ticketPrice = fraction(tokensPerTicket, tokenPrice, pow(10, 0, tokenDecimals, 0, 0, DOWN)) | |
239 | - | let commissionPerTicket = fraction(ticketPrice, getIntegerValue(this, (toString(launchpadId) + keyComission)), 100) | |
240 | - | let buyTicketAmount = (pmtAmount / (ticketPrice + commissionPerTicket)) | |
241 | - | let allowedBuyTicketAmount = min([buyTicketAmount, allowedTicketsAmount]) | |
242 | - | let allowedBuyPriceWithComission = (allowedBuyTicketAmount * (ticketPrice + commissionPerTicket)) | |
243 | - | let change = (pmtAmount - allowedBuyPriceWithComission) | |
244 | - | if ((buyTicketAmount == 0)) | |
245 | - | then throw("Not enought USDN to buy tickets") | |
246 | - | else if ((change != 0)) | |
247 | - | then throw((((("Wrong payment. To buy " + toString(allowedBuyTicketAmount)) + "tickets you need to pay ") + toString(allowedBuyPriceWithComission)) + "USDN")) | |
248 | - | else { | |
249 | - | let freezeAdditionalEntry = if (freezeAdditionalToken) | |
250 | - | then { | |
251 | - | let freezeTokenId = getStringValue(this, (toString(launchpadId) + keyFreezeTokenId)) | |
252 | - | let freezeTokenPerTicket = getIntegerValue(this, (toString(launchpadId) + keyFreezeTokenPerTicket)) | |
253 | - | let $t01077210859 = $Tuple2(i.payments[1].amount, i.payments[1].assetId) | |
254 | - | let pmtAmountFreeze = $t01077210859._1 | |
255 | - | let pmtAssetIdFreeze = $t01077210859._2 | |
256 | - | let $t01087610967 = getAssetInfo(pmtAssetId) | |
257 | - | let pmtFreezeStrAssetId = $t01087610967._1 | |
258 | - | let pmtFreezeAssetName = $t01087610967._2 | |
259 | - | let pmtFreezeDecimals = $t01087610967._3 | |
260 | - | let needFreezeTokens = (freezeTokenPerTicket * buyTicketAmount) | |
261 | - | if (if ((pmtFreezeStrAssetId != freezeTokenId)) | |
262 | - | then true | |
263 | - | else (needFreezeTokens != pmtAmountFreeze)) | |
264 | - | then throw((((("You need to add " + toString(needFreezeTokens)) + " ") + pmtFreezeAssetName) + " as a second payment")) | |
265 | - | else [IntegerEntry((((toString(i.caller) + "_") + toString(launchpadId)) + keyUserFreezeToken), pmtAmountFreeze)] | |
266 | - | } | |
267 | - | else nil | |
268 | - | let userBoughtTicketsNumbers = valueOrElse(getString(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserTickets)), "") | |
269 | - | let lastBoughtTicketNumber = getIntegerValue(this, (toString(launchpadId) + keyTicketLastNumber)) | |
270 | - | let boughtRange = ((toString((lastBoughtTicketNumber + 1)) + "-") + toString((lastBoughtTicketNumber + allowedBuyTicketAmount))) | |
271 | - | let newUserBoughtTicketsNumbers = (userBoughtTicketsNumbers + (if ((userBoughtTicketsNumbers != "")) | |
272 | - | then ("," + boughtRange) | |
273 | - | else ("" + boughtRange))) | |
274 | - | let inv = invoke(stakingUSDNAddress, "lockNeutrino", nil, [AttachedPayment(pmtAssetId, pmtAmount)]) | |
275 | - | if ((inv == inv)) | |
276 | - | then { | |
277 | - | let baseEntry = ([IntegerEntry((((toString(i.caller) + "_") + toString(launchpadId)) + keyUserBoughtTicketsAmount), (boughtTicketsAmount + allowedBuyTicketAmount)), IntegerEntry((toString(launchpadId) + keyTicketLastNumber), (lastBoughtTicketNumber + allowedBuyTicketAmount)), StringEntry((((toString(i.caller) + "_") + toString(launchpadId)) + keyUserTickets), newUserBoughtTicketsNumbers)] ++ freezeAdditionalEntry) | |
278 | - | if (!(isDefined(getString(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserRefId))))) | |
279 | - | then (baseEntry ++ [StringEntry((((toString(i.caller) + "_") + toString(launchpadId)) + keyUserRefId), refId)]) | |
280 | - | else baseEntry | |
281 | - | } | |
282 | - | else throw("Strict value is not equal to itself.") | |
283 | - | } | |
284 | - | } | |
285 | - | } | |
224 | + | func finalise (launchpadId,vrfHeight,secretWord) = valueOrElse(isActive(), valueOrElse(isAdminCall(i), { | |
225 | + | let savedHash = getStringValue(this, (toString(launchpadId) + keyVerifyHash)) | |
226 | + | let calcHash = toBase58String(sha256((toBytes(vrfHeight) + toBytes(secretWord)))) | |
227 | + | if ((calcHash != savedHash)) | |
228 | + | then throw("vrf Height hash not matching") | |
229 | + | else { | |
230 | + | let $t094659615 = getAssetInfoFromString(value(getString(this, (toString(launchpadId) + keyBuyToken)))) | |
231 | + | let buyAssetId = $t094659615._1 | |
232 | + | let buyAssetStrId = $t094659615._2 | |
233 | + | let buyAssetName = $t094659615._3 | |
234 | + | let buyAssetDecimals = $t094659615._4 | |
235 | + | let projectAddress = addressFromStringValue(getStringValue(this, (toString(launchpadId) + keyAddress))) | |
236 | + | let commission = getIntegerValue(this, (toString(launchpadId) + keyComission)) | |
237 | + | let commissionHC = getIntegerValue(this, (toString(launchpadId) + keyHighCompetitionComission)) | |
238 | + | let transferedBuyAsset = valueOrElse(getInteger(this, (toString(launchpadId) + keyTransferBuyAsset)), 0) | |
239 | + | let swopfiMembersBuyAssetAmount = getIntegerValue(this, (toString(launchpadId) + keyTotalAmountBuyAssetSold)) | |
240 | + | let swopfiHCBuyAssetAmount = valueOrElse(getIntegerValue(this, (toString(launchpadId) + keyTotalAmountBuyAssetSoldHC)), 0) | |
241 | + | let swopfiMembersComission = fraction(swopfiMembersBuyAssetAmount, commission, 100) | |
242 | + | let swopfiHCComission = fraction(swopfiHCBuyAssetAmount, commissionHC, 100) | |
243 | + | let totalAmountBuyAssetInMarketing = getIntegerValue(this, (toString(launchpadId) + keyAmountBuyAssetInMarketingFinalized)) | |
244 | + | let marketingComission = fraction(totalAmountBuyAssetInMarketing, commission, 100) | |
245 | + | let unstakeAmount = (((((swopfiMembersBuyAssetAmount + totalAmountBuyAssetInMarketing) + swopfiMembersComission) + marketingComission) + swopfiHCBuyAssetAmount) + swopfiHCComission) | |
246 | + | if ((transferedBuyAsset > (swopfiMembersBuyAssetAmount + totalAmountBuyAssetInMarketing))) | |
247 | + | then throw("Can't transfer negative value to project") | |
248 | + | else { | |
249 | + | let inv = if ((buyAssetId == USDN)) | |
250 | + | then invoke(stakingUSDNAddress, "unlockNeutrino", [unstakeAmount, toBase58String(USDN)], nil) | |
251 | + | else 0 | |
252 | + | if ((inv == inv)) | |
253 | + | then [IntegerEntry((toString(launchpadId) + keyFinaliseHeight), height), ScriptTransfer(projectAddress, (((swopfiMembersBuyAssetAmount + swopfiHCBuyAssetAmount) + totalAmountBuyAssetInMarketing) - transferedBuyAsset), buyAssetId), ScriptTransfer(commissionWallet, ((swopfiMembersComission + marketingComission) + swopfiHCComission), buyAssetId)] | |
254 | + | else throw("Strict value is not equal to itself.") | |
255 | + | } | |
256 | + | } | |
257 | + | })) | |
286 | 258 | ||
287 | 259 | ||
288 | 260 | ||
289 | 261 | @Callable(i) | |
290 | - | func commitAccessListSale (launchpadId,refId) = { | |
291 | - | let $t01295413029 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
292 | - | let pmtAmount = $t01295413029._1 | |
293 | - | let pmtAssetId = $t01295413029._2 | |
294 | - | let userUsdnInMarketing = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserAmountUSDNInMarketing)), 0) | |
295 | - | let usdnInMarketing = valueOrElse(getInteger(this, (toString(launchpadId) + keyAmountUSDNInMarketing)), 0) | |
262 | + | func claim (launchpadId) = valueOrElse(isActive(), { | |
263 | + | let boughtTickets = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserBoughtTicketsAmount)), 0) | |
264 | + | let boughtHCTickets = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserHCBoughtTicketsAmount)), 0) | |
296 | 265 | let boughtAllocations = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserBoughtAllocations)), 0) | |
297 | - | let commission = getIntegerValue(this, (toString(launchpadId) + keyComission)) | |
298 | - | let tokenPrice = getIntegerValue(this, (toString(launchpadId) + keyPricePerToken)) | |
299 | - | let tokensPerAllocation = getIntegerValue(this, (toString(launchpadId) + keyTokensPerAllocation)) | |
300 | - | let tokenId = fromBase58String(getStringValue(this, (toString(launchpadId) + keyAssetId))) | |
301 | - | let $t01378413860 = getAssetInfo(tokenId) | |
302 | - | let tokenStrAssetId = $t01378413860._1 | |
303 | - | let tokenAssetName = $t01378413860._2 | |
304 | - | let tokenDecimals = $t01378413860._3 | |
305 | - | let allocationPriceWithComission = fraction(fraction(tokenPrice, tokensPerAllocation, pow(10, 0, tokenDecimals, 0, 0, DOWN)), (100 + commission), 100) | |
306 | - | let startHeight = value(getInteger(this, (toString(launchpadId) + keyStartHeight))) | |
307 | - | let duration = value(getInteger(this, (toString(launchpadId) + keyDuration))) | |
308 | - | if (!(isActive)) | |
309 | - | then throw("DApp is inactive at this moment") | |
310 | - | else if ((activeLaunchpadId != launchpadId)) | |
311 | - | then throw("There is no active launchpad or this launchpad is ended") | |
312 | - | else if ((startHeight > height)) | |
313 | - | then throw("Launchpad sale not started yet") | |
314 | - | else if ((height > (startHeight + duration))) | |
315 | - | then throw("Launchpad sale ended") | |
316 | - | else if (if ((size(i.payments) != 1)) | |
266 | + | let userClaimStatus = valueOrElse(getBoolean(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserClaimStatus)), false) | |
267 | + | let finalizeHeight = valueOrElse(getInteger(this, (toString(launchpadId) + keyFinaliseHeight)), 0) | |
268 | + | if ((finalizeHeight == 0)) | |
269 | + | then throw("You can't claim because results are not finalized") | |
270 | + | else if (userClaimStatus) | |
271 | + | then throw("You are already claimed") | |
272 | + | else if (if (if ((boughtTickets == 0)) | |
273 | + | then (boughtAllocations == 0) | |
274 | + | else false) | |
275 | + | then (boughtHCTickets == 0) | |
276 | + | else false) | |
277 | + | then throw("You can't claim because you don't buy anything") | |
278 | + | else { | |
279 | + | let $t01266012810 = getAssetInfoFromString(value(getString(this, (toString(launchpadId) + keyBuyToken)))) | |
280 | + | let buyAssetId = $t01266012810._1 | |
281 | + | let buyAssetStrId = $t01266012810._2 | |
282 | + | let buyAssetName = $t01266012810._3 | |
283 | + | let buyAssetDecimals = $t01266012810._4 | |
284 | + | let wonnedTickets = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserWinnedTicketsAmount)), 0) | |
285 | + | let wonnedHCTickets = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserWinnedHighCompetitionTicketsAmount)), 0) | |
286 | + | let awailableAllocations = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserAvailableAllocations)), 0) | |
287 | + | let commission = getIntegerValue(this, (toString(launchpadId) + keyComission)) | |
288 | + | let commissionHC = getIntegerValue(this, (toString(launchpadId) + keyHighCompetitionComission)) | |
289 | + | let allowedAllocations = min([boughtAllocations, awailableAllocations]) | |
290 | + | let tokenPrice = getIntegerValue(this, (toString(launchpadId) + keyPricePerToken)) | |
291 | + | let tokensPerTicket = getIntegerValue(this, (toString(launchpadId) + keyTokensPerTicket)) | |
292 | + | let $t01371613860 = getAssetInfoFromString(getStringValue(this, (toString(launchpadId) + keyAssetId))) | |
293 | + | let tokenId = $t01371613860._1 | |
294 | + | let tokenStrAssetId = $t01371613860._2 | |
295 | + | let tokenAssetName = $t01371613860._3 | |
296 | + | let tokenDecimals = $t01371613860._4 | |
297 | + | let ticketPrice = fraction(tokensPerTicket, tokenPrice, pow(10, 0, tokenDecimals, 0, 0, DOWN)) | |
298 | + | let tokensPerAllocation = getIntegerValue(this, (toString(launchpadId) + keyTokensPerAllocation)) | |
299 | + | let transferTokensAmount = (((wonnedTickets * tokensPerTicket) + (allowedAllocations * tokensPerAllocation)) + (wonnedHCTickets * tokensPerTicket)) | |
300 | + | let notAllowedAllocationsTokens = ((boughtAllocations - allowedAllocations) * tokensPerAllocation) | |
301 | + | let buyAssetForAllocations = fraction(fraction(notAllowedAllocationsTokens, tokenPrice, pow(10, 0, tokenDecimals, 0, 0, DOWN)), (100 + commission), 100) | |
302 | + | let buyAssetForUnwonnedTickets = fraction(((boughtTickets - wonnedTickets) * ticketPrice), (100 + commission), 100) | |
303 | + | let buyAssetForHCUnwonnedTickets = fraction(((boughtHCTickets - wonnedHCTickets) * ticketPrice), (100 + commissionHC), 100) | |
304 | + | let claimedBuyToken = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserClaimedBuyTokens)), 0) | |
305 | + | if (if (if ((0 > buyAssetForAllocations)) | |
317 | 306 | then true | |
318 | - | else (pmtAssetId != USDN)) | |
319 | - | then throw("One attached payment in USDN expected") | |
320 | - | else if ((boughtAllocations >= maxAllocationsAmount)) | |
321 | - | then throw((("You can buy only " + toString(maxAllocationsAmount)) + "allocations")) | |
322 | - | else if (if ((allocationPriceWithComission != pmtAmount)) | |
323 | - | then ((allocationPriceWithComission * 2) != pmtAmount) | |
307 | + | else (0 > buyAssetForUnwonnedTickets)) | |
308 | + | then true | |
309 | + | else (0 > buyAssetForHCUnwonnedTickets)) | |
310 | + | then throw("Error with allowed allocation param or wonned tickets param please contact support") | |
311 | + | else { | |
312 | + | let returnedBuyAssetAmount = (((buyAssetForUnwonnedTickets + buyAssetForHCUnwonnedTickets) + buyAssetForAllocations) - claimedBuyToken) | |
313 | + | let transferBuyAsset = if ((returnedBuyAssetAmount > 0)) | |
314 | + | then [ScriptTransfer(i.caller, returnedBuyAssetAmount, buyAssetId), IntegerEntry((((toString(i.caller) + "_") + toString(launchpadId)) + keyUserClaimedBuyTokens), returnedBuyAssetAmount)] | |
315 | + | else nil | |
316 | + | let inv = if (if ((returnedBuyAssetAmount > 0)) | |
317 | + | then (buyAssetId == USDN) | |
324 | 318 | else false) | |
325 | - | then throw((("Wrong payment. You can buy 1 or 2 allocations for " + toString(allocationPriceWithComission)) + " USDN per allocation")) | |
326 | - | else { | |
327 | - | let buyAllocationsAmount = (pmtAmount / allocationPriceWithComission) | |
328 | - | let inv = invoke(stakingUSDNAddress, "lockNeutrino", nil, [AttachedPayment(pmtAssetId, pmtAmount)]) | |
329 | - | if ((inv == inv)) | |
319 | + | then invoke(stakingUSDNAddress, "unlockNeutrino", [returnedBuyAssetAmount, toBase58String(USDN)], nil) | |
320 | + | else 0 | |
321 | + | if ((inv == inv)) | |
322 | + | then { | |
323 | + | let claimedParams = split(valueOrElse(getString(this, (toString(launchpadId) + keyClaimParams)), ""), ",") | |
324 | + | if (if ((size(claimedParams) == 0)) | |
325 | + | then true | |
326 | + | else (claimedParams[0] == "claimAll")) | |
330 | 327 | then { | |
331 | - | let | |
332 | - | | |
333 | - | | |
334 | - | | |
328 | + | let transferTokens = if ((transferTokensAmount > 0)) | |
329 | + | then [ScriptTransfer(i.caller, transferTokensAmount, tokenId)] | |
330 | + | else nil | |
331 | + | (([BooleanEntry((((toString(i.caller) + "_") + toString(launchpadId)) + keyUserClaimStatus), true), IntegerEntry((((toString(i.caller) + "_") + toString(launchpadId)) + keyUserClaimedTokens), transferTokensAmount)] ++ transferTokens) ++ transferBuyAsset) | |
335 | 332 | } | |
336 | - | else throw("Strict value is not equal to itself.") | |
333 | + | else if ((claimedParams[0] == "claimPeriod")) | |
334 | + | then { | |
335 | + | let claimedTokens = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserClaimedTokens)), 0) | |
336 | + | let unlockPeriod = value(parseInt(claimedParams[2])) | |
337 | + | let blockHeight = (value(parseInt(claimedParams[3])) + finalizeHeight) | |
338 | + | let unlockHeight = (unlockPeriod + blockHeight) | |
339 | + | let allowedStartAmount = fraction(transferTokensAmount, value(parseInt(claimedParams[1])), 100) | |
340 | + | let allowedTokensAmount = (allowedStartAmount + (if ((height > blockHeight)) | |
341 | + | then (fraction((transferTokensAmount - allowedStartAmount), (min([height, unlockHeight]) - blockHeight), unlockPeriod) - claimedTokens) | |
342 | + | else (0 - claimedTokens))) | |
343 | + | let claimStatusEntry = if ((transferTokensAmount >= (claimedTokens + allowedTokensAmount))) | |
344 | + | then [BooleanEntry((((toString(i.caller) + "_") + toString(launchpadId)) + keyUserClaimStatus), true)] | |
345 | + | else nil | |
346 | + | if (if ((allowedTokensAmount > 0)) | |
347 | + | then true | |
348 | + | else (returnedBuyAssetAmount > 0)) | |
349 | + | then { | |
350 | + | let transferTokens = if ((allowedTokensAmount > 0)) | |
351 | + | then [IntegerEntry((((toString(i.caller) + "_") + toString(launchpadId)) + keyUserClaimedTokens), (claimedTokens + allowedTokensAmount)), ScriptTransfer(i.caller, allowedTokensAmount, tokenId)] | |
352 | + | else nil | |
353 | + | (transferBuyAsset ++ transferTokens) | |
354 | + | } | |
355 | + | else throw("Nothing to claim") | |
356 | + | } | |
357 | + | else throw("Unknown claim function") | |
337 | 358 | } | |
338 | - | } | |
359 | + | else throw("Strict value is not equal to itself.") | |
360 | + | } | |
361 | + | } | |
362 | + | }) | |
339 | 363 | ||
340 | 364 | ||
341 | 365 | ||
342 | 366 | @Callable(i) | |
343 | - | func finalise (launchpadId,vrfHeight,secretWord) = { | |
344 | - | let savedHash = getStringValue(this, (toString(launchpadId) + keyVerifyHash)) | |
345 | - | let calcHash = toBase58String(sha256((toBytes(vrfHeight) + toBytes(secretWord)))) | |
346 | - | if (!(isActive)) | |
347 | - | then throw("DApp is inactive at this moment") | |
348 | - | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))) | |
349 | - | then throw("Only admin can call this function") | |
350 | - | else if ((calcHash != savedHash)) | |
351 | - | then throw("vrf Height hash not matching") | |
352 | - | else { | |
353 | - | let projectAddress = addressFromStringValue(getStringValue(this, (toString(launchpadId) + keyAddress))) | |
354 | - | let commission = getIntegerValue(this, (toString(launchpadId) + keyComission)) | |
355 | - | let transferedUsdn = valueOrElse(getInteger(this, (toString(launchpadId) + keyTransferUsd)), 0) | |
356 | - | let swopfiMembersUsdnAmount = getIntegerValue(this, (toString(launchpadId) + keyTotalAmountUsdnSold)) | |
357 | - | let swopfiMembersComission = fraction(swopfiMembersUsdnAmount, commission, 100) | |
358 | - | let totalAmountUsdnInMarketing = getIntegerValue(this, (toString(launchpadId) + keyAmountUSDNInMarketingFinalized)) | |
359 | - | let marketingComission = fraction(totalAmountUsdnInMarketing, commission, 100) | |
360 | - | let unstakeAmount = (((swopfiMembersUsdnAmount + totalAmountUsdnInMarketing) + swopfiMembersComission) + marketingComission) | |
361 | - | if ((transferedUsdn > (swopfiMembersUsdnAmount + totalAmountUsdnInMarketing))) | |
362 | - | then throw("Can't transfer negative value to project") | |
363 | - | else { | |
364 | - | let inv = invoke(stakingUSDNAddress, "unlockNeutrino", [unstakeAmount, toBase58String(USDN)], nil) | |
365 | - | if ((inv == inv)) | |
366 | - | then [IntegerEntry((toString(launchpadId) + keyFinaliseHeight), height), ScriptTransfer(projectAddress, ((swopfiMembersUsdnAmount + totalAmountUsdnInMarketing) - transferedUsdn), USDN), ScriptTransfer(commissionWallet, (swopfiMembersComission + marketingComission), USDN)] | |
367 | - | else throw("Strict value is not equal to itself.") | |
368 | - | } | |
369 | - | } | |
370 | - | } | |
367 | + | func claimFreezeToken (launchpadId) = valueOrElse(isActive(), { | |
368 | + | let freezeAdditionalToken = valueOrElse(getBoolean(this, (toString(launchpadId) + keyFreezeAdditionalToken)), false) | |
369 | + | if (!(isDefined(getInteger(this, (toString(launchpadId) + keyFinaliseHeight))))) | |
370 | + | then throw("You can't claim because results are not finalized") | |
371 | + | else if (!(freezeAdditionalToken)) | |
372 | + | then throw("There are no additional token freezing for this launchpad") | |
373 | + | else { | |
374 | + | let tokenId = fromBase58String(getStringValue(this, (toString(launchpadId) + keyFreezeTokenId))) | |
375 | + | let userTokensFreezed = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserFreezeToken)), 0) | |
376 | + | let startHeight = valueOrElse(getInteger(this, (toString(launchpadId) + keyStartHeight)), 0) | |
377 | + | let duration = valueOrElse(getInteger(this, (toString(launchpadId) + keyDuration)), 0) | |
378 | + | let freezeTokenDuration = getIntegerValue(this, (toString(launchpadId) + keyFreezeTokenDuration)) | |
379 | + | let blockEndHeight = ((startHeight + duration) + freezeTokenDuration) | |
380 | + | if ((userTokensFreezed == 0)) | |
381 | + | then throw("You are already claimed your tokens or not paid anything") | |
382 | + | else if ((blockEndHeight > height)) | |
383 | + | then throw(("Your tokens freezed teel " + toString(blockEndHeight))) | |
384 | + | else [ScriptTransfer(i.caller, userTokensFreezed, tokenId), IntegerEntry((((toString(i.caller) + "_") + toString(launchpadId)) + keyUserFreezeToken), 0)] | |
385 | + | } | |
386 | + | }) | |
371 | 387 | ||
372 | 388 | ||
373 | 389 | ||
374 | 390 | @Callable(i) | |
375 | - | func claim (launchpadId) = { | |
376 | - | let userClaimStatus = valueOrElse(getBoolean(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserClaimStatus)), false) | |
377 | - | let boughtTickets = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserBoughtTicketsAmount)), 0) | |
378 | - | let boughtAllocations = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserBoughtAllocations)), 0) | |
379 | - | if (!(isActive)) | |
380 | - | then throw("DApp is inactive at this moment") | |
381 | - | else if (!(isDefined(getInteger(this, (toString(launchpadId) + keyFinaliseHeight))))) | |
382 | - | then throw("You can't claim because results are not finalized") | |
383 | - | else if (userClaimStatus) | |
384 | - | then throw("You are already claimed") | |
385 | - | else if (if ((boughtTickets == 0)) | |
386 | - | then (boughtAllocations == 0) | |
387 | - | else false) | |
388 | - | then throw("You can't claim because you don't buy anything") | |
389 | - | else { | |
390 | - | let tokenId = fromBase58String(getStringValue(this, (toString(launchpadId) + keyAssetId))) | |
391 | - | let wonnedTickets = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserWinnedTicketsAmount)), 0) | |
392 | - | let awailableAllocations = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserAvailableAllocations)), 0) | |
393 | - | let commission = getIntegerValue(this, (toString(launchpadId) + keyComission)) | |
394 | - | let allowedAllocations = min([boughtAllocations, awailableAllocations]) | |
395 | - | let tokenPrice = getIntegerValue(this, (toString(launchpadId) + keyPricePerToken)) | |
396 | - | let tokensPerTicket = getIntegerValue(this, (toString(launchpadId) + keyTokensPerTicket)) | |
397 | - | let $t01963419710 = getAssetInfo(tokenId) | |
398 | - | let tokenStrAssetId = $t01963419710._1 | |
399 | - | let tokenAssetName = $t01963419710._2 | |
400 | - | let tokenDecimals = $t01963419710._3 | |
401 | - | let ticketPrice = fraction(tokensPerTicket, tokenPrice, pow(10, 0, tokenDecimals, 0, 0, DOWN)) | |
402 | - | let tokensPerAllocation = getIntegerValue(this, (toString(launchpadId) + keyTokensPerAllocation)) | |
403 | - | let transferTokensAmount = ((wonnedTickets * tokensPerTicket) + (allowedAllocations * tokensPerAllocation)) | |
404 | - | let notAllowedAllocationsTokens = ((boughtAllocations - allowedAllocations) * tokensPerAllocation) | |
405 | - | let usdnForAllocations = fraction(fraction(notAllowedAllocationsTokens, tokenPrice, pow(10, 0, tokenDecimals, 0, 0, DOWN)), (100 + commission), 100) | |
406 | - | let usdnForUnwonnedTickets = fraction(((boughtTickets - wonnedTickets) * ticketPrice), (100 + commission), 100) | |
407 | - | if (if ((0 > usdnForAllocations)) | |
408 | - | then true | |
409 | - | else (0 > usdnForUnwonnedTickets)) | |
410 | - | then throw("Error with allowed allocation param or wonned tickets param please contact support") | |
411 | - | else { | |
412 | - | let returnedUsdnAmount = (usdnForAllocations + usdnForUnwonnedTickets) | |
413 | - | let transferUsdn = if ((returnedUsdnAmount > 0)) | |
414 | - | then [ScriptTransfer(i.caller, returnedUsdnAmount, USDN)] | |
415 | - | else nil | |
416 | - | let transferTokens = if ((transferTokensAmount > 0)) | |
417 | - | then [ScriptTransfer(i.caller, transferTokensAmount, tokenId)] | |
418 | - | else nil | |
419 | - | let inv = if ((returnedUsdnAmount > 0)) | |
420 | - | then invoke(stakingUSDNAddress, "unlockNeutrino", [returnedUsdnAmount, toBase58String(USDN)], nil) | |
421 | - | else 0 | |
422 | - | if ((inv == inv)) | |
423 | - | then (([BooleanEntry((((toString(i.caller) + "_") + toString(launchpadId)) + keyUserClaimStatus), true)] ++ transferTokens) ++ transferUsdn) | |
424 | - | else throw("Strict value is not equal to itself.") | |
425 | - | } | |
426 | - | } | |
427 | - | } | |
391 | + | func transferBuyAsset (launchpadId,amount) = valueOrElse(isActive(), valueOrElse(isAdminCall(i), { | |
392 | + | let projectAddress = addressFromStringValue(getStringValue(this, (toString(launchpadId) + keyAddress))) | |
393 | + | let $t02006620216 = getAssetInfoFromString(value(getString(this, (toString(launchpadId) + keyBuyToken)))) | |
394 | + | let buyAssetId = $t02006620216._1 | |
395 | + | let buyAssetStrId = $t02006620216._2 | |
396 | + | let buyAssetName = $t02006620216._3 | |
397 | + | let buyAssetDecimals = $t02006620216._4 | |
398 | + | [IntegerEntry((toString(launchpadId) + keyTransferBuyAsset), amount), ScriptTransfer(projectAddress, amount, buyAssetId)] | |
399 | + | })) | |
428 | 400 | ||
429 | 401 | ||
430 | 402 | ||
431 | 403 | @Callable(i) | |
432 | - | func claimFreezeToken (launchpadId) = { | |
433 | - | let freezeAdditionalToken = valueOrElse(getBoolean(this, (toString(launchpadId) + keyFreezeAdditionalToken)), false) | |
434 | - | if (!(isActive)) | |
435 | - | then throw("DApp is inactive at this moment") | |
436 | - | else if (!(isDefined(getInteger(this, (toString(launchpadId) + keyFinaliseHeight))))) | |
437 | - | then throw("You can't claim because results are not finalized") | |
438 | - | else if (!(freezeAdditionalToken)) | |
439 | - | then throw("There are no additional token freezing for this launchpad") | |
440 | - | else { | |
441 | - | let tokenId = fromBase58String(getStringValue(this, (toString(launchpadId) + keyFreezeTokenId))) | |
442 | - | let userTokensFreezed = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserFreezeToken)), 0) | |
443 | - | let startHeight = valueOrElse(getInteger(this, (toString(launchpadId) + keyStartHeight)), 0) | |
444 | - | let duration = valueOrElse(getInteger(this, (toString(launchpadId) + keyDuration)), 0) | |
445 | - | let freezeTokenDuration = getIntegerValue(this, (toString(launchpadId) + keyFreezeTokenDuration)) | |
446 | - | let blockEndHeight = ((startHeight + duration) + freezeTokenDuration) | |
447 | - | if ((userTokensFreezed == 0)) | |
448 | - | then throw("You are already claimed your tokens or not paid anything") | |
449 | - | else if ((blockEndHeight > height)) | |
450 | - | then throw(("Your tokens freezed teel " + toString(blockEndHeight))) | |
451 | - | else [ScriptTransfer(i.caller, userTokensFreezed, tokenId), IntegerEntry((((toString(i.caller) + "_") + toString(launchpadId)) + keyUserFreezeToken), 0)] | |
452 | - | } | |
453 | - | } | |
404 | + | func shutdown () = valueOrElse(isAdminCall(i), if (!(active)) | |
405 | + | then throw("DApp already inactive") | |
406 | + | else [BooleanEntry(keyActive, false)]) | |
454 | 407 | ||
455 | 408 | ||
456 | 409 | ||
457 | 410 | @Callable(i) | |
458 | - | func transferUsd (launchpadId,amountUsdn) = if (!(isActive)) | |
459 | - | then throw("DApp is inactive") | |
460 | - | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))) | |
461 | - | then throw("Only admin can call this function") | |
462 | - | else { | |
463 | - | let projectAddress = addressFromStringValue(getStringValue(this, (toString(launchpadId) + keyAddress))) | |
464 | - | [IntegerEntry((toString(launchpadId) + keyTransferUsd), amountUsdn), ScriptTransfer(projectAddress, amountUsdn, USDN)] | |
465 | - | } | |
466 | - | ||
467 | - | ||
468 | - | ||
469 | - | @Callable(i) | |
470 | - | func shutdown () = if (!(isActive)) | |
471 | - | then throw("DApp already inactive") | |
472 | - | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))) | |
473 | - | then throw("Only admin can call this function") | |
474 | - | else [BooleanEntry(keyActive, false)] | |
475 | - | ||
476 | - | ||
477 | - | ||
478 | - | @Callable(i) | |
479 | - | func activate () = if (isActive) | |
411 | + | func activate () = valueOrElse(isAdminCall(i), if (active) | |
480 | 412 | then throw("DApp already active") | |
481 | - | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))) | |
482 | - | then throw("Only admin can call this function") | |
483 | - | else [BooleanEntry(keyActive, true)] | |
413 | + | else [BooleanEntry(keyActive, true)]) | |
484 | 414 | ||
485 | 415 | ||
486 | 416 | @Verifier(tx) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let keyActive = "active" | |
5 | 5 | ||
6 | 6 | let keyAdminPubKey1 = "admin_pub_1" | |
7 | 7 | ||
8 | 8 | let keyAdminPubKey2 = "admin_pub_2" | |
9 | 9 | ||
10 | 10 | let keyAdminPubKey3 = "admin_pub_3" | |
11 | 11 | ||
12 | 12 | let keyLaunchpadDataTransactionStatus = "launchpad_data_transaction_status" | |
13 | 13 | ||
14 | 14 | let keyLaunchpadNextId = "launchpad_next_id" | |
15 | 15 | ||
16 | 16 | let keyLaunchpadActiveId = "launchpad_active_id" | |
17 | 17 | ||
18 | 18 | let keyInitCaller = "init_caller" | |
19 | 19 | ||
20 | 20 | let keyAddress = "_address" | |
21 | 21 | ||
22 | 22 | let keyInitHeight = "_init_height" | |
23 | 23 | ||
24 | 24 | let keyStartHeight = "_start_height" | |
25 | 25 | ||
26 | 26 | let keyFinaliseHeight = "_finalise_height" | |
27 | 27 | ||
28 | 28 | let keyComission = "_comission" | |
29 | 29 | ||
30 | 30 | let keyAssetId = "_asset_id" | |
31 | 31 | ||
32 | 32 | let keyTotalTokenAmount = "_total_token_amount" | |
33 | 33 | ||
34 | - | let | |
34 | + | let keyTotalAmountBuyAssetSold = "_total_buy_asset_sold" | |
35 | 35 | ||
36 | 36 | let keyTokensPerTicket = "_tokens_per_ticket" | |
37 | 37 | ||
38 | 38 | let keyPricePerToken = "_price_per_token" | |
39 | 39 | ||
40 | 40 | let keySwopPerTicket = "_swop_per_ticket" | |
41 | 41 | ||
42 | 42 | let keySwopfiTicketsAmount = "_tickets_swopfi_members" | |
43 | 43 | ||
44 | 44 | let keyCampaignTokensAmount = "_tokens_access_list" | |
45 | 45 | ||
46 | 46 | let keyTokensPerAllocation = "_tokens_per_allocation" | |
47 | 47 | ||
48 | 48 | let keyTicketLastNumber = "_ticket_last_number" | |
49 | 49 | ||
50 | 50 | let keyGovernanceStaked = "_SWOP_amount" | |
51 | 51 | ||
52 | 52 | let keyUserRefId = "_ref_id" | |
53 | 53 | ||
54 | 54 | let keyVerifyHash = "_verify_hash" | |
55 | 55 | ||
56 | 56 | let keyDuration = "_duration" | |
57 | 57 | ||
58 | - | let | |
58 | + | let keyAmountBuyAssetInMarketing = "_total_purchased_buy_asset_in_marketing" | |
59 | 59 | ||
60 | - | let | |
60 | + | let keyAmountBuyAssetInMarketingFinalized = "_total_purchased_buy_asset_in_marketing_finalized" | |
61 | 61 | ||
62 | - | let | |
62 | + | let keyTransferBuyAsset = "_transfer_buy_asset" | |
63 | 63 | ||
64 | 64 | let keyFreezSwopDuration = "_freeze_swop_duration" | |
65 | 65 | ||
66 | 66 | let keyFreezeAdditionalToken = "_freeze_additional_token" | |
67 | 67 | ||
68 | 68 | let keyFreezeTokenId = "_freeze_token_id" | |
69 | 69 | ||
70 | 70 | let keyFreezeTokenDuration = "_freeze_token_duration" | |
71 | 71 | ||
72 | 72 | let keyFreezeTokenPerTicket = "_freeze_token_per_ticket" | |
73 | 73 | ||
74 | + | let keyBuyToken = "_buy_token" | |
75 | + | ||
76 | + | let keyClaimParams = "_claim_params" | |
77 | + | ||
78 | + | let keyHighCompetitionComission = "_high_competition_comission" | |
79 | + | ||
80 | + | let keyHighCompetitionSale = "_high_competition_sale" | |
81 | + | ||
82 | + | let keyHCTicketLastNumber = "_high_competition_ticket_last_number" | |
83 | + | ||
84 | + | let keyHighCompetitionAmount = "_tickets_high_competition" | |
85 | + | ||
86 | + | let keyTotalAmountBuyAssetSoldHC = "_total_buy_asset_sold_high_competition" | |
87 | + | ||
88 | + | let keyUserClaimedTokens = "_claimed_tokens" | |
89 | + | ||
90 | + | let keyUserClaimedBuyTokens = "_claimed_buy_tokens" | |
91 | + | ||
74 | 92 | let keyUserBoughtTicketsAmount = "_bought_tickets" | |
75 | 93 | ||
76 | 94 | let keyUserTickets = "_tickets_number" | |
77 | 95 | ||
96 | + | let keyUserHCTickets = "_tickets_number_high_competition" | |
97 | + | ||
98 | + | let keyUserHCBoughtTicketsAmount = "_bought_tickets_high_competition" | |
99 | + | ||
78 | 100 | let keyUserAvailableAllocations = "_available_purchase_marketing" | |
79 | 101 | ||
80 | - | let | |
102 | + | let keyUserAmountBuyAssetInMarketing = "_purchased_buy_asset_in_marketing" | |
81 | 103 | ||
82 | 104 | let keyUserBoughtAllocations = "_bought_allocations" | |
83 | 105 | ||
84 | 106 | let keyUserClaimStatus = "_claim_status" | |
85 | 107 | ||
86 | 108 | let keyUserWinnedTicketsAmount = "_tickets_result" | |
87 | 109 | ||
110 | + | let keyUserWinnedHighCompetitionTicketsAmount = "_tickets_result_high_competition" | |
111 | + | ||
88 | 112 | let keyUserFreezeToken = "_freeze_token_amount" | |
89 | - | ||
90 | - | let lauchpadDuration = 10000 | |
91 | 113 | ||
92 | 114 | let oracle = Address(base58'3NBBWfzZtZtszaXbitTKnrB2xXwv26Bn7H9') | |
93 | 115 | ||
94 | 116 | let governance = Address(base58'3N5W8da2iiijVieA6qLGo7KzCJj8B19smWU') | |
95 | 117 | ||
96 | 118 | let commissionWallet = Address(base58'3N2hBdeDEs7wCNA9EY8qv3B6drjgKD64xQG') | |
97 | 119 | ||
98 | 120 | let stakingUSDNAddress = Address(base58'3N6q7sCGSSLBUXDdjBdYGTJbZGZfhhh8cNg') | |
99 | 121 | ||
100 | 122 | let USDN = base58'8UrfDVd5GreeUwm7uPk7eYz1eMv376kzR52C6sANPkwS' | |
101 | 123 | ||
102 | 124 | let adminPubKeyStaking = base58'Kn7NpzaG12dLZgcHf2ipUftU6hbJygmrhFqQYE4B7ZK' | |
103 | 125 | ||
104 | 126 | let maxAllocationsAmount = 2 | |
105 | - | ||
106 | - | let isActive = valueOrElse(getBoolean(this, keyActive), true) | |
107 | 127 | ||
108 | 128 | let activeLaunchpadId = valueOrElse(getIntegerValue(this, keyLaunchpadActiveId), -1) | |
109 | 129 | ||
110 | 130 | func getAdminPub (keyAdminPub) = match getString(oracle, keyAdminPub) { | |
111 | 131 | case string: String => | |
112 | 132 | fromBase58String(string) | |
113 | 133 | case nothing => | |
114 | 134 | throw("Admin public key is empty") | |
115 | 135 | } | |
116 | 136 | ||
117 | 137 | ||
118 | 138 | let adminPubKey1 = getAdminPub(keyAdminPubKey1) | |
119 | 139 | ||
120 | 140 | let adminPubKey2 = getAdminPub(keyAdminPubKey2) | |
121 | 141 | ||
122 | 142 | let adminPubKey3 = getAdminPub(keyAdminPubKey3) | |
123 | 143 | ||
124 | 144 | func getAssetInfo (assetId) = match assetId { | |
125 | 145 | case id: ByteVector => | |
126 | 146 | let stringId = toBase58String(id) | |
127 | 147 | let info = valueOrErrorMessage(assetInfo(id), (("Asset " + stringId) + " doesn't exist")) | |
128 | 148 | $Tuple3(stringId, info.name, info.decimals) | |
129 | 149 | case waves: Unit => | |
130 | 150 | $Tuple3("WAVES", "WAVES", 8) | |
131 | 151 | case _ => | |
132 | 152 | throw("Match error") | |
133 | 153 | } | |
134 | 154 | ||
135 | 155 | ||
136 | 156 | func getLaunchpadNextId () = valueOrElse(getInteger(this, keyLaunchpadNextId), 1) | |
137 | 157 | ||
138 | 158 | ||
139 | 159 | func stakedUsdnAmount () = valueOrElse(getInteger(stakingUSDNAddress, ((("rpd_balance_" + toBase58String(USDN)) + "_") + toString(this))), 0) | |
140 | 160 | ||
141 | 161 | ||
162 | + | let active = valueOrElse(getBoolean(this, keyActive), true) | |
163 | + | ||
164 | + | func isActive () = if (active) | |
165 | + | then unit | |
166 | + | else throw("DApp is inactive at this moment") | |
167 | + | ||
168 | + | ||
169 | + | func isAdminCall (i) = if (containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey)) | |
170 | + | then unit | |
171 | + | else throw("Only admin can call this function") | |
172 | + | ||
173 | + | ||
174 | + | func getAssetInfoFromString (assetStr) = if ((assetStr == "WAVES")) | |
175 | + | then $Tuple4(unit, "WAVES", "WAVES", 8) | |
176 | + | else { | |
177 | + | let stringId = assetStr | |
178 | + | let id = fromBase58String(assetStr) | |
179 | + | let info = valueOrErrorMessage(assetInfo(id), (("Asset " + stringId) + " doesn't exist")) | |
180 | + | $Tuple4(id, stringId, info.name, info.decimals) | |
181 | + | } | |
182 | + | ||
183 | + | ||
142 | 184 | @Callable(i) | |
143 | - | func hashingRandom (launchpadId,hash) = if (!(isActive)) | |
144 | - | then throw("DApp is inactive at this moment") | |
145 | - | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))) | |
146 | - | then throw("Only admin can call this function") | |
147 | - | else [StringEntry((toString(launchpadId) + keyVerifyHash), hash)] | |
185 | + | func hashingRandom (launchpadId,hash) = valueOrElse(isActive(), valueOrElse(isAdminCall(i), [StringEntry((toString(launchpadId) + keyVerifyHash), hash)])) | |
148 | 186 | ||
149 | 187 | ||
150 | 188 | ||
151 | 189 | @Callable(i) | |
152 | - | func initCaller (address) = if (!(isActive)) | |
153 | - | then throw("DApp is inactive at this moment") | |
154 | - | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))) | |
155 | - | then throw("Only admin can call this function") | |
156 | - | else [StringEntry(keyInitCaller, address)] | |
190 | + | func initCaller (address) = valueOrElse(isActive(), valueOrElse(isAdminCall(i), [StringEntry(keyInitCaller, address)])) | |
157 | 191 | ||
158 | 192 | ||
159 | 193 | ||
160 | 194 | @Callable(i) | |
161 | - | func init (projectAddress,startHeight,commission,tokensPerTicket,pricePerToken,swopfiTicketsAmount,campaignTokensAmount,tokensPerAllocation,swopPerTicket,swopFreezeDuration,freezeAdditionalToken,freezeParams) = if (!(isActive)) | |
162 | - | then throw("DApp is inactive at this moment") | |
163 | - | else if ((toString(i.caller) != valueOrElse(getString(this, keyInitCaller), ""))) | |
164 | - | then throw("Only project admin can call init function") | |
165 | - | else if ((size(i.payments) != 1)) | |
166 | - | then throw("One attached payment expected") | |
167 | - | else if ((height > startHeight)) | |
168 | - | then throw("Start height must be greater than blockchain height") | |
169 | - | else if (if (freezeAdditionalToken) | |
170 | - | then (size(freezeParams) != 3) | |
171 | - | else false) | |
172 | - | then throw("Freeze params list must have 3 items") | |
173 | - | else { | |
174 | - | let launchpadId = getLaunchpadNextId() | |
175 | - | let launchpadIdStr = toString(launchpadId) | |
176 | - | let $t053095384 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
177 | - | let pmtAmount = $t053095384._1 | |
178 | - | let pmtAssetId = $t053095384._2 | |
179 | - | let $t053935466 = getAssetInfo(pmtAssetId) | |
180 | - | let pmtStrAssetId = $t053935466._1 | |
181 | - | let pmtAssetName = $t053935466._2 | |
182 | - | let pmtDecimals = $t053935466._3 | |
183 | - | let freezeAdditionalEntry = if (freezeAdditionalToken) | |
184 | - | then [BooleanEntry((launchpadIdStr + keyFreezeAdditionalToken), true), StringEntry((launchpadIdStr + keyFreezeTokenId), freezeParams[0]), IntegerEntry((launchpadIdStr + keyFreezeTokenDuration), parseIntValue(freezeParams[1])), IntegerEntry((launchpadIdStr + keyFreezeTokenPerTicket), parseIntValue(freezeParams[2]))] | |
185 | - | else nil | |
186 | - | ([IntegerEntry((pmtStrAssetId + "_launchpad"), launchpadId), IntegerEntry(keyLaunchpadNextId, (launchpadId + 1)), StringEntry((launchpadIdStr + keyAddress), projectAddress), IntegerEntry((launchpadIdStr + keyInitHeight), height), IntegerEntry((launchpadIdStr + keyStartHeight), startHeight), IntegerEntry((launchpadIdStr + keyDuration), lauchpadDuration), IntegerEntry((launchpadIdStr + keyFreezSwopDuration), swopFreezeDuration), IntegerEntry((launchpadIdStr + keyTotalTokenAmount), pmtAmount), StringEntry((launchpadIdStr + keyAssetId), pmtStrAssetId), IntegerEntry((launchpadIdStr + keyComission), commission), IntegerEntry((launchpadIdStr + keyTicketLastNumber), 0), IntegerEntry((launchpadIdStr + keyTokensPerTicket), tokensPerTicket), IntegerEntry((launchpadIdStr + keyPricePerToken), pricePerToken), IntegerEntry((launchpadIdStr + keySwopPerTicket), swopPerTicket), IntegerEntry((launchpadIdStr + keySwopfiTicketsAmount), swopfiTicketsAmount), IntegerEntry((launchpadIdStr + keyCampaignTokensAmount), campaignTokensAmount), IntegerEntry((launchpadIdStr + keyTokensPerAllocation), tokensPerAllocation), IntegerEntry(keyLaunchpadActiveId, launchpadId), StringEntry(keyInitCaller, "")] ++ freezeAdditionalEntry) | |
187 | - | } | |
195 | + | func init (projectAddress,startHeight,duration,buyToken,commission,tokensPerTicket,pricePerToken,swopfiTicketsAmount,campaignTokensAmount,tokensPerAllocation,swopPerTicket,swopFreezeDuration,claimParams,HighCompetitionSale,highCompetitionComission,highCompetitionTicketsAmount,freezeAdditionalToken,freezeParams) = valueOrElse(isActive(), if ((toString(i.caller) != valueOrElse(getString(this, keyInitCaller), ""))) | |
196 | + | then throw("Only project admin can call init function") | |
197 | + | else if ((size(i.payments) != 1)) | |
198 | + | then throw("One attached payment expected") | |
199 | + | else if ((height > startHeight)) | |
200 | + | then throw("Start height must be greater than blockchain height") | |
201 | + | else if (if (freezeAdditionalToken) | |
202 | + | then (size(freezeParams) != 3) | |
203 | + | else false) | |
204 | + | then throw("Freeze params list must have 3 items") | |
205 | + | else { | |
206 | + | let launchpadId = getLaunchpadNextId() | |
207 | + | let launchpadIdStr = toString(launchpadId) | |
208 | + | let $t064026477 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
209 | + | let pmtAmount = $t064026477._1 | |
210 | + | let pmtAssetId = $t064026477._2 | |
211 | + | let $t064866559 = getAssetInfo(pmtAssetId) | |
212 | + | let pmtStrAssetId = $t064866559._1 | |
213 | + | let pmtAssetName = $t064866559._2 | |
214 | + | let pmtDecimals = $t064866559._3 | |
215 | + | let freezeAdditionalEntry = if (freezeAdditionalToken) | |
216 | + | then [BooleanEntry((launchpadIdStr + keyFreezeAdditionalToken), true), StringEntry((launchpadIdStr + keyFreezeTokenId), freezeParams[0]), IntegerEntry((launchpadIdStr + keyFreezeTokenDuration), parseIntValue(freezeParams[1])), IntegerEntry((launchpadIdStr + keyFreezeTokenPerTicket), parseIntValue(freezeParams[2]))] | |
217 | + | else nil | |
218 | + | ([IntegerEntry((pmtStrAssetId + "_launchpad"), launchpadId), IntegerEntry(keyLaunchpadNextId, (launchpadId + 1)), StringEntry((launchpadIdStr + keyAddress), projectAddress), IntegerEntry((launchpadIdStr + keyInitHeight), height), IntegerEntry((launchpadIdStr + keyStartHeight), startHeight), IntegerEntry((launchpadIdStr + keyDuration), duration), StringEntry((launchpadIdStr + keyBuyToken), buyToken), IntegerEntry((launchpadIdStr + keyFreezSwopDuration), swopFreezeDuration), IntegerEntry((launchpadIdStr + keyTotalTokenAmount), pmtAmount), StringEntry((launchpadIdStr + keyAssetId), pmtStrAssetId), IntegerEntry((launchpadIdStr + keyComission), commission), IntegerEntry((launchpadIdStr + keyTicketLastNumber), 0), IntegerEntry((launchpadIdStr + keyHCTicketLastNumber), 0), IntegerEntry((launchpadIdStr + keyTokensPerTicket), tokensPerTicket), IntegerEntry((launchpadIdStr + keyPricePerToken), pricePerToken), IntegerEntry((launchpadIdStr + keySwopPerTicket), swopPerTicket), IntegerEntry((launchpadIdStr + keySwopfiTicketsAmount), swopfiTicketsAmount), IntegerEntry((launchpadIdStr + keyCampaignTokensAmount), campaignTokensAmount), IntegerEntry((launchpadIdStr + keyTokensPerAllocation), tokensPerAllocation), StringEntry((launchpadIdStr + keyClaimParams), makeString(claimParams, ",")), BooleanEntry((launchpadIdStr + keyHighCompetitionSale), HighCompetitionSale), IntegerEntry((launchpadIdStr + keyHighCompetitionComission), highCompetitionComission), IntegerEntry((launchpadIdStr + keyHighCompetitionAmount), highCompetitionTicketsAmount), IntegerEntry(keyLaunchpadActiveId, launchpadId), StringEntry(keyInitCaller, "")] ++ freezeAdditionalEntry) | |
219 | + | }) | |
188 | 220 | ||
189 | 221 | ||
190 | 222 | ||
191 | 223 | @Callable(i) | |
192 | - | func commitSwopfiSale (launchpadId,refId) = { | |
193 | - | let $t075377612 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
194 | - | let pmtAmount = $t075377612._1 | |
195 | - | let pmtAssetId = $t075377612._2 | |
196 | - | let stakedSwops = valueOrElse(getInteger(governance, (toString(i.caller) + keyGovernanceStaked)), 0) | |
197 | - | let allowedTicketsAmountAll = (stakedSwops / getIntegerValue(this, (toString(launchpadId) + keySwopPerTicket))) | |
198 | - | let boughtTicketsAmount = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserBoughtTicketsAmount)), 0) | |
199 | - | let allowedTicketsAmount = (allowedTicketsAmountAll - boughtTicketsAmount) | |
200 | - | let startHeight = value(getInteger(this, (toString(launchpadId) + keyStartHeight))) | |
201 | - | let duration = value(getInteger(this, (toString(launchpadId) + keyDuration))) | |
202 | - | let freezeAdditionalToken = valueOrElse(getBoolean(this, (toString(launchpadId) + keyFreezeAdditionalToken)), false) | |
203 | - | if (!(isActive)) | |
204 | - | then throw("DApp is inactive at this moment") | |
205 | - | else if ((activeLaunchpadId != launchpadId)) | |
206 | - | then throw("There is no active launchpad or this launchpad is ended") | |
207 | - | else if ((startHeight > height)) | |
208 | - | then throw("Launchpad sale not started yet") | |
209 | - | else if ((height > (startHeight + duration))) | |
210 | - | then throw("Launchpad sale ended") | |
211 | - | else if (if (!(freezeAdditionalToken)) | |
212 | - | then if ((size(i.payments) != 1)) | |
213 | - | then true | |
214 | - | else (pmtAssetId != USDN) | |
215 | - | else false) | |
216 | - | then throw("One attached payment in USDN expected") | |
217 | - | else if (if (freezeAdditionalToken) | |
218 | - | then if ((size(i.payments) != 2)) | |
219 | - | then true | |
220 | - | else (pmtAssetId != USDN) | |
221 | - | else false) | |
222 | - | then { | |
223 | - | let freezeTokenId = getStringValue(this, (toString(launchpadId) + keyFreezeTokenId)) | |
224 | - | throw(("Two attached payments expected: First in USDN, second in " + freezeTokenId)) | |
225 | - | } | |
226 | - | else if (if ((0 >= allowedTicketsAmountAll)) | |
227 | - | then true | |
228 | - | else (0 >= allowedTicketsAmount)) | |
229 | - | then throw("Not enought SWOP in staking to buy tickets") | |
230 | - | else { | |
231 | - | let tokenPrice = getIntegerValue(this, (toString(launchpadId) + keyPricePerToken)) | |
232 | - | let tokensPerTicket = getIntegerValue(this, (toString(launchpadId) + keyTokensPerTicket)) | |
233 | - | let tokenId = fromBase58String(getStringValue(this, (toString(launchpadId) + keyAssetId))) | |
234 | - | let $t095549630 = getAssetInfo(tokenId) | |
235 | - | let tokenStrAssetId = $t095549630._1 | |
236 | - | let tokenAssetName = $t095549630._2 | |
237 | - | let tokenDecimals = $t095549630._3 | |
238 | - | let ticketPrice = fraction(tokensPerTicket, tokenPrice, pow(10, 0, tokenDecimals, 0, 0, DOWN)) | |
239 | - | let commissionPerTicket = fraction(ticketPrice, getIntegerValue(this, (toString(launchpadId) + keyComission)), 100) | |
240 | - | let buyTicketAmount = (pmtAmount / (ticketPrice + commissionPerTicket)) | |
241 | - | let allowedBuyTicketAmount = min([buyTicketAmount, allowedTicketsAmount]) | |
242 | - | let allowedBuyPriceWithComission = (allowedBuyTicketAmount * (ticketPrice + commissionPerTicket)) | |
243 | - | let change = (pmtAmount - allowedBuyPriceWithComission) | |
244 | - | if ((buyTicketAmount == 0)) | |
245 | - | then throw("Not enought USDN to buy tickets") | |
246 | - | else if ((change != 0)) | |
247 | - | then throw((((("Wrong payment. To buy " + toString(allowedBuyTicketAmount)) + "tickets you need to pay ") + toString(allowedBuyPriceWithComission)) + "USDN")) | |
248 | - | else { | |
249 | - | let freezeAdditionalEntry = if (freezeAdditionalToken) | |
250 | - | then { | |
251 | - | let freezeTokenId = getStringValue(this, (toString(launchpadId) + keyFreezeTokenId)) | |
252 | - | let freezeTokenPerTicket = getIntegerValue(this, (toString(launchpadId) + keyFreezeTokenPerTicket)) | |
253 | - | let $t01077210859 = $Tuple2(i.payments[1].amount, i.payments[1].assetId) | |
254 | - | let pmtAmountFreeze = $t01077210859._1 | |
255 | - | let pmtAssetIdFreeze = $t01077210859._2 | |
256 | - | let $t01087610967 = getAssetInfo(pmtAssetId) | |
257 | - | let pmtFreezeStrAssetId = $t01087610967._1 | |
258 | - | let pmtFreezeAssetName = $t01087610967._2 | |
259 | - | let pmtFreezeDecimals = $t01087610967._3 | |
260 | - | let needFreezeTokens = (freezeTokenPerTicket * buyTicketAmount) | |
261 | - | if (if ((pmtFreezeStrAssetId != freezeTokenId)) | |
262 | - | then true | |
263 | - | else (needFreezeTokens != pmtAmountFreeze)) | |
264 | - | then throw((((("You need to add " + toString(needFreezeTokens)) + " ") + pmtFreezeAssetName) + " as a second payment")) | |
265 | - | else [IntegerEntry((((toString(i.caller) + "_") + toString(launchpadId)) + keyUserFreezeToken), pmtAmountFreeze)] | |
266 | - | } | |
267 | - | else nil | |
268 | - | let userBoughtTicketsNumbers = valueOrElse(getString(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserTickets)), "") | |
269 | - | let lastBoughtTicketNumber = getIntegerValue(this, (toString(launchpadId) + keyTicketLastNumber)) | |
270 | - | let boughtRange = ((toString((lastBoughtTicketNumber + 1)) + "-") + toString((lastBoughtTicketNumber + allowedBuyTicketAmount))) | |
271 | - | let newUserBoughtTicketsNumbers = (userBoughtTicketsNumbers + (if ((userBoughtTicketsNumbers != "")) | |
272 | - | then ("," + boughtRange) | |
273 | - | else ("" + boughtRange))) | |
274 | - | let inv = invoke(stakingUSDNAddress, "lockNeutrino", nil, [AttachedPayment(pmtAssetId, pmtAmount)]) | |
275 | - | if ((inv == inv)) | |
276 | - | then { | |
277 | - | let baseEntry = ([IntegerEntry((((toString(i.caller) + "_") + toString(launchpadId)) + keyUserBoughtTicketsAmount), (boughtTicketsAmount + allowedBuyTicketAmount)), IntegerEntry((toString(launchpadId) + keyTicketLastNumber), (lastBoughtTicketNumber + allowedBuyTicketAmount)), StringEntry((((toString(i.caller) + "_") + toString(launchpadId)) + keyUserTickets), newUserBoughtTicketsNumbers)] ++ freezeAdditionalEntry) | |
278 | - | if (!(isDefined(getString(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserRefId))))) | |
279 | - | then (baseEntry ++ [StringEntry((((toString(i.caller) + "_") + toString(launchpadId)) + keyUserRefId), refId)]) | |
280 | - | else baseEntry | |
281 | - | } | |
282 | - | else throw("Strict value is not equal to itself.") | |
283 | - | } | |
284 | - | } | |
285 | - | } | |
224 | + | func finalise (launchpadId,vrfHeight,secretWord) = valueOrElse(isActive(), valueOrElse(isAdminCall(i), { | |
225 | + | let savedHash = getStringValue(this, (toString(launchpadId) + keyVerifyHash)) | |
226 | + | let calcHash = toBase58String(sha256((toBytes(vrfHeight) + toBytes(secretWord)))) | |
227 | + | if ((calcHash != savedHash)) | |
228 | + | then throw("vrf Height hash not matching") | |
229 | + | else { | |
230 | + | let $t094659615 = getAssetInfoFromString(value(getString(this, (toString(launchpadId) + keyBuyToken)))) | |
231 | + | let buyAssetId = $t094659615._1 | |
232 | + | let buyAssetStrId = $t094659615._2 | |
233 | + | let buyAssetName = $t094659615._3 | |
234 | + | let buyAssetDecimals = $t094659615._4 | |
235 | + | let projectAddress = addressFromStringValue(getStringValue(this, (toString(launchpadId) + keyAddress))) | |
236 | + | let commission = getIntegerValue(this, (toString(launchpadId) + keyComission)) | |
237 | + | let commissionHC = getIntegerValue(this, (toString(launchpadId) + keyHighCompetitionComission)) | |
238 | + | let transferedBuyAsset = valueOrElse(getInteger(this, (toString(launchpadId) + keyTransferBuyAsset)), 0) | |
239 | + | let swopfiMembersBuyAssetAmount = getIntegerValue(this, (toString(launchpadId) + keyTotalAmountBuyAssetSold)) | |
240 | + | let swopfiHCBuyAssetAmount = valueOrElse(getIntegerValue(this, (toString(launchpadId) + keyTotalAmountBuyAssetSoldHC)), 0) | |
241 | + | let swopfiMembersComission = fraction(swopfiMembersBuyAssetAmount, commission, 100) | |
242 | + | let swopfiHCComission = fraction(swopfiHCBuyAssetAmount, commissionHC, 100) | |
243 | + | let totalAmountBuyAssetInMarketing = getIntegerValue(this, (toString(launchpadId) + keyAmountBuyAssetInMarketingFinalized)) | |
244 | + | let marketingComission = fraction(totalAmountBuyAssetInMarketing, commission, 100) | |
245 | + | let unstakeAmount = (((((swopfiMembersBuyAssetAmount + totalAmountBuyAssetInMarketing) + swopfiMembersComission) + marketingComission) + swopfiHCBuyAssetAmount) + swopfiHCComission) | |
246 | + | if ((transferedBuyAsset > (swopfiMembersBuyAssetAmount + totalAmountBuyAssetInMarketing))) | |
247 | + | then throw("Can't transfer negative value to project") | |
248 | + | else { | |
249 | + | let inv = if ((buyAssetId == USDN)) | |
250 | + | then invoke(stakingUSDNAddress, "unlockNeutrino", [unstakeAmount, toBase58String(USDN)], nil) | |
251 | + | else 0 | |
252 | + | if ((inv == inv)) | |
253 | + | then [IntegerEntry((toString(launchpadId) + keyFinaliseHeight), height), ScriptTransfer(projectAddress, (((swopfiMembersBuyAssetAmount + swopfiHCBuyAssetAmount) + totalAmountBuyAssetInMarketing) - transferedBuyAsset), buyAssetId), ScriptTransfer(commissionWallet, ((swopfiMembersComission + marketingComission) + swopfiHCComission), buyAssetId)] | |
254 | + | else throw("Strict value is not equal to itself.") | |
255 | + | } | |
256 | + | } | |
257 | + | })) | |
286 | 258 | ||
287 | 259 | ||
288 | 260 | ||
289 | 261 | @Callable(i) | |
290 | - | func commitAccessListSale (launchpadId,refId) = { | |
291 | - | let $t01295413029 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
292 | - | let pmtAmount = $t01295413029._1 | |
293 | - | let pmtAssetId = $t01295413029._2 | |
294 | - | let userUsdnInMarketing = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserAmountUSDNInMarketing)), 0) | |
295 | - | let usdnInMarketing = valueOrElse(getInteger(this, (toString(launchpadId) + keyAmountUSDNInMarketing)), 0) | |
262 | + | func claim (launchpadId) = valueOrElse(isActive(), { | |
263 | + | let boughtTickets = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserBoughtTicketsAmount)), 0) | |
264 | + | let boughtHCTickets = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserHCBoughtTicketsAmount)), 0) | |
296 | 265 | let boughtAllocations = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserBoughtAllocations)), 0) | |
297 | - | let commission = getIntegerValue(this, (toString(launchpadId) + keyComission)) | |
298 | - | let tokenPrice = getIntegerValue(this, (toString(launchpadId) + keyPricePerToken)) | |
299 | - | let tokensPerAllocation = getIntegerValue(this, (toString(launchpadId) + keyTokensPerAllocation)) | |
300 | - | let tokenId = fromBase58String(getStringValue(this, (toString(launchpadId) + keyAssetId))) | |
301 | - | let $t01378413860 = getAssetInfo(tokenId) | |
302 | - | let tokenStrAssetId = $t01378413860._1 | |
303 | - | let tokenAssetName = $t01378413860._2 | |
304 | - | let tokenDecimals = $t01378413860._3 | |
305 | - | let allocationPriceWithComission = fraction(fraction(tokenPrice, tokensPerAllocation, pow(10, 0, tokenDecimals, 0, 0, DOWN)), (100 + commission), 100) | |
306 | - | let startHeight = value(getInteger(this, (toString(launchpadId) + keyStartHeight))) | |
307 | - | let duration = value(getInteger(this, (toString(launchpadId) + keyDuration))) | |
308 | - | if (!(isActive)) | |
309 | - | then throw("DApp is inactive at this moment") | |
310 | - | else if ((activeLaunchpadId != launchpadId)) | |
311 | - | then throw("There is no active launchpad or this launchpad is ended") | |
312 | - | else if ((startHeight > height)) | |
313 | - | then throw("Launchpad sale not started yet") | |
314 | - | else if ((height > (startHeight + duration))) | |
315 | - | then throw("Launchpad sale ended") | |
316 | - | else if (if ((size(i.payments) != 1)) | |
266 | + | let userClaimStatus = valueOrElse(getBoolean(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserClaimStatus)), false) | |
267 | + | let finalizeHeight = valueOrElse(getInteger(this, (toString(launchpadId) + keyFinaliseHeight)), 0) | |
268 | + | if ((finalizeHeight == 0)) | |
269 | + | then throw("You can't claim because results are not finalized") | |
270 | + | else if (userClaimStatus) | |
271 | + | then throw("You are already claimed") | |
272 | + | else if (if (if ((boughtTickets == 0)) | |
273 | + | then (boughtAllocations == 0) | |
274 | + | else false) | |
275 | + | then (boughtHCTickets == 0) | |
276 | + | else false) | |
277 | + | then throw("You can't claim because you don't buy anything") | |
278 | + | else { | |
279 | + | let $t01266012810 = getAssetInfoFromString(value(getString(this, (toString(launchpadId) + keyBuyToken)))) | |
280 | + | let buyAssetId = $t01266012810._1 | |
281 | + | let buyAssetStrId = $t01266012810._2 | |
282 | + | let buyAssetName = $t01266012810._3 | |
283 | + | let buyAssetDecimals = $t01266012810._4 | |
284 | + | let wonnedTickets = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserWinnedTicketsAmount)), 0) | |
285 | + | let wonnedHCTickets = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserWinnedHighCompetitionTicketsAmount)), 0) | |
286 | + | let awailableAllocations = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserAvailableAllocations)), 0) | |
287 | + | let commission = getIntegerValue(this, (toString(launchpadId) + keyComission)) | |
288 | + | let commissionHC = getIntegerValue(this, (toString(launchpadId) + keyHighCompetitionComission)) | |
289 | + | let allowedAllocations = min([boughtAllocations, awailableAllocations]) | |
290 | + | let tokenPrice = getIntegerValue(this, (toString(launchpadId) + keyPricePerToken)) | |
291 | + | let tokensPerTicket = getIntegerValue(this, (toString(launchpadId) + keyTokensPerTicket)) | |
292 | + | let $t01371613860 = getAssetInfoFromString(getStringValue(this, (toString(launchpadId) + keyAssetId))) | |
293 | + | let tokenId = $t01371613860._1 | |
294 | + | let tokenStrAssetId = $t01371613860._2 | |
295 | + | let tokenAssetName = $t01371613860._3 | |
296 | + | let tokenDecimals = $t01371613860._4 | |
297 | + | let ticketPrice = fraction(tokensPerTicket, tokenPrice, pow(10, 0, tokenDecimals, 0, 0, DOWN)) | |
298 | + | let tokensPerAllocation = getIntegerValue(this, (toString(launchpadId) + keyTokensPerAllocation)) | |
299 | + | let transferTokensAmount = (((wonnedTickets * tokensPerTicket) + (allowedAllocations * tokensPerAllocation)) + (wonnedHCTickets * tokensPerTicket)) | |
300 | + | let notAllowedAllocationsTokens = ((boughtAllocations - allowedAllocations) * tokensPerAllocation) | |
301 | + | let buyAssetForAllocations = fraction(fraction(notAllowedAllocationsTokens, tokenPrice, pow(10, 0, tokenDecimals, 0, 0, DOWN)), (100 + commission), 100) | |
302 | + | let buyAssetForUnwonnedTickets = fraction(((boughtTickets - wonnedTickets) * ticketPrice), (100 + commission), 100) | |
303 | + | let buyAssetForHCUnwonnedTickets = fraction(((boughtHCTickets - wonnedHCTickets) * ticketPrice), (100 + commissionHC), 100) | |
304 | + | let claimedBuyToken = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserClaimedBuyTokens)), 0) | |
305 | + | if (if (if ((0 > buyAssetForAllocations)) | |
317 | 306 | then true | |
318 | - | else (pmtAssetId != USDN)) | |
319 | - | then throw("One attached payment in USDN expected") | |
320 | - | else if ((boughtAllocations >= maxAllocationsAmount)) | |
321 | - | then throw((("You can buy only " + toString(maxAllocationsAmount)) + "allocations")) | |
322 | - | else if (if ((allocationPriceWithComission != pmtAmount)) | |
323 | - | then ((allocationPriceWithComission * 2) != pmtAmount) | |
307 | + | else (0 > buyAssetForUnwonnedTickets)) | |
308 | + | then true | |
309 | + | else (0 > buyAssetForHCUnwonnedTickets)) | |
310 | + | then throw("Error with allowed allocation param or wonned tickets param please contact support") | |
311 | + | else { | |
312 | + | let returnedBuyAssetAmount = (((buyAssetForUnwonnedTickets + buyAssetForHCUnwonnedTickets) + buyAssetForAllocations) - claimedBuyToken) | |
313 | + | let transferBuyAsset = if ((returnedBuyAssetAmount > 0)) | |
314 | + | then [ScriptTransfer(i.caller, returnedBuyAssetAmount, buyAssetId), IntegerEntry((((toString(i.caller) + "_") + toString(launchpadId)) + keyUserClaimedBuyTokens), returnedBuyAssetAmount)] | |
315 | + | else nil | |
316 | + | let inv = if (if ((returnedBuyAssetAmount > 0)) | |
317 | + | then (buyAssetId == USDN) | |
324 | 318 | else false) | |
325 | - | then throw((("Wrong payment. You can buy 1 or 2 allocations for " + toString(allocationPriceWithComission)) + " USDN per allocation")) | |
326 | - | else { | |
327 | - | let buyAllocationsAmount = (pmtAmount / allocationPriceWithComission) | |
328 | - | let inv = invoke(stakingUSDNAddress, "lockNeutrino", nil, [AttachedPayment(pmtAssetId, pmtAmount)]) | |
329 | - | if ((inv == inv)) | |
319 | + | then invoke(stakingUSDNAddress, "unlockNeutrino", [returnedBuyAssetAmount, toBase58String(USDN)], nil) | |
320 | + | else 0 | |
321 | + | if ((inv == inv)) | |
322 | + | then { | |
323 | + | let claimedParams = split(valueOrElse(getString(this, (toString(launchpadId) + keyClaimParams)), ""), ",") | |
324 | + | if (if ((size(claimedParams) == 0)) | |
325 | + | then true | |
326 | + | else (claimedParams[0] == "claimAll")) | |
330 | 327 | then { | |
331 | - | let | |
332 | - | | |
333 | - | | |
334 | - | | |
328 | + | let transferTokens = if ((transferTokensAmount > 0)) | |
329 | + | then [ScriptTransfer(i.caller, transferTokensAmount, tokenId)] | |
330 | + | else nil | |
331 | + | (([BooleanEntry((((toString(i.caller) + "_") + toString(launchpadId)) + keyUserClaimStatus), true), IntegerEntry((((toString(i.caller) + "_") + toString(launchpadId)) + keyUserClaimedTokens), transferTokensAmount)] ++ transferTokens) ++ transferBuyAsset) | |
335 | 332 | } | |
336 | - | else throw("Strict value is not equal to itself.") | |
333 | + | else if ((claimedParams[0] == "claimPeriod")) | |
334 | + | then { | |
335 | + | let claimedTokens = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserClaimedTokens)), 0) | |
336 | + | let unlockPeriod = value(parseInt(claimedParams[2])) | |
337 | + | let blockHeight = (value(parseInt(claimedParams[3])) + finalizeHeight) | |
338 | + | let unlockHeight = (unlockPeriod + blockHeight) | |
339 | + | let allowedStartAmount = fraction(transferTokensAmount, value(parseInt(claimedParams[1])), 100) | |
340 | + | let allowedTokensAmount = (allowedStartAmount + (if ((height > blockHeight)) | |
341 | + | then (fraction((transferTokensAmount - allowedStartAmount), (min([height, unlockHeight]) - blockHeight), unlockPeriod) - claimedTokens) | |
342 | + | else (0 - claimedTokens))) | |
343 | + | let claimStatusEntry = if ((transferTokensAmount >= (claimedTokens + allowedTokensAmount))) | |
344 | + | then [BooleanEntry((((toString(i.caller) + "_") + toString(launchpadId)) + keyUserClaimStatus), true)] | |
345 | + | else nil | |
346 | + | if (if ((allowedTokensAmount > 0)) | |
347 | + | then true | |
348 | + | else (returnedBuyAssetAmount > 0)) | |
349 | + | then { | |
350 | + | let transferTokens = if ((allowedTokensAmount > 0)) | |
351 | + | then [IntegerEntry((((toString(i.caller) + "_") + toString(launchpadId)) + keyUserClaimedTokens), (claimedTokens + allowedTokensAmount)), ScriptTransfer(i.caller, allowedTokensAmount, tokenId)] | |
352 | + | else nil | |
353 | + | (transferBuyAsset ++ transferTokens) | |
354 | + | } | |
355 | + | else throw("Nothing to claim") | |
356 | + | } | |
357 | + | else throw("Unknown claim function") | |
337 | 358 | } | |
338 | - | } | |
359 | + | else throw("Strict value is not equal to itself.") | |
360 | + | } | |
361 | + | } | |
362 | + | }) | |
339 | 363 | ||
340 | 364 | ||
341 | 365 | ||
342 | 366 | @Callable(i) | |
343 | - | func finalise (launchpadId,vrfHeight,secretWord) = { | |
344 | - | let savedHash = getStringValue(this, (toString(launchpadId) + keyVerifyHash)) | |
345 | - | let calcHash = toBase58String(sha256((toBytes(vrfHeight) + toBytes(secretWord)))) | |
346 | - | if (!(isActive)) | |
347 | - | then throw("DApp is inactive at this moment") | |
348 | - | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))) | |
349 | - | then throw("Only admin can call this function") | |
350 | - | else if ((calcHash != savedHash)) | |
351 | - | then throw("vrf Height hash not matching") | |
352 | - | else { | |
353 | - | let projectAddress = addressFromStringValue(getStringValue(this, (toString(launchpadId) + keyAddress))) | |
354 | - | let commission = getIntegerValue(this, (toString(launchpadId) + keyComission)) | |
355 | - | let transferedUsdn = valueOrElse(getInteger(this, (toString(launchpadId) + keyTransferUsd)), 0) | |
356 | - | let swopfiMembersUsdnAmount = getIntegerValue(this, (toString(launchpadId) + keyTotalAmountUsdnSold)) | |
357 | - | let swopfiMembersComission = fraction(swopfiMembersUsdnAmount, commission, 100) | |
358 | - | let totalAmountUsdnInMarketing = getIntegerValue(this, (toString(launchpadId) + keyAmountUSDNInMarketingFinalized)) | |
359 | - | let marketingComission = fraction(totalAmountUsdnInMarketing, commission, 100) | |
360 | - | let unstakeAmount = (((swopfiMembersUsdnAmount + totalAmountUsdnInMarketing) + swopfiMembersComission) + marketingComission) | |
361 | - | if ((transferedUsdn > (swopfiMembersUsdnAmount + totalAmountUsdnInMarketing))) | |
362 | - | then throw("Can't transfer negative value to project") | |
363 | - | else { | |
364 | - | let inv = invoke(stakingUSDNAddress, "unlockNeutrino", [unstakeAmount, toBase58String(USDN)], nil) | |
365 | - | if ((inv == inv)) | |
366 | - | then [IntegerEntry((toString(launchpadId) + keyFinaliseHeight), height), ScriptTransfer(projectAddress, ((swopfiMembersUsdnAmount + totalAmountUsdnInMarketing) - transferedUsdn), USDN), ScriptTransfer(commissionWallet, (swopfiMembersComission + marketingComission), USDN)] | |
367 | - | else throw("Strict value is not equal to itself.") | |
368 | - | } | |
369 | - | } | |
370 | - | } | |
367 | + | func claimFreezeToken (launchpadId) = valueOrElse(isActive(), { | |
368 | + | let freezeAdditionalToken = valueOrElse(getBoolean(this, (toString(launchpadId) + keyFreezeAdditionalToken)), false) | |
369 | + | if (!(isDefined(getInteger(this, (toString(launchpadId) + keyFinaliseHeight))))) | |
370 | + | then throw("You can't claim because results are not finalized") | |
371 | + | else if (!(freezeAdditionalToken)) | |
372 | + | then throw("There are no additional token freezing for this launchpad") | |
373 | + | else { | |
374 | + | let tokenId = fromBase58String(getStringValue(this, (toString(launchpadId) + keyFreezeTokenId))) | |
375 | + | let userTokensFreezed = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserFreezeToken)), 0) | |
376 | + | let startHeight = valueOrElse(getInteger(this, (toString(launchpadId) + keyStartHeight)), 0) | |
377 | + | let duration = valueOrElse(getInteger(this, (toString(launchpadId) + keyDuration)), 0) | |
378 | + | let freezeTokenDuration = getIntegerValue(this, (toString(launchpadId) + keyFreezeTokenDuration)) | |
379 | + | let blockEndHeight = ((startHeight + duration) + freezeTokenDuration) | |
380 | + | if ((userTokensFreezed == 0)) | |
381 | + | then throw("You are already claimed your tokens or not paid anything") | |
382 | + | else if ((blockEndHeight > height)) | |
383 | + | then throw(("Your tokens freezed teel " + toString(blockEndHeight))) | |
384 | + | else [ScriptTransfer(i.caller, userTokensFreezed, tokenId), IntegerEntry((((toString(i.caller) + "_") + toString(launchpadId)) + keyUserFreezeToken), 0)] | |
385 | + | } | |
386 | + | }) | |
371 | 387 | ||
372 | 388 | ||
373 | 389 | ||
374 | 390 | @Callable(i) | |
375 | - | func claim (launchpadId) = { | |
376 | - | let userClaimStatus = valueOrElse(getBoolean(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserClaimStatus)), false) | |
377 | - | let boughtTickets = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserBoughtTicketsAmount)), 0) | |
378 | - | let boughtAllocations = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserBoughtAllocations)), 0) | |
379 | - | if (!(isActive)) | |
380 | - | then throw("DApp is inactive at this moment") | |
381 | - | else if (!(isDefined(getInteger(this, (toString(launchpadId) + keyFinaliseHeight))))) | |
382 | - | then throw("You can't claim because results are not finalized") | |
383 | - | else if (userClaimStatus) | |
384 | - | then throw("You are already claimed") | |
385 | - | else if (if ((boughtTickets == 0)) | |
386 | - | then (boughtAllocations == 0) | |
387 | - | else false) | |
388 | - | then throw("You can't claim because you don't buy anything") | |
389 | - | else { | |
390 | - | let tokenId = fromBase58String(getStringValue(this, (toString(launchpadId) + keyAssetId))) | |
391 | - | let wonnedTickets = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserWinnedTicketsAmount)), 0) | |
392 | - | let awailableAllocations = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserAvailableAllocations)), 0) | |
393 | - | let commission = getIntegerValue(this, (toString(launchpadId) + keyComission)) | |
394 | - | let allowedAllocations = min([boughtAllocations, awailableAllocations]) | |
395 | - | let tokenPrice = getIntegerValue(this, (toString(launchpadId) + keyPricePerToken)) | |
396 | - | let tokensPerTicket = getIntegerValue(this, (toString(launchpadId) + keyTokensPerTicket)) | |
397 | - | let $t01963419710 = getAssetInfo(tokenId) | |
398 | - | let tokenStrAssetId = $t01963419710._1 | |
399 | - | let tokenAssetName = $t01963419710._2 | |
400 | - | let tokenDecimals = $t01963419710._3 | |
401 | - | let ticketPrice = fraction(tokensPerTicket, tokenPrice, pow(10, 0, tokenDecimals, 0, 0, DOWN)) | |
402 | - | let tokensPerAllocation = getIntegerValue(this, (toString(launchpadId) + keyTokensPerAllocation)) | |
403 | - | let transferTokensAmount = ((wonnedTickets * tokensPerTicket) + (allowedAllocations * tokensPerAllocation)) | |
404 | - | let notAllowedAllocationsTokens = ((boughtAllocations - allowedAllocations) * tokensPerAllocation) | |
405 | - | let usdnForAllocations = fraction(fraction(notAllowedAllocationsTokens, tokenPrice, pow(10, 0, tokenDecimals, 0, 0, DOWN)), (100 + commission), 100) | |
406 | - | let usdnForUnwonnedTickets = fraction(((boughtTickets - wonnedTickets) * ticketPrice), (100 + commission), 100) | |
407 | - | if (if ((0 > usdnForAllocations)) | |
408 | - | then true | |
409 | - | else (0 > usdnForUnwonnedTickets)) | |
410 | - | then throw("Error with allowed allocation param or wonned tickets param please contact support") | |
411 | - | else { | |
412 | - | let returnedUsdnAmount = (usdnForAllocations + usdnForUnwonnedTickets) | |
413 | - | let transferUsdn = if ((returnedUsdnAmount > 0)) | |
414 | - | then [ScriptTransfer(i.caller, returnedUsdnAmount, USDN)] | |
415 | - | else nil | |
416 | - | let transferTokens = if ((transferTokensAmount > 0)) | |
417 | - | then [ScriptTransfer(i.caller, transferTokensAmount, tokenId)] | |
418 | - | else nil | |
419 | - | let inv = if ((returnedUsdnAmount > 0)) | |
420 | - | then invoke(stakingUSDNAddress, "unlockNeutrino", [returnedUsdnAmount, toBase58String(USDN)], nil) | |
421 | - | else 0 | |
422 | - | if ((inv == inv)) | |
423 | - | then (([BooleanEntry((((toString(i.caller) + "_") + toString(launchpadId)) + keyUserClaimStatus), true)] ++ transferTokens) ++ transferUsdn) | |
424 | - | else throw("Strict value is not equal to itself.") | |
425 | - | } | |
426 | - | } | |
427 | - | } | |
391 | + | func transferBuyAsset (launchpadId,amount) = valueOrElse(isActive(), valueOrElse(isAdminCall(i), { | |
392 | + | let projectAddress = addressFromStringValue(getStringValue(this, (toString(launchpadId) + keyAddress))) | |
393 | + | let $t02006620216 = getAssetInfoFromString(value(getString(this, (toString(launchpadId) + keyBuyToken)))) | |
394 | + | let buyAssetId = $t02006620216._1 | |
395 | + | let buyAssetStrId = $t02006620216._2 | |
396 | + | let buyAssetName = $t02006620216._3 | |
397 | + | let buyAssetDecimals = $t02006620216._4 | |
398 | + | [IntegerEntry((toString(launchpadId) + keyTransferBuyAsset), amount), ScriptTransfer(projectAddress, amount, buyAssetId)] | |
399 | + | })) | |
428 | 400 | ||
429 | 401 | ||
430 | 402 | ||
431 | 403 | @Callable(i) | |
432 | - | func claimFreezeToken (launchpadId) = { | |
433 | - | let freezeAdditionalToken = valueOrElse(getBoolean(this, (toString(launchpadId) + keyFreezeAdditionalToken)), false) | |
434 | - | if (!(isActive)) | |
435 | - | then throw("DApp is inactive at this moment") | |
436 | - | else if (!(isDefined(getInteger(this, (toString(launchpadId) + keyFinaliseHeight))))) | |
437 | - | then throw("You can't claim because results are not finalized") | |
438 | - | else if (!(freezeAdditionalToken)) | |
439 | - | then throw("There are no additional token freezing for this launchpad") | |
440 | - | else { | |
441 | - | let tokenId = fromBase58String(getStringValue(this, (toString(launchpadId) + keyFreezeTokenId))) | |
442 | - | let userTokensFreezed = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserFreezeToken)), 0) | |
443 | - | let startHeight = valueOrElse(getInteger(this, (toString(launchpadId) + keyStartHeight)), 0) | |
444 | - | let duration = valueOrElse(getInteger(this, (toString(launchpadId) + keyDuration)), 0) | |
445 | - | let freezeTokenDuration = getIntegerValue(this, (toString(launchpadId) + keyFreezeTokenDuration)) | |
446 | - | let blockEndHeight = ((startHeight + duration) + freezeTokenDuration) | |
447 | - | if ((userTokensFreezed == 0)) | |
448 | - | then throw("You are already claimed your tokens or not paid anything") | |
449 | - | else if ((blockEndHeight > height)) | |
450 | - | then throw(("Your tokens freezed teel " + toString(blockEndHeight))) | |
451 | - | else [ScriptTransfer(i.caller, userTokensFreezed, tokenId), IntegerEntry((((toString(i.caller) + "_") + toString(launchpadId)) + keyUserFreezeToken), 0)] | |
452 | - | } | |
453 | - | } | |
404 | + | func shutdown () = valueOrElse(isAdminCall(i), if (!(active)) | |
405 | + | then throw("DApp already inactive") | |
406 | + | else [BooleanEntry(keyActive, false)]) | |
454 | 407 | ||
455 | 408 | ||
456 | 409 | ||
457 | 410 | @Callable(i) | |
458 | - | func transferUsd (launchpadId,amountUsdn) = if (!(isActive)) | |
459 | - | then throw("DApp is inactive") | |
460 | - | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))) | |
461 | - | then throw("Only admin can call this function") | |
462 | - | else { | |
463 | - | let projectAddress = addressFromStringValue(getStringValue(this, (toString(launchpadId) + keyAddress))) | |
464 | - | [IntegerEntry((toString(launchpadId) + keyTransferUsd), amountUsdn), ScriptTransfer(projectAddress, amountUsdn, USDN)] | |
465 | - | } | |
466 | - | ||
467 | - | ||
468 | - | ||
469 | - | @Callable(i) | |
470 | - | func shutdown () = if (!(isActive)) | |
471 | - | then throw("DApp already inactive") | |
472 | - | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))) | |
473 | - | then throw("Only admin can call this function") | |
474 | - | else [BooleanEntry(keyActive, false)] | |
475 | - | ||
476 | - | ||
477 | - | ||
478 | - | @Callable(i) | |
479 | - | func activate () = if (isActive) | |
411 | + | func activate () = valueOrElse(isAdminCall(i), if (active) | |
480 | 412 | then throw("DApp already active") | |
481 | - | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))) | |
482 | - | then throw("Only admin can call this function") | |
483 | - | else [BooleanEntry(keyActive, true)] | |
413 | + | else [BooleanEntry(keyActive, true)]) | |
484 | 414 | ||
485 | 415 | ||
486 | 416 | @Verifier(tx) | |
487 | 417 | func verify () = { | |
488 | 418 | let multiSignedByAdmins = { | |
489 | 419 | let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
490 | 420 | then 1 | |
491 | 421 | else 0 | |
492 | 422 | let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], adminPubKey2)) | |
493 | 423 | then 1 | |
494 | 424 | else 0 | |
495 | 425 | let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], adminPubKey3)) | |
496 | 426 | then 1 | |
497 | 427 | else 0 | |
498 | 428 | (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2) | |
499 | 429 | } | |
500 | 430 | let signedByAdmin = if (if (if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
501 | 431 | then true | |
502 | 432 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey2)) | |
503 | 433 | then true | |
504 | 434 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey3)) | |
505 | 435 | then true | |
506 | 436 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKeyStaking) | |
507 | 437 | match tx { | |
508 | 438 | case dtx: DataTransaction => | |
509 | 439 | if (valueOrElse(getBoolean(oracle, keyLaunchpadDataTransactionStatus), false)) | |
510 | 440 | then signedByAdmin | |
511 | 441 | else false | |
512 | 442 | case _ => | |
513 | 443 | multiSignedByAdmins | |
514 | 444 | } | |
515 | 445 | } | |
516 | 446 |
github/deemru/w8io/026f985 86.92 ms ◑