tx · G285r46tSuMg9yucW93eUPK4q7nMHQGVsjm9619AVBcv 3MzXFBjGLZudqVTFZ17kQF1GhcxCTiKDDqm: -0.01000000 Waves 2023.02.20 19:46 [2458232] smart account 3MzXFBjGLZudqVTFZ17kQF1GhcxCTiKDDqm > SELF 0.00000000 Waves
{ "type": 13, "id": "G285r46tSuMg9yucW93eUPK4q7nMHQGVsjm9619AVBcv", "fee": 1000000, "feeAssetId": null, "timestamp": 1676911603144, "version": 2, "chainId": 84, "sender": "3MzXFBjGLZudqVTFZ17kQF1GhcxCTiKDDqm", "senderPublicKey": "8kUUfDQiiGRg8yNumNry35jd9Bi4kWkPGEWD8LsDVK9b", "proofs": [ "3iGPkRSLG3efBnHTgJX7FqgDucq1GRJn4HmmBmQLtnLNRwM83gVL9hrYNwzTQ1c4zFEwVEqz6kNavVfqPbK693Ng" ], "script": "base64:AAIFAAAAAAAAAB8IAhIDCgEIEgsKCQEBAQEICAgIARIAEgASBQoDAQEBAAAAEwAAAAACcHMCAAAADVBSRVNBTEVfU1RBUlQAAAAAAnBkAgAAABBQUkVTQUxFX0RVUkFUSU9OAAAAAAJjcwIAAAALQ0xBSU1fU1RBUlQAAAAAAmNkAgAAAA5DTEFJTV9EVVJBVElPTgAAAAABcAIAAAAJUFJJQ0VfSURPAAAAAARwMUlEAgAAABBQUklDRV8xX0FTU0VUX0lEAAAAAAphZG1pbkVycm9yAgAAAC5Pbmx5IHRoZSBBZG1pbiBpdHNlbGYgY2FuIGludm9rZSB0aGlzIGZ1bmN0aW9uAAAAAARwMklEAgAAABBQUklDRV8yX0FTU0VUX0lEAAAAAARwM0lEAgAAABBQUklDRV8zX0FTU0VUX0lEAAAAAARwNElEAgAAABBQUklDRV80X0FTU0VUX0lEAAAAAANtaWECAAAAEU1JTl9BTU9VTlRfSU5WRVNUAAAAAAVtYWluYQIAAAAKTUFJTl9BU1NFVAAAAAAHZm9yU2FsZQIAAAAOVE9UQUxfRk9SX1NBTEUAAAAACXRvdGFsU2FsZQ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l2ZSgxMDUyKQAAAAIFAAAABHRoaXMCAAAABWFkbWluAwkAAGcAAAACBQAAAA9wcmVzYWxlRHVyYXRpb24FAAAADHByZXNhbGVTdGFydAkAAAIAAAABAgAAADJQcmVzYWxlRHVyYXRpb24gY2FuJ3QgYmUgYmlnZ2VyIHRoYW4gIFByZXNhbGVTdGFydAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgUAAAACcHMFAAAADHByZXNhbGVTdGFydAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgUAAAACcGQFAAAAD3ByZXNhbGVEdXJhdGlvbgkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgUAAAAFZGlzZHUFAAAAFGRpc3RyaWJ1dGlvbkR1cmF0aW9uBQAAAANuaWwJAAACAAAAAQUAAAAKYWRtaW5FcnJvcgAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5FmILrA==", "height": 2458232, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let ps = "PRESALE_START" | |
5 | + | ||
6 | + | let pd = "PRESALE_DURATION" | |
7 | + | ||
8 | + | let cs = "CLAIM_START" | |
9 | + | ||
10 | + | let cd = "CLAIM_DURATION" | |
11 | + | ||
12 | + | let p = "PRICE_IDO" | |
13 | + | ||
14 | + | let p1ID = "PRICE_1_ASSET_ID" | |
15 | + | ||
16 | + | let adminError = "Only the Admin itself can invoke this function" | |
17 | + | ||
18 | + | let p2ID = "PRICE_2_ASSET_ID" | |
19 | + | ||
20 | + | let p3ID = "PRICE_3_ASSET_ID" | |
21 | + | ||
22 | + | let p4ID = "PRICE_4_ASSET_ID" | |
23 | + | ||
24 | + | let mia = "MIN_AMOUNT_INVEST" | |
25 | + | ||
26 | + | let maina = "MAIN_ASSET" | |
27 | + | ||
28 | + | let forSale = "TOTAL_FOR_SALE" | |
29 | + | ||
30 | + | let totalSale = "TOTAL_SALE" | |
31 | + | ||
32 | + | let tinvest = "TOTAL_INVEST_" | |
33 | + | ||
34 | + | let disdu = "DISTRIBUTION_DURATION" | |
35 | + | ||
36 | + | let D8 = 100000000 | |
37 | + | ||
38 | + | let D10 = 10000000000 | |
39 | + | ||
40 | + | func getAssetIfValid (assetId) = toBase58String(valueOrErrorMessage(value(assetInfo(fromBase58String(assetId))).id, (("Asset Id: " + assetId) + " is invalid."))) | |
41 | + | ||
42 | + | ||
43 | + | @Callable(i) | |
44 | + | func addAdmin (address) = if ((i.caller == this)) | |
45 | + | then [BinaryEntry("admin", fromBase58String(address))] | |
46 | + | else throw(adminError) | |
47 | + | ||
48 | + | ||
49 | + | ||
50 | + | @Callable(i) | |
51 | + | func constructor (presaleStart,presaleDuration,distributionDuration,price,price1AssetId58,price2AssetId58,price3AssetId58,price4AssetId58,minInvestAmount) = { | |
52 | + | let asset1 = getAssetIfValid(price1AssetId58) | |
53 | + | let asset2 = getAssetIfValid(price2AssetId58) | |
54 | + | let asset3 = getAssetIfValid(price3AssetId58) | |
55 | + | if (if ((i.caller == this)) | |
56 | + | then true | |
57 | + | else (i.caller.bytes == getBinaryValue(this, "admin"))) | |
58 | + | then if ((presaleDuration >= presaleStart)) | |
59 | + | then throw("PresaleDuration can't be bigger than PresaleStart") | |
60 | + | else if ((minInvestAmount > price)) | |
61 | + | then throw("minInvestAmount can't be bigger than price") | |
62 | + | else if (if (if ((asset1 == asset2)) | |
63 | + | then true | |
64 | + | else (asset1 == asset3)) | |
65 | + | then true | |
66 | + | else (asset2 == asset3)) | |
67 | + | then throw("Each Asset must be different from the other.") | |
68 | + | else [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)] | |
69 | + | else throw(adminError) | |
70 | + | } | |
71 | + | ||
72 | + | ||
73 | + | ||
74 | + | @Callable(i) | |
75 | + | func set () = if (if ((i.caller == this)) | |
76 | + | then true | |
77 | + | else (i.caller.bytes == getBinaryValue(this, "admin"))) | |
78 | + | then if ((size(i.payments) != 1)) | |
79 | + | then throw("exactly 1 payment must be attached") | |
80 | + | else [IntegerEntry(forSale, value(i.payments[0]).amount), BinaryEntry(maina, value(i.payments[0].assetId))] | |
81 | + | else throw(adminError) | |
82 | + | ||
83 | + | ||
84 | + | ||
85 | + | @Callable(i) | |
86 | + | func invest () = { | |
87 | + | let mainAsset = getBinaryValue(this, maina) | |
88 | + | let presaleStart = getIntegerValue(this, ps) | |
89 | + | let presaleDuration = getIntegerValue(this, pd) | |
90 | + | let presaleEnd = (presaleStart + presaleDuration) | |
91 | + | let price = getIntegerValue(this, p) | |
92 | + | let h = height | |
93 | + | let pmt = value(i.payments[0]) | |
94 | + | let pmtAssetId = toBase58String(value(pmt.assetId)) | |
95 | + | let pmtAmount = pmt.amount | |
96 | + | let asset1 = getStringValue(this, p1ID) | |
97 | + | let asset2 = getStringValue(this, p2ID) | |
98 | + | let asset3 = getStringValue(this, p3ID) | |
99 | + | let asset4 = getStringValue(this, p4ID) | |
100 | + | let totalSalee = getIntegerValue(this, totalSale) | |
101 | + | let forSalee = getIntegerValue(this, forSale) | |
102 | + | let minInvest = getIntegerValue(this, mia) | |
103 | + | if ((presaleStart >= h)) | |
104 | + | then throw("presale has not been started yet") | |
105 | + | else if ((h >= presaleEnd)) | |
106 | + | then throw("presale has been already ended") | |
107 | + | else if ((size(i.payments) != 1)) | |
108 | + | then throw("exactly 1 payment is expected") | |
109 | + | else if (if (if (if ((pmtAssetId != asset1)) | |
110 | + | then (pmtAssetId != asset2) | |
111 | + | else false) | |
112 | + | then (pmtAssetId != asset3) | |
113 | + | else false) | |
114 | + | then (pmtAssetId != asset4) | |
115 | + | else false) | |
116 | + | then throw(((("invalid payment asset id:" + pmtAssetId) + " Expected:") + asset1)) | |
117 | + | else if ((totalSalee >= forSalee)) | |
118 | + | then throw("Pre-sale asset has been - sold consider to use smaller payment") | |
119 | + | else if ((minInvest > pmtAmount)) | |
120 | + | then throw("Amount less than the minimum to be invested.") | |
121 | + | else { | |
122 | + | let calc = ((pmtAmount / price) * D8) | |
123 | + | let asi = match getInteger(this, (tinvest + toBase58String(i.caller.bytes))) { | |
124 | + | case az: Int => | |
125 | + | az | |
126 | + | case _ => | |
127 | + | 0 | |
128 | + | } | |
129 | + | [ScriptTransfer(i.caller, calc, mainAsset), 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)] | |
130 | + | } | |
131 | + | } | |
132 | + | ||
133 | + | ||
134 | + | ||
135 | + | @Callable(i) | |
136 | + | func time (presaleStart,presaleDuration,distributionDuration) = if (if ((i.caller == this)) | |
137 | + | then true | |
138 | + | else (i.caller.bytes == getBinaryValue(this, "admin"))) | |
139 | + | then if ((presaleDuration >= presaleStart)) | |
140 | + | then throw("PresaleDuration can't be bigger than PresaleStart") | |
141 | + | else [IntegerEntry(ps, presaleStart), IntegerEntry(pd, presaleDuration), IntegerEntry(disdu, distributionDuration)] | |
142 | + | else throw(adminError) | |
143 | + | ||
144 | + | ||
145 | + | @Verifier(tx) | |
146 | + | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
147 | + |
github/deemru/w8io/169f3d6 34.34 ms ◑