tx · 31ERcdSw59P4yDEaaCh8DdJ6oEuVShFKZgWSpjbLpATJ 3MvMpGD5MxbUW2EJn6jtViDu6NHNqu8PKq8: -0.01100000 Waves 2022.09.12 01:07 [2225015] smart account 3MvMpGD5MxbUW2EJn6jtViDu6NHNqu8PKq8 > SELF 0.00000000 Waves
{ "type": 13, "id": "31ERcdSw59P4yDEaaCh8DdJ6oEuVShFKZgWSpjbLpATJ", "fee": 1100000, "feeAssetId": null, "timestamp": 1662934014654, "version": 2, "chainId": 84, "sender": "3MvMpGD5MxbUW2EJn6jtViDu6NHNqu8PKq8", "senderPublicKey": "2MhVDhjG7eJ6SY8og2HRd4Bam75FsCSg2Vude8gutmZe", "proofs": [ "3gWFN9onX91VRRUyEE7wEjq1ebjsn2TdF5AXazYzjfuHrA2LvGuX9amrEKCkxcv7D7TP2cdfjR1acjUz7zKQ71YT" ], "script": "base64:AAIFAAAAAAAAAB8IAhIDCgEIEgsKCQEBAQEICAgIARIAEgASBQoDAQgIAAAAEgAAAAACcHMCAAAADVBSRVNBTEVfU1RBUlQAAAAAAnBkAgAAABBQUkVTQUxFX0RVUkFUSU9OAAAAAAJjcwIAAAALQ0xBSU1fU1RBUlQAAAAAAmNkAgAAAA5DTEFJTV9EVVJBVElPTgAAAAABcAIAAAAJUFJJQ0VfSURPAAAAAARwMUlEAgAAABBQUklDRV8xX0FTU0VUX0lEAAAAAARwMklEAgAAABBQUklDRV8yX0FTU0VUX0lEAAAAAARwM0lEAgAAABBQUklDRV8zX0FTU0VUX0lEAAAAAARwNElEAgAAABBQUklDRV80X0FTU0VUX0lEAAAAAANtaWECAAAAEU1JTl9BTU9VTlRfSU5WRVNUAAAAAAVtYWluYQIAAAAKTUFJTl9BU1NFVAAAAAAHZm9yU2FsZQIAAAAOVE9UQUxfRk9SX1NBTEUAAAAACXRvdGFsU2FsZQIAAAAKVE9UQUxfU0FMRQAAAAAHdGludmVzdAIAAAANVE9UQUxfSU5WRVNUXwAAAAAFZGlzZHUCAAAAF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AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tlea/Kbjw=", "height": 2225015, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: EoEysBKTuSB8pFJpipbi5vY3ZynPhwksEsnD8tuGK1nq Next: none Diff:
Old | New | Differences | |
---|---|---|---|
16 | 16 | let p2ID = "PRICE_2_ASSET_ID" | |
17 | 17 | ||
18 | 18 | let p3ID = "PRICE_3_ASSET_ID" | |
19 | + | ||
20 | + | let p4ID = "PRICE_4_ASSET_ID" | |
19 | 21 | ||
20 | 22 | let mia = "MIN_AMOUNT_INVEST" | |
21 | 23 | ||
44 | 46 | ||
45 | 47 | ||
46 | 48 | @Callable(i) | |
47 | - | func constructor (presaleStart,presaleDuration,distributionDuration,price,price1AssetId58,price2AssetId58,price3AssetId58,minInvestAmount) = { | |
49 | + | func constructor (presaleStart,presaleDuration,distributionDuration,price,price1AssetId58,price2AssetId58,price3AssetId58,price4AssetId58,minInvestAmount) = { | |
48 | 50 | let asset1 = getAssetIfValid(price1AssetId58) | |
49 | 51 | let asset2 = getAssetIfValid(price2AssetId58) | |
50 | 52 | let asset3 = getAssetIfValid(price3AssetId58) | |
61 | 63 | then true | |
62 | 64 | else (asset2 == asset3)) | |
63 | 65 | then throw("Each Asset must be different from the other.") | |
64 | - | else if ((size(i.payments) != 1)) | |
65 | - | then throw("exactly 1 payment must be attached") | |
66 | - | else [BinaryEntry(maina, value(i.payments[0].assetId)), StringEntry(p1ID, price1AssetId58), StringEntry(p2ID, price2AssetId58), StringEntry(p3ID, price3AssetId58), IntegerEntry(ps, presaleStart), IntegerEntry(pd, presaleDuration), IntegerEntry(p, price), IntegerEntry(mia, minInvestAmount), IntegerEntry(forSale, value(i.payments[0]).amount), IntegerEntry(totalSale, 0), IntegerEntry(disdu, distributionDuration)] | |
66 | + | else [BinaryEntry(maina, value(i.payments[0].assetId)), StringEntry(p1ID, price1AssetId58), StringEntry(p2ID, price2AssetId58), StringEntry(p3ID, price3AssetId58), StringEntry(p4ID, price4AssetId58), IntegerEntry(ps, presaleStart), IntegerEntry(pd, presaleDuration), IntegerEntry(p, price), IntegerEntry(mia, minInvestAmount), IntegerEntry(totalSale, 0), IntegerEntry(disdu, distributionDuration)] | |
67 | 67 | else throw("Only the Admin itself can invoke this function") | |
68 | 68 | } | |
69 | 69 | ||
83 | 83 | let asset1 = getStringValue(this, p1ID) | |
84 | 84 | let asset2 = getStringValue(this, p2ID) | |
85 | 85 | let asset3 = getStringValue(this, p3ID) | |
86 | + | let asset4 = getStringValue(this, p4ID) | |
86 | 87 | let totalSalee = getIntegerValue(this, totalSale) | |
87 | - | let forSalee = | |
88 | + | let forSalee = assetBalance(Address(this.bytes), mainAsset) | |
88 | 89 | let minInvest = getIntegerValue(this, mia) | |
89 | 90 | if ((presaleStart >= h)) | |
90 | 91 | then throw("presale has not been started yet") | |
92 | 93 | then throw("presale has been already ended") | |
93 | 94 | else if ((size(i.payments) != 1)) | |
94 | 95 | then throw("exactly 1 payment is expected") | |
95 | - | else if (if (if ((pmtAssetId != asset1)) | |
96 | + | else if (if (if (if ((pmtAssetId != asset1)) | |
96 | 97 | then (pmtAssetId != asset2) | |
97 | 98 | else false) | |
98 | 99 | then (pmtAssetId != asset3) | |
100 | + | else false) | |
101 | + | then (pmtAssetId != asset4) | |
99 | 102 | else false) | |
100 | 103 | then throw(((("invalid payment asset id:" + pmtAssetId) + " Expected:") + asset1)) | |
101 | 104 | else if ((totalSalee >= forSalee)) |
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 | + | ||
20 | + | let p4ID = "PRICE_4_ASSET_ID" | |
19 | 21 | ||
20 | 22 | let mia = "MIN_AMOUNT_INVEST" | |
21 | 23 | ||
22 | 24 | let maina = "MAIN_ASSET" | |
23 | 25 | ||
24 | 26 | let forSale = "TOTAL_FOR_SALE" | |
25 | 27 | ||
26 | 28 | let totalSale = "TOTAL_SALE" | |
27 | 29 | ||
28 | 30 | let tinvest = "TOTAL_INVEST_" | |
29 | 31 | ||
30 | 32 | let disdu = "DISTRIBUTION_DURATION" | |
31 | 33 | ||
32 | 34 | let D8 = 100000000 | |
33 | 35 | ||
34 | 36 | let D10 = 10000000000 | |
35 | 37 | ||
36 | 38 | func getAssetIfValid (assetId) = toBase58String(valueOrErrorMessage(value(assetInfo(fromBase58String(assetId))).id, (("Asset Id: " + assetId) + " is invalid."))) | |
37 | 39 | ||
38 | 40 | ||
39 | 41 | @Callable(i) | |
40 | 42 | func addAdmin (address) = if ((i.caller == this)) | |
41 | 43 | then [BinaryEntry("admin", fromBase58String(address))] | |
42 | 44 | else throw("Only the Admin itself can invoke this function") | |
43 | 45 | ||
44 | 46 | ||
45 | 47 | ||
46 | 48 | @Callable(i) | |
47 | - | func constructor (presaleStart,presaleDuration,distributionDuration,price,price1AssetId58,price2AssetId58,price3AssetId58,minInvestAmount) = { | |
49 | + | func constructor (presaleStart,presaleDuration,distributionDuration,price,price1AssetId58,price2AssetId58,price3AssetId58,price4AssetId58,minInvestAmount) = { | |
48 | 50 | let asset1 = getAssetIfValid(price1AssetId58) | |
49 | 51 | let asset2 = getAssetIfValid(price2AssetId58) | |
50 | 52 | let asset3 = getAssetIfValid(price3AssetId58) | |
51 | 53 | if (if ((i.caller == this)) | |
52 | 54 | then true | |
53 | 55 | else (i.caller == Address(getBinaryValue(this, "admin")))) | |
54 | 56 | then if ((presaleDuration >= presaleStart)) | |
55 | 57 | then throw("PresaleDuration can't be bigger than PresaleStart") | |
56 | 58 | else if ((minInvestAmount > price)) | |
57 | 59 | then throw("minInvestAmount can't be bigger than price") | |
58 | 60 | else if (if (if ((asset1 == asset2)) | |
59 | 61 | then true | |
60 | 62 | else (asset1 == asset3)) | |
61 | 63 | then true | |
62 | 64 | else (asset2 == asset3)) | |
63 | 65 | then throw("Each Asset must be different from the other.") | |
64 | - | else if ((size(i.payments) != 1)) | |
65 | - | then throw("exactly 1 payment must be attached") | |
66 | - | else [BinaryEntry(maina, value(i.payments[0].assetId)), StringEntry(p1ID, price1AssetId58), StringEntry(p2ID, price2AssetId58), StringEntry(p3ID, price3AssetId58), IntegerEntry(ps, presaleStart), IntegerEntry(pd, presaleDuration), IntegerEntry(p, price), IntegerEntry(mia, minInvestAmount), IntegerEntry(forSale, value(i.payments[0]).amount), IntegerEntry(totalSale, 0), IntegerEntry(disdu, distributionDuration)] | |
66 | + | else [BinaryEntry(maina, value(i.payments[0].assetId)), StringEntry(p1ID, price1AssetId58), StringEntry(p2ID, price2AssetId58), StringEntry(p3ID, price3AssetId58), StringEntry(p4ID, price4AssetId58), IntegerEntry(ps, presaleStart), IntegerEntry(pd, presaleDuration), IntegerEntry(p, price), IntegerEntry(mia, minInvestAmount), IntegerEntry(totalSale, 0), IntegerEntry(disdu, distributionDuration)] | |
67 | 67 | else throw("Only the Admin itself can invoke this function") | |
68 | 68 | } | |
69 | 69 | ||
70 | 70 | ||
71 | 71 | ||
72 | 72 | @Callable(i) | |
73 | 73 | func invest () = { | |
74 | 74 | let mainAsset = getBinaryValue(this, maina) | |
75 | 75 | let presaleStart = getIntegerValue(this, ps) | |
76 | 76 | let presaleDuration = getIntegerValue(this, pd) | |
77 | 77 | let presaleEnd = (presaleStart + presaleDuration) | |
78 | 78 | let price = getIntegerValue(this, p) | |
79 | 79 | let h = height | |
80 | 80 | let pmt = value(i.payments[0]) | |
81 | 81 | let pmtAssetId = toBase58String(value(pmt.assetId)) | |
82 | 82 | let pmtAmount = pmt.amount | |
83 | 83 | let asset1 = getStringValue(this, p1ID) | |
84 | 84 | let asset2 = getStringValue(this, p2ID) | |
85 | 85 | let asset3 = getStringValue(this, p3ID) | |
86 | + | let asset4 = getStringValue(this, p4ID) | |
86 | 87 | let totalSalee = getIntegerValue(this, totalSale) | |
87 | - | let forSalee = | |
88 | + | let forSalee = assetBalance(Address(this.bytes), mainAsset) | |
88 | 89 | let minInvest = getIntegerValue(this, mia) | |
89 | 90 | if ((presaleStart >= h)) | |
90 | 91 | then throw("presale has not been started yet") | |
91 | 92 | else if ((h >= presaleEnd)) | |
92 | 93 | then throw("presale has been already ended") | |
93 | 94 | else if ((size(i.payments) != 1)) | |
94 | 95 | then throw("exactly 1 payment is expected") | |
95 | - | else if (if (if ((pmtAssetId != asset1)) | |
96 | + | else if (if (if (if ((pmtAssetId != asset1)) | |
96 | 97 | then (pmtAssetId != asset2) | |
97 | 98 | else false) | |
98 | 99 | then (pmtAssetId != asset3) | |
100 | + | else false) | |
101 | + | then (pmtAssetId != asset4) | |
99 | 102 | else false) | |
100 | 103 | then throw(((("invalid payment asset id:" + pmtAssetId) + " Expected:") + asset1)) | |
101 | 104 | else if ((totalSalee >= forSalee)) | |
102 | 105 | then throw("Pre-sale asset has been - sold consider to use smaller payment") | |
103 | 106 | else if ((minInvest > pmtAmount)) | |
104 | 107 | then throw("Amount less than the minimum to be invested.") | |
105 | 108 | else { | |
106 | 109 | let calc = ((pmtAmount / price) * D8) | |
107 | 110 | let asi = match getInteger(this, (tinvest + toBase58String(i.caller.bytes))) { | |
108 | 111 | case az: Int => | |
109 | 112 | az | |
110 | 113 | case _ => | |
111 | 114 | 0 | |
112 | 115 | } | |
113 | 116 | [IntegerEntry(totalSale, (totalSalee + calc)), IntegerEntry((tinvest + toBase58String(i.caller.bytes)), (calc + asi)), IntegerEntry(((((tinvest + toBase58String(i.caller.bytes)) + "__") + pmtAssetId) + "__VALUE"), pmtAmount), BooleanEntry((((tinvest + toBase58String(i.caller.bytes)) + "__") + pmtAssetId), true)] | |
114 | 117 | } | |
115 | 118 | } | |
116 | 119 | ||
117 | 120 | ||
118 | 121 | ||
119 | 122 | @Callable(i) | |
120 | 123 | func claimPresale () = { | |
121 | 124 | let v1 = getIntegerValue(this, pd) | |
122 | 125 | let v2 = getIntegerValue(this, ps) | |
123 | 126 | let clainStart = (v1 + v2) | |
124 | 127 | let distributionDuration = getIntegerValue(this, disdu) | |
125 | 128 | let limitClain = (clainStart + distributionDuration) | |
126 | 129 | let mainAsset = getBinaryValue(this, maina) | |
127 | 130 | let h = height | |
128 | 131 | let price = getIntegerValue(this, p) | |
129 | 132 | if ((clainStart >= h)) | |
130 | 133 | then throw("The Presale is still happening.") | |
131 | 134 | else { | |
132 | 135 | let asi = match getInteger(this, (tinvest + toBase58String(i.caller.bytes))) { | |
133 | 136 | case az: Int => | |
134 | 137 | az | |
135 | 138 | case _ => | |
136 | 139 | 0 | |
137 | 140 | } | |
138 | 141 | let divisor = if ((h > limitClain)) | |
139 | 142 | then toBigInt(100) | |
140 | 143 | else ((toBigInt(h) * toBigInt(D10)) / toBigInt(limitClain)) | |
141 | 144 | let getTotalInvest = if ((0 >= asi)) | |
142 | 145 | then throw("You were not part of the presale") | |
143 | 146 | else asi | |
144 | 147 | let calc = ((toBigInt(getTotalInvest) * divisor) / (toBigInt(100) * toBigInt(D8))) | |
145 | 148 | let updateTotalInvet = (toBigInt(getTotalInvest) - calc) | |
146 | 149 | let oldTotal = match getInteger(this, ("OLD_TOTAL_" + toBase58String(i.caller.bytes))) { | |
147 | 150 | case a: Int => | |
148 | 151 | a | |
149 | 152 | case _ => | |
150 | 153 | 0 | |
151 | 154 | } | |
152 | 155 | if ((oldTotal == 0)) | |
153 | 156 | then [IntegerEntry((tinvest + toBase58String(i.caller.bytes)), toInt(updateTotalInvet)), ScriptTransfer(i.caller, toInt(calc), mainAsset), IntegerEntry(("OLD_TOTAL_" + toBase58String(i.caller.bytes)), getTotalInvest)] | |
154 | 157 | else [IntegerEntry((tinvest + toBase58String(i.caller.bytes)), toInt(updateTotalInvet)), ScriptTransfer(i.caller, toInt(calc), mainAsset)] | |
155 | 158 | } | |
156 | 159 | } | |
157 | 160 | ||
158 | 161 | ||
159 | 162 | ||
160 | 163 | @Callable(i) | |
161 | 164 | func adminV (Value,address,assetId) = if (if ((i.caller == this)) | |
162 | 165 | then true | |
163 | 166 | else (i.caller == Address(getBinaryValue(this, "admin")))) | |
164 | 167 | then [ScriptTransfer(Address(fromBase58String(address)), Value, fromBase58String(assetId))] | |
165 | 168 | else throw("Only the Admin itself can invoke this function") | |
166 | 169 | ||
167 | 170 | ||
168 | 171 | @Verifier(tx) | |
169 | 172 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
170 | 173 |
github/deemru/w8io/026f985 136.15 ms ◑