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