tx · 9mHKMvrGPfnbPCYKVdf2n5RZQ36bMNzkUgqCkQsP81Tw 3MzDGFvPnXVbA4wCacqcVnfVJPwG952KVAg: -0.01400000 Waves 2022.01.31 23:11 [1903576] smart account 3MzDGFvPnXVbA4wCacqcVnfVJPwG952KVAg > SELF 0.00000000 Waves
{ "type": 13, "id": "9mHKMvrGPfnbPCYKVdf2n5RZQ36bMNzkUgqCkQsP81Tw", "fee": 1400000, "feeAssetId": null, "timestamp": 1643659929078, "version": 2, "chainId": 84, "sender": "3MzDGFvPnXVbA4wCacqcVnfVJPwG952KVAg", "senderPublicKey": "CViCXhHrygDDAtVc1uFczxe6ANj9tBz5PGQDS1yWZqgy", "proofs": [ "3WjWXWr6nbyAteBzyToF2Yk8VWJAtaP6DL1112fpfoEVyZGWbmwfnsrgvrykxk4jojGdAEVhuB9UMxVdcGR7CPAD", "3Y4YNUGtYsCuLYvX9Ac7go9SUn1BjcxBXWbQKHWJrbfSDW5ZXXS78JULBA3TKwDMr5NS3hxZ6khRMNUAhD6kkseP" ], "script": "base64:AAIFAAAAAAAAAEQIAhIECgIBCBIDCgEIEg4KDAgBAQEBAQEBAQEEGBIECgIBCBIECgIBCBIFCgMBAQgSAwoBARIDCgEBEgQKAgEBEgASAAAAADwAAAAACWtleUFjdGl2ZQIAAAAGYWN0aXZlAAAAAA9rZXlBZG1pblB1YktleTECAAAAC2FkbWluX3B1Yl8xAAAAAA9rZXlBZG1pblB1YktleTICAAAAC2FkbWluX3B1Yl8yAAAAAA9rZXlBZG1pblB1YktleTMCAAAAC2FkbWluX3B1Yl8zAAAAACFrZXlMYXVuY2hwYWREYXRhVHJhbnNhY3Rpb25TdGF0dXMCAAAAIWxhdW5jaHBhZF9kYXRhX3RyYW5zYWN0aW9uX3N0YXR1cwAAAAASa2V5TGF1bmNocGFkTmV4dElkAgAAABFsYXVuY2hwYWRfbmV4dF9pZAAAAAAUa2V5TGF1bmNocGFkQWN0aXZlSWQCAAAAE2xhdW5jaHBhZF9hY3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J0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAUAAAAMYWRtaW5QdWJLZXkxBgkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAFAAAADGFkbWluUHViS2V5MgYJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAABQAAAAxhZG1pblB1YktleTMGCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAUAAAASYWRtaW5QdWJLZXlTdGFraW5nBAAAAAckbWF0Y2gwBQAAAAJ0eAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAPRGF0YVRyYW5zYWN0aW9uBAAAAANkdHgFAAAAByRtYXRjaDADCQEAAAALdmFsdWVPckVsc2UAAAACCQAEGwAAAAIFAAAABm9yYWNsZQUAAAAha2V5TGF1bmNocGFkRGF0YVRyYW5zYWN0aW9uU3RhdHVzBwUAAAANc2lnbmVkQnlBZG1pbgcFAAAAE211bHRpU2lnbmVkQnlBZG1pbnNol9vl", "height": 1903576, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4puStn8Q2sHKhtfHR53pEhkTF7zhMbRQx1oxQSTHYafu Next: 9aKgg1s6G6M8LggGuanE44ip2HmKyDdX1eSzcVdUr6Cn Diff:
Old | New | Differences | |
---|---|---|---|
31 | 31 | ||
32 | 32 | let keyTotalTokenAmount = "_total_token_amount" | |
33 | 33 | ||
34 | - | let | |
34 | + | let keyTotalAmountUsdnSold = "_total_usdn_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 keyAmountUSDNInMarketing = "_total_purchased_usdn_in_marketing" | |
59 | 59 | ||
60 | - | let | |
60 | + | let keyAmountUSDNInMarketingFinalized = "_total_purchased_usdn_in_marketing_finalized" | |
61 | 61 | ||
62 | - | let | |
62 | + | let keyTransferUsd = "_transfer_usd" | |
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 | - | ||
92 | 74 | let keyUserBoughtTicketsAmount = "_bought_tickets" | |
93 | 75 | ||
94 | 76 | let keyUserTickets = "_tickets_number" | |
95 | 77 | ||
96 | - | let keyUserHCTickets = "_tickets_number_high_competition" | |
97 | - | ||
98 | - | let keyUserHCBoughtTicketsAmount = "_bought_tickets_high_competition" | |
99 | - | ||
100 | 78 | let keyUserAvailableAllocations = "_available_purchase_marketing" | |
101 | 79 | ||
102 | - | let | |
80 | + | let keyUserAmountUSDNInMarketing = "_purchased_usdn_in_marketing" | |
103 | 81 | ||
104 | 82 | let keyUserBoughtAllocations = "_bought_allocations" | |
105 | 83 | ||
107 | 85 | ||
108 | 86 | let keyUserWinnedTicketsAmount = "_tickets_result" | |
109 | 87 | ||
110 | - | let | |
88 | + | let keyUserFreezeToken = "_freeze_token_amount" | |
111 | 89 | ||
112 | - | let | |
90 | + | let lauchpadDuration = 10000 | |
113 | 91 | ||
114 | 92 | let oracle = Address(base58'3NBBWfzZtZtszaXbitTKnrB2xXwv26Bn7H9') | |
115 | 93 | ||
124 | 102 | let adminPubKeyStaking = base58'Kn7NpzaG12dLZgcHf2ipUftU6hbJygmrhFqQYE4B7ZK' | |
125 | 103 | ||
126 | 104 | let maxAllocationsAmount = 2 | |
105 | + | ||
106 | + | let isActive = valueOrElse(getBoolean(this, keyActive), true) | |
127 | 107 | ||
128 | 108 | let activeLaunchpadId = valueOrElse(getIntegerValue(this, keyLaunchpadActiveId), -1) | |
129 | 109 | ||
159 | 139 | func stakedUsdnAmount () = valueOrElse(getInteger(stakingUSDNAddress, ((("rpd_balance_" + toBase58String(USDN)) + "_") + toString(this))), 0) | |
160 | 140 | ||
161 | 141 | ||
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 | - | ||
184 | 142 | @Callable(i) | |
185 | - | func hashingRandom (launchpadId,hash) = valueOrElse(isActive(), valueOrElse(isAdminCall(i), [StringEntry((toString(launchpadId) + keyVerifyHash), hash)])) | |
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)] | |
186 | 148 | ||
187 | 149 | ||
188 | 150 | ||
189 | 151 | @Callable(i) | |
190 | - | func initCaller (address) = valueOrElse(isActive(), valueOrElse(isAdminCall(i), [StringEntry(keyInitCaller, address)])) | |
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)] | |
191 | 157 | ||
192 | 158 | ||
193 | 159 | ||
194 | 160 | @Callable(i) | |
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 | - | }) | |
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 | + | } | |
220 | 188 | ||
221 | 189 | ||
222 | 190 | ||
223 | 191 | @Callable(i) | |
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 | - | })) | |
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 | + | } | |
258 | 286 | ||
259 | 287 | ||
260 | 288 | ||
261 | 289 | @Callable(i) | |
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) | |
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) | |
265 | 296 | let boughtAllocations = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserBoughtAllocations)), 0) | |
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)) | |
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)) | |
306 | 317 | then true | |
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) | |
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) | |
318 | 324 | else false) | |
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")) | |
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)) | |
327 | 330 | then { | |
328 | - | let | |
329 | - | | |
330 | - | | |
331 | - | | |
331 | + | let baseEntry = [IntegerEntry((((toString(i.caller) + "_") + toString(launchpadId)) + keyUserBoughtAllocations), (boughtAllocations + buyAllocationsAmount)), IntegerEntry((((toString(i.caller) + "_") + toString(launchpadId)) + keyUserAmountUSDNInMarketing), (userUsdnInMarketing + pmtAmount)), IntegerEntry((toString(launchpadId) + keyAmountUSDNInMarketing), (usdnInMarketing + pmtAmount))] | |
332 | + | if (!(isDefined(getString(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserRefId))))) | |
333 | + | then (baseEntry ++ [StringEntry((((toString(i.caller) + "_") + toString(launchpadId)) + keyUserRefId), refId)]) | |
334 | + | else baseEntry | |
332 | 335 | } | |
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") | |
336 | + | else throw("Strict value is not equal to itself.") | |
358 | 337 | } | |
359 | - | else throw("Strict value is not equal to itself.") | |
360 | - | } | |
361 | - | } | |
362 | - | }) | |
338 | + | } | |
363 | 339 | ||
364 | 340 | ||
365 | 341 | ||
366 | 342 | @Callable(i) | |
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 | - | }) | |
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 | + | } | |
387 | 371 | ||
388 | 372 | ||
389 | 373 | ||
390 | 374 | @Callable(i) | |
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 | - | })) | |
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 | + | } | |
400 | 428 | ||
401 | 429 | ||
402 | 430 | ||
403 | 431 | @Callable(i) | |
404 | - | func shutdown () = valueOrElse(isAdminCall(i), if (!(active)) | |
405 | - | then throw("DApp already inactive") | |
406 | - | else [BooleanEntry(keyActive, false)]) | |
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 | + | } | |
407 | 454 | ||
408 | 455 | ||
409 | 456 | ||
410 | 457 | @Callable(i) | |
411 | - | func activate () = valueOrElse(isAdminCall(i), if (active) | |
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) | |
412 | 480 | then throw("DApp already active") | |
413 | - | else [BooleanEntry(keyActive, true)]) | |
481 | + | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))) | |
482 | + | then throw("Only admin can call this function") | |
483 | + | else [BooleanEntry(keyActive, true)] | |
414 | 484 | ||
415 | 485 | ||
416 | 486 | @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 keyTotalAmountUsdnSold = "_total_usdn_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 keyAmountUSDNInMarketing = "_total_purchased_usdn_in_marketing" | |
59 | 59 | ||
60 | - | let | |
60 | + | let keyAmountUSDNInMarketingFinalized = "_total_purchased_usdn_in_marketing_finalized" | |
61 | 61 | ||
62 | - | let | |
62 | + | let keyTransferUsd = "_transfer_usd" | |
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 | - | ||
92 | 74 | let keyUserBoughtTicketsAmount = "_bought_tickets" | |
93 | 75 | ||
94 | 76 | let keyUserTickets = "_tickets_number" | |
95 | 77 | ||
96 | - | let keyUserHCTickets = "_tickets_number_high_competition" | |
97 | - | ||
98 | - | let keyUserHCBoughtTicketsAmount = "_bought_tickets_high_competition" | |
99 | - | ||
100 | 78 | let keyUserAvailableAllocations = "_available_purchase_marketing" | |
101 | 79 | ||
102 | - | let | |
80 | + | let keyUserAmountUSDNInMarketing = "_purchased_usdn_in_marketing" | |
103 | 81 | ||
104 | 82 | let keyUserBoughtAllocations = "_bought_allocations" | |
105 | 83 | ||
106 | 84 | let keyUserClaimStatus = "_claim_status" | |
107 | 85 | ||
108 | 86 | let keyUserWinnedTicketsAmount = "_tickets_result" | |
109 | 87 | ||
110 | - | let | |
88 | + | let keyUserFreezeToken = "_freeze_token_amount" | |
111 | 89 | ||
112 | - | let | |
90 | + | let lauchpadDuration = 10000 | |
113 | 91 | ||
114 | 92 | let oracle = Address(base58'3NBBWfzZtZtszaXbitTKnrB2xXwv26Bn7H9') | |
115 | 93 | ||
116 | 94 | let governance = Address(base58'3N5W8da2iiijVieA6qLGo7KzCJj8B19smWU') | |
117 | 95 | ||
118 | 96 | let commissionWallet = Address(base58'3N2hBdeDEs7wCNA9EY8qv3B6drjgKD64xQG') | |
119 | 97 | ||
120 | 98 | let stakingUSDNAddress = Address(base58'3N6q7sCGSSLBUXDdjBdYGTJbZGZfhhh8cNg') | |
121 | 99 | ||
122 | 100 | let USDN = base58'8UrfDVd5GreeUwm7uPk7eYz1eMv376kzR52C6sANPkwS' | |
123 | 101 | ||
124 | 102 | let adminPubKeyStaking = base58'Kn7NpzaG12dLZgcHf2ipUftU6hbJygmrhFqQYE4B7ZK' | |
125 | 103 | ||
126 | 104 | let maxAllocationsAmount = 2 | |
105 | + | ||
106 | + | let isActive = valueOrElse(getBoolean(this, keyActive), true) | |
127 | 107 | ||
128 | 108 | let activeLaunchpadId = valueOrElse(getIntegerValue(this, keyLaunchpadActiveId), -1) | |
129 | 109 | ||
130 | 110 | func getAdminPub (keyAdminPub) = match getString(oracle, keyAdminPub) { | |
131 | 111 | case string: String => | |
132 | 112 | fromBase58String(string) | |
133 | 113 | case nothing => | |
134 | 114 | throw("Admin public key is empty") | |
135 | 115 | } | |
136 | 116 | ||
137 | 117 | ||
138 | 118 | let adminPubKey1 = getAdminPub(keyAdminPubKey1) | |
139 | 119 | ||
140 | 120 | let adminPubKey2 = getAdminPub(keyAdminPubKey2) | |
141 | 121 | ||
142 | 122 | let adminPubKey3 = getAdminPub(keyAdminPubKey3) | |
143 | 123 | ||
144 | 124 | func getAssetInfo (assetId) = match assetId { | |
145 | 125 | case id: ByteVector => | |
146 | 126 | let stringId = toBase58String(id) | |
147 | 127 | let info = valueOrErrorMessage(assetInfo(id), (("Asset " + stringId) + " doesn't exist")) | |
148 | 128 | $Tuple3(stringId, info.name, info.decimals) | |
149 | 129 | case waves: Unit => | |
150 | 130 | $Tuple3("WAVES", "WAVES", 8) | |
151 | 131 | case _ => | |
152 | 132 | throw("Match error") | |
153 | 133 | } | |
154 | 134 | ||
155 | 135 | ||
156 | 136 | func getLaunchpadNextId () = valueOrElse(getInteger(this, keyLaunchpadNextId), 1) | |
157 | 137 | ||
158 | 138 | ||
159 | 139 | func stakedUsdnAmount () = valueOrElse(getInteger(stakingUSDNAddress, ((("rpd_balance_" + toBase58String(USDN)) + "_") + toString(this))), 0) | |
160 | 140 | ||
161 | 141 | ||
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 | - | ||
184 | 142 | @Callable(i) | |
185 | - | func hashingRandom (launchpadId,hash) = valueOrElse(isActive(), valueOrElse(isAdminCall(i), [StringEntry((toString(launchpadId) + keyVerifyHash), hash)])) | |
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)] | |
186 | 148 | ||
187 | 149 | ||
188 | 150 | ||
189 | 151 | @Callable(i) | |
190 | - | func initCaller (address) = valueOrElse(isActive(), valueOrElse(isAdminCall(i), [StringEntry(keyInitCaller, address)])) | |
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)] | |
191 | 157 | ||
192 | 158 | ||
193 | 159 | ||
194 | 160 | @Callable(i) | |
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 | - | }) | |
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 | + | } | |
220 | 188 | ||
221 | 189 | ||
222 | 190 | ||
223 | 191 | @Callable(i) | |
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 | - | })) | |
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 | + | } | |
258 | 286 | ||
259 | 287 | ||
260 | 288 | ||
261 | 289 | @Callable(i) | |
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) | |
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) | |
265 | 296 | let boughtAllocations = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserBoughtAllocations)), 0) | |
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)) | |
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)) | |
306 | 317 | then true | |
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) | |
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) | |
318 | 324 | else false) | |
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")) | |
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)) | |
327 | 330 | then { | |
328 | - | let | |
329 | - | | |
330 | - | | |
331 | - | | |
331 | + | let baseEntry = [IntegerEntry((((toString(i.caller) + "_") + toString(launchpadId)) + keyUserBoughtAllocations), (boughtAllocations + buyAllocationsAmount)), IntegerEntry((((toString(i.caller) + "_") + toString(launchpadId)) + keyUserAmountUSDNInMarketing), (userUsdnInMarketing + pmtAmount)), IntegerEntry((toString(launchpadId) + keyAmountUSDNInMarketing), (usdnInMarketing + pmtAmount))] | |
332 | + | if (!(isDefined(getString(this, (((toString(i.caller) + "_") + toString(launchpadId)) + keyUserRefId))))) | |
333 | + | then (baseEntry ++ [StringEntry((((toString(i.caller) + "_") + toString(launchpadId)) + keyUserRefId), refId)]) | |
334 | + | else baseEntry | |
332 | 335 | } | |
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") | |
336 | + | else throw("Strict value is not equal to itself.") | |
358 | 337 | } | |
359 | - | else throw("Strict value is not equal to itself.") | |
360 | - | } | |
361 | - | } | |
362 | - | }) | |
338 | + | } | |
363 | 339 | ||
364 | 340 | ||
365 | 341 | ||
366 | 342 | @Callable(i) | |
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 | - | }) | |
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 | + | } | |
387 | 371 | ||
388 | 372 | ||
389 | 373 | ||
390 | 374 | @Callable(i) | |
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 | - | })) | |
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 | + | } | |
400 | 428 | ||
401 | 429 | ||
402 | 430 | ||
403 | 431 | @Callable(i) | |
404 | - | func shutdown () = valueOrElse(isAdminCall(i), if (!(active)) | |
405 | - | then throw("DApp already inactive") | |
406 | - | else [BooleanEntry(keyActive, false)]) | |
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 | + | } | |
407 | 454 | ||
408 | 455 | ||
409 | 456 | ||
410 | 457 | @Callable(i) | |
411 | - | func activate () = valueOrElse(isAdminCall(i), if (active) | |
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) | |
412 | 480 | then throw("DApp already active") | |
413 | - | else [BooleanEntry(keyActive, true)]) | |
481 | + | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))) | |
482 | + | then throw("Only admin can call this function") | |
483 | + | else [BooleanEntry(keyActive, true)] | |
414 | 484 | ||
415 | 485 | ||
416 | 486 | @Verifier(tx) | |
417 | 487 | func verify () = { | |
418 | 488 | let multiSignedByAdmins = { | |
419 | 489 | let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
420 | 490 | then 1 | |
421 | 491 | else 0 | |
422 | 492 | let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], adminPubKey2)) | |
423 | 493 | then 1 | |
424 | 494 | else 0 | |
425 | 495 | let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], adminPubKey3)) | |
426 | 496 | then 1 | |
427 | 497 | else 0 | |
428 | 498 | (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2) | |
429 | 499 | } | |
430 | 500 | let signedByAdmin = if (if (if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
431 | 501 | then true | |
432 | 502 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey2)) | |
433 | 503 | then true | |
434 | 504 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey3)) | |
435 | 505 | then true | |
436 | 506 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKeyStaking) | |
437 | 507 | match tx { | |
438 | 508 | case dtx: DataTransaction => | |
439 | 509 | if (valueOrElse(getBoolean(oracle, keyLaunchpadDataTransactionStatus), false)) | |
440 | 510 | then signedByAdmin | |
441 | 511 | else false | |
442 | 512 | case _ => | |
443 | 513 | multiSignedByAdmins | |
444 | 514 | } | |
445 | 515 | } | |
446 | 516 |
github/deemru/w8io/169f3d6 80.12 ms ◑