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