tx · 37ueSBJtFKWQSaNpAYgSJUU4heZaNYL34xdL32ouqfms 3Mw7mAf2p8drjeSSDEbq6yyFhjqTgDcwGFB: -0.04000000 Waves 2022.05.05 10:34 [2038114] smart account 3Mw7mAf2p8drjeSSDEbq6yyFhjqTgDcwGFB > SELF 0.00000000 Waves
{ "type": 13, "id": "37ueSBJtFKWQSaNpAYgSJUU4heZaNYL34xdL32ouqfms", "fee": 4000000, "feeAssetId": null, "timestamp": 1651736178384, "version": 2, "chainId": 84, "sender": "3Mw7mAf2p8drjeSSDEbq6yyFhjqTgDcwGFB", "senderPublicKey": "Ti5K4A5REvfgdfj3SWhhb2wJXRKenVb3WPQ6tE1TaKe", "proofs": [ "394AVQ7psaM5xThAspCqp8JZdPfqNLs9w81CnRsHToNZ6quB7vho46L1wMZ4jgVCYKw289BCCagmRos6Cywn4nMX" ], "script": "base64:AAIFAAAAAAAAABMIAhILCgkBAQEBAQgICAESABIAAAAADgAAAAACcHMCAAAADVBSRVNBTEVfU1RBUlQAAAAAAnBkAgAAABBQUkVTQUxFX0RVUkFUSU9OAAAAAAJjcwIAAAALQ0xBSU1fU1RBUlQAAAAAAmNkAgAAAA5DTEFJTV9EVVJBVElPTgAAAAABcAIAAAAJUFJJQ0VfSURPAAAAAARwMUlEAgAAABBQUklDRV8xX0FTU0VUX0lEAAAAAARwMklEAgAAABBQUklDRV8yX0FTU0VUX0lEAAAAAARwM0lEAgAAABBQUklDRV8zX0FTU0VUX0lEAAAAAANtaWECAAAAEU1JTl9BTU9VTlRfSU5WRVNUAAAAAAVtYWluYQIAAAAKTUFJTl9BU1NFVAAAAAAHZm9yU2FsZQIAAAAOVE9UQUxfRk9SX1NBTEUAAAAACXRvdGFsU2FsZQIAAAAKVE9UQUxfU0FMRQAAAAAHdGludmVzdAIAAAANVE9UQUxfSU5WRVNUXwEAAAAPZ2V0QXNzZXRJZlZhbGlkAAAAAQAAAAdhc3NldElkCQACWAAAAAEJAQAAABN2YWx1ZU9yRXJyb3JNZ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VieXRlcwIAAAAIX0hJU1RPUlkAAAAAAAAAAAAEAAAACWRpZmVyZW5jSAkAAGUAAAACCQAAZQAAAAIFAAAADWNsYWluRHVyYXRpb24FAAAADGhTb2xpY2l0YXRpbgkAAGUAAAACBQAAAAFoBQAAAApjbGFpblN0YXJ0BAAAAApmaW5hbFZhbHVlCQAAaAAAAAIFAAAABmRpc3RyaQUAAAAJZGlmZXJlbmNICQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgUAAAAHdGludmVzdAkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzAgAAAAhfSElTVE9SWQkAAGUAAAACBQAAAAFoBQAAAApjbGFpblN0YXJ0CQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACCQABLAAAAAIFAAAAB3RpbnZlc3QJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwkAAGUAAAACBQAAAApnZXRUSW52ZXN0CQAAaAAAAAIFAAAACmZpbmFsVmFsdWUFAAAABXByaWNlCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAKZmluYWxWYWx1ZQUAAAAJbWFpbkFzc2V0BQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleWkpALA=", "height": 2038114, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FpHsYLbEBC4LcgdSCuVWgvF31uEr4P3niTNrqVT5yF5g Next: HBPfn3XKJCRNCXJiBnPWVppmx8TE6SUGH3BrYnwho3bw Diff:
Old | New | Differences | |
---|---|---|---|
40 | 40 | then throw("PresaleDuration can't be bigger than PresaleStart") | |
41 | 41 | else if ((presaleDuration >= claimStart)) | |
42 | 42 | then throw("presaleDuration can't be bigger than claimStart") | |
43 | - | else if (( | |
44 | - | then throw(" | |
43 | + | else if ((claimDuration >= claimStart)) | |
44 | + | then throw("claimDuration can't be bigger than claimStart") | |
45 | 45 | else if ((minInvestAmount >= price)) | |
46 | 46 | then throw("minInvestAmount can't be bigger than price") | |
47 | 47 | else if (if (if ((asset1 == asset2)) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let ps = "PRESALE_START" | |
5 | 5 | ||
6 | 6 | let pd = "PRESALE_DURATION" | |
7 | 7 | ||
8 | 8 | let cs = "CLAIM_START" | |
9 | 9 | ||
10 | 10 | let cd = "CLAIM_DURATION" | |
11 | 11 | ||
12 | 12 | let p = "PRICE_IDO" | |
13 | 13 | ||
14 | 14 | let p1ID = "PRICE_1_ASSET_ID" | |
15 | 15 | ||
16 | 16 | let p2ID = "PRICE_2_ASSET_ID" | |
17 | 17 | ||
18 | 18 | let p3ID = "PRICE_3_ASSET_ID" | |
19 | 19 | ||
20 | 20 | let mia = "MIN_AMOUNT_INVEST" | |
21 | 21 | ||
22 | 22 | let maina = "MAIN_ASSET" | |
23 | 23 | ||
24 | 24 | let forSale = "TOTAL_FOR_SALE" | |
25 | 25 | ||
26 | 26 | let totalSale = "TOTAL_SALE" | |
27 | 27 | ||
28 | 28 | let tinvest = "TOTAL_INVEST_" | |
29 | 29 | ||
30 | 30 | func getAssetIfValid (assetId) = toBase58String(valueOrErrorMessage(value(assetInfo(fromBase58String(assetId))).id, (("Asset Id: " + assetId) + " is invalid."))) | |
31 | 31 | ||
32 | 32 | ||
33 | 33 | @Callable(i) | |
34 | 34 | func constructor (presaleStart,presaleDuration,claimStart,claimDuration,price,price1AssetId58,price2AssetId58,price3AssetId58,minInvestAmount) = { | |
35 | 35 | let asset1 = getAssetIfValid(price1AssetId58) | |
36 | 36 | let asset2 = getAssetIfValid(price2AssetId58) | |
37 | 37 | let asset3 = getAssetIfValid(price3AssetId58) | |
38 | 38 | if ((i.caller == this)) | |
39 | 39 | then if ((presaleDuration >= presaleStart)) | |
40 | 40 | then throw("PresaleDuration can't be bigger than PresaleStart") | |
41 | 41 | else if ((presaleDuration >= claimStart)) | |
42 | 42 | then throw("presaleDuration can't be bigger than claimStart") | |
43 | - | else if (( | |
44 | - | then throw(" | |
43 | + | else if ((claimDuration >= claimStart)) | |
44 | + | then throw("claimDuration can't be bigger than claimStart") | |
45 | 45 | else if ((minInvestAmount >= price)) | |
46 | 46 | then throw("minInvestAmount can't be bigger than price") | |
47 | 47 | else if (if (if ((asset1 == asset2)) | |
48 | 48 | then true | |
49 | 49 | else (asset1 == asset3)) | |
50 | 50 | then true | |
51 | 51 | else (asset2 == asset3)) | |
52 | 52 | then throw("Each Asset must be different from the other.") | |
53 | 53 | else if ((size(i.payments) != 1)) | |
54 | 54 | then throw("exactly 1 payment must be attached") | |
55 | 55 | else [BinaryEntry(maina, value(i.payments[0].assetId)), StringEntry(p1ID, price1AssetId58), StringEntry(p2ID, price2AssetId58), StringEntry(p3ID, price3AssetId58), IntegerEntry(ps, presaleStart), IntegerEntry(pd, presaleDuration), IntegerEntry(cs, claimStart), IntegerEntry(cd, claimDuration), IntegerEntry(p, price), IntegerEntry(mia, minInvestAmount), IntegerEntry(forSale, value(i.payments[0]).amount), IntegerEntry(totalSale, 0)] | |
56 | 56 | else throw("Only the Admin itself can invoke this function") | |
57 | 57 | } | |
58 | 58 | ||
59 | 59 | ||
60 | 60 | ||
61 | 61 | @Callable(i) | |
62 | 62 | func invest () = { | |
63 | 63 | let mainAsset = getBinary(this, maina) | |
64 | 64 | let presaleStart = getIntegerValue(this, ps) | |
65 | 65 | let presaleDuration = getIntegerValue(this, pd) | |
66 | 66 | let presaleEnd = (presaleStart + presaleDuration) | |
67 | 67 | let price = getIntegerValue(this, p) | |
68 | 68 | let h = height | |
69 | 69 | let pmt = value(i.payments[0]) | |
70 | 70 | let pmtAssetId = value(pmt.assetId) | |
71 | 71 | let pmtAmount = pmt.amount | |
72 | 72 | let asset1 = fromBase58String(getStringValue(this, p1ID)) | |
73 | 73 | let asset2 = fromBase58String(getStringValue(this, p2ID)) | |
74 | 74 | let asset3 = fromBase58String(getStringValue(this, p3ID)) | |
75 | 75 | let totalSalee = getIntegerValue(this, totalSale) | |
76 | 76 | let forSalee = getIntegerValue(this, forSale) | |
77 | 77 | let minInvest = getIntegerValue(this, mia) | |
78 | 78 | if ((presaleStart >= h)) | |
79 | 79 | then throw("presale has not been started yet") | |
80 | 80 | else if ((h >= presaleEnd)) | |
81 | 81 | then throw("presale has been already ended") | |
82 | 82 | else if ((size(i.payments) != 1)) | |
83 | 83 | then throw("exactly 1 payment is expected") | |
84 | 84 | else if (if (if ((pmtAssetId != asset1)) | |
85 | 85 | then true | |
86 | 86 | else (pmtAssetId != asset2)) | |
87 | 87 | then true | |
88 | 88 | else (pmtAssetId != asset3)) | |
89 | 89 | then throw("invalid payment asset id") | |
90 | 90 | else if ((totalSalee >= forSalee)) | |
91 | 91 | then throw("Pre-sale asset has been - sold consider to use smaller payment") | |
92 | 92 | else if ((minInvest > pmtAmount)) | |
93 | 93 | then throw("Amount less than the minimum to be invested.") | |
94 | 94 | else { | |
95 | 95 | let getTInvest = valueOrElse(getIntegerValue(this, (tinvest + toBase58String(i.caller.bytes))), 0) | |
96 | 96 | let calc = (pmtAmount / price) | |
97 | 97 | let totalAmount = (pmtAmount + getTInvest) | |
98 | 98 | [IntegerEntry((tinvest + toBase58String(i.caller.bytes)), totalAmount), IntegerEntry(totalSale, (totalSalee + calc)), BooleanEntry((((tinvest + toBase58String(i.caller.bytes)) + "__") + toBase58String(pmtAssetId)), true)] | |
99 | 99 | } | |
100 | 100 | } | |
101 | 101 | ||
102 | 102 | ||
103 | 103 | ||
104 | 104 | @Callable(i) | |
105 | 105 | func claimPresale () = { | |
106 | 106 | let mainAsset = getBinary(this, maina) | |
107 | 107 | let h = height | |
108 | 108 | let clainStart = getIntegerValue(this, cs) | |
109 | 109 | let clainDuration = getIntegerValue(this, cd) | |
110 | 110 | let clainEnd = (clainStart + clainDuration) | |
111 | 111 | let price = getIntegerValue(this, p) | |
112 | 112 | if ((clainStart >= h)) | |
113 | 113 | then throw("The Presale is still happening.") | |
114 | 114 | else if ((h > clainEnd)) | |
115 | 115 | then { | |
116 | 116 | let getTInvest = valueOrErrorMessage(getIntegerValue(this, (tinvest + toBase58String(i.caller.bytes))), "You were not part of the presale") | |
117 | 117 | let calc = (getTInvest / price) | |
118 | 118 | let distri = (calc / clainDuration) | |
119 | 119 | let hSolicitatin = valueOrElse(getIntegerValue(this, ((tinvest + toBase58String(i.caller.bytes)) + "_HISTORY")), 0) | |
120 | 120 | let diferencH = (clainDuration - hSolicitatin) | |
121 | 121 | let finalValue = (distri * diferencH) | |
122 | 122 | [IntegerEntry(((tinvest + toBase58String(i.caller.bytes)) + "_HISTORY"), (h - clainStart)), IntegerEntry((tinvest + toBase58String(i.caller.bytes)), (getTInvest - (finalValue * price))), ScriptTransfer(i.caller, finalValue, mainAsset)] | |
123 | 123 | } | |
124 | 124 | else { | |
125 | 125 | let getTInvest = valueOrErrorMessage(getIntegerValue(this, (tinvest + toBase58String(i.caller.bytes))), "You were not part of the presale") | |
126 | 126 | let calc = (getTInvest / price) | |
127 | 127 | let distri = (calc / clainDuration) | |
128 | 128 | let hSolicitatin = valueOrElse(getIntegerValue(this, ((tinvest + toBase58String(i.caller.bytes)) + "_HISTORY")), 0) | |
129 | 129 | let diferencH = ((clainDuration - hSolicitatin) - (h - clainStart)) | |
130 | 130 | let finalValue = (distri * diferencH) | |
131 | 131 | [IntegerEntry(((tinvest + toBase58String(i.caller.bytes)) + "_HISTORY"), (h - clainStart)), IntegerEntry((tinvest + toBase58String(i.caller.bytes)), (getTInvest - (finalValue * price))), ScriptTransfer(i.caller, finalValue, mainAsset)] | |
132 | 132 | } | |
133 | 133 | } | |
134 | 134 | ||
135 | 135 | ||
136 | 136 | @Verifier(tx) | |
137 | 137 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
138 | 138 |
github/deemru/w8io/169f3d6 27.62 ms ◑