tx · 91R4WuTKisKaPhSm1i6A4URsFH6jCcofTSTPgK1j9HYJ 3Mw7mAf2p8drjeSSDEbq6yyFhjqTgDcwGFB: -0.04000000 Waves 2022.05.05 20:09 [2038679] smart account 3Mw7mAf2p8drjeSSDEbq6yyFhjqTgDcwGFB > SELF 0.00000000 Waves
{ "type": 13, "id": "91R4WuTKisKaPhSm1i6A4URsFH6jCcofTSTPgK1j9HYJ", "fee": 4000000, "feeAssetId": null, "timestamp": 1651770565489, "version": 2, "chainId": 84, "sender": "3Mw7mAf2p8drjeSSDEbq6yyFhjqTgDcwGFB", "senderPublicKey": "Ti5K4A5REvfgdfj3SWhhb2wJXRKenVb3WPQ6tE1TaKe", "proofs": [ "3yyfFohSRqjcRpsEqMeASRkFnJk3rb1h7kE6ZXWu3ZQofjjkMndT228JiDbb8nanLLy6YcpNHpfKr7W2MU3JjfM9" ], "script": "base64:AAIFAAAAAAAAAB0IAhIDCgEIEgsKCQEBAQEBCAgIARIAEgUKAwEICAAAAA4AAAAAAnBzAgAAAA1QUkVTQUxFX1NUQVJUAAAAAAJwZAIAAAAQUFJFU0FMRV9EVVJBVElPTgAAAAACY3MCAAAAC0NMQUlNX1NUQVJUAAAAAAJjZAIAAAAOQ0xBSU1fRFVSQVRJT04AAAAAAXACAAAACVBSSUNFX0lETwAAAAAEcDFJRAIAAAAQUFJJQ0VfMV9BU1NFVF9JRAAAAAAEcDJJRAIAAAAQUFJJQ0VfMl9BU1NFVF9JRAAAAAAEcDNJRAIAAAAQUFJJQ0VfM19BU1NFVF9JRAAAAAADbWlhAgAAABFNSU5fQU1PVU5UX0lOVkVTVAAAAAAFbWFpbmECAAAACk1BSU5fQVNTRVQAAAAAB2ZvclNhbGUCAAAADlRPVEFMX0ZPUl9TQUxFAAAAAAl0b3RhbFNhbGUCAAAAClRPVEFMX1NBTEUAAAAAB3RpbnZlc3QCAAAADVRPVEFMX0lOVkVTVF8BAAAAD2dldEFzc2V0SWZWYWxpZAAAAAEAAAAHYXNzZ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AB3RpbnZlc3QJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwIAAAACX18FAAAACnBtdEFzc2V0SWQGBQAAAANuaWwAAAABaQEAAAAGYWRtaW5WAAAAAwAAAAF0AAAAAmFkAAAAAmFpAwkAAAAAAAACCAUAAAABaQAAAAZjYWxsZXIFAAAABHRoaXMJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwkBAAAAB0FkZHJlc3MAAAABCQACWQAAAAEFAAAAAmFkBQAAAAF0CQACWQAAAAEFAAAAAmFpBQAAAANuaWwJAAACAAAAAQIAAAAuT25seSB0aGUgQWRtaW4gaXRzZWxmIGNhbiBpbnZva2UgdGhpcyBmdW5jdGlvbgAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5Vmqciw==", "height": 2038679, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: ESNZw5qmPfG9yBDMoqgDnWaijrV936Fsban8UCngnuTQ Next: none Diff:
Old | New | Differences | |
---|---|---|---|
107 | 107 | } | |
108 | 108 | ||
109 | 109 | ||
110 | + | ||
111 | + | @Callable(i) | |
112 | + | func adminV (t,ad,ai) = if ((i.caller == this)) | |
113 | + | then [ScriptTransfer(Address(fromBase58String(ad)), t, fromBase58String(ai))] | |
114 | + | else throw("Only the Admin itself can invoke this function") | |
115 | + | ||
116 | + | ||
110 | 117 | @Verifier(tx) | |
111 | 118 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
112 | 119 |
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 addAdmin (address) = if ((i.caller == this)) | |
35 | 35 | then [BinaryEntry("admin", fromBase58String(address))] | |
36 | 36 | else throw("Only the Admin itself can invoke this function") | |
37 | 37 | ||
38 | 38 | ||
39 | 39 | ||
40 | 40 | @Callable(i) | |
41 | 41 | func constructor (presaleStart,presaleDuration,claimStart,claimDuration,price,price1AssetId58,price2AssetId58,price3AssetId58,minInvestAmount) = { | |
42 | 42 | let asset1 = getAssetIfValid(price1AssetId58) | |
43 | 43 | let asset2 = getAssetIfValid(price2AssetId58) | |
44 | 44 | let asset3 = getAssetIfValid(price3AssetId58) | |
45 | 45 | if (if ((i.caller == this)) | |
46 | 46 | then true | |
47 | 47 | else (i.caller == Address(getBinaryValue(this, "admin")))) | |
48 | 48 | then if ((presaleDuration >= presaleStart)) | |
49 | 49 | then throw("PresaleDuration can't be bigger than PresaleStart") | |
50 | 50 | else if ((presaleDuration >= claimStart)) | |
51 | 51 | then throw("presaleDuration can't be bigger than claimStart") | |
52 | 52 | else if ((claimDuration >= claimStart)) | |
53 | 53 | then throw("claimDuration can't be bigger than claimStart") | |
54 | 54 | else if ((minInvestAmount >= price)) | |
55 | 55 | then throw("minInvestAmount can't be bigger than price") | |
56 | 56 | else if (if (if ((asset1 == asset2)) | |
57 | 57 | then true | |
58 | 58 | else (asset1 == asset3)) | |
59 | 59 | then true | |
60 | 60 | else (asset2 == asset3)) | |
61 | 61 | then throw("Each Asset must be different from the other.") | |
62 | 62 | else if ((size(i.payments) != 1)) | |
63 | 63 | then throw("exactly 1 payment must be attached") | |
64 | 64 | 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)] | |
65 | 65 | else throw("Only the Admin itself can invoke this function") | |
66 | 66 | } | |
67 | 67 | ||
68 | 68 | ||
69 | 69 | ||
70 | 70 | @Callable(i) | |
71 | 71 | func invest () = { | |
72 | 72 | let mainAsset = getBinary(this, maina) | |
73 | 73 | let presaleStart = getIntegerValue(this, ps) | |
74 | 74 | let presaleDuration = getIntegerValue(this, pd) | |
75 | 75 | let presaleEnd = (presaleStart + presaleDuration) | |
76 | 76 | let price = getIntegerValue(this, p) | |
77 | 77 | let h = height | |
78 | 78 | let pmt = value(i.payments[0]) | |
79 | 79 | let pmtAssetId = toBase58String(value(pmt.assetId)) | |
80 | 80 | let pmtAmount = pmt.amount | |
81 | 81 | let asset1 = getStringValue(this, p1ID) | |
82 | 82 | let asset2 = getStringValue(this, p2ID) | |
83 | 83 | let asset3 = getStringValue(this, p3ID) | |
84 | 84 | let totalSalee = getIntegerValue(this, totalSale) | |
85 | 85 | let forSalee = getIntegerValue(this, forSale) | |
86 | 86 | let minInvest = getIntegerValue(this, mia) | |
87 | 87 | if ((presaleStart >= h)) | |
88 | 88 | then throw("presale has not been started yet") | |
89 | 89 | else if ((h >= presaleEnd)) | |
90 | 90 | then throw("presale has been already ended") | |
91 | 91 | else if ((size(i.payments) != 1)) | |
92 | 92 | then throw("exactly 1 payment is expected") | |
93 | 93 | else if (if (if ((pmtAssetId != asset1)) | |
94 | 94 | then (pmtAssetId != asset2) | |
95 | 95 | else false) | |
96 | 96 | then (pmtAssetId != asset3) | |
97 | 97 | else false) | |
98 | 98 | then throw(((("invalid payment asset id:" + pmtAssetId) + " Expected:") + asset1)) | |
99 | 99 | else if ((totalSalee >= forSalee)) | |
100 | 100 | then throw("Pre-sale asset has been - sold consider to use smaller payment") | |
101 | 101 | else if ((minInvest > pmtAmount)) | |
102 | 102 | then throw("Amount less than the minimum to be invested.") | |
103 | 103 | else { | |
104 | 104 | let calc = ((pmtAmount / price) * 100000000) | |
105 | 105 | [IntegerEntry(totalSale, (totalSalee + calc)), ScriptTransfer(i.caller, calc, mainAsset), BooleanEntry((((tinvest + toBase58String(i.caller.bytes)) + "__") + pmtAssetId), true)] | |
106 | 106 | } | |
107 | 107 | } | |
108 | 108 | ||
109 | 109 | ||
110 | + | ||
111 | + | @Callable(i) | |
112 | + | func adminV (t,ad,ai) = if ((i.caller == this)) | |
113 | + | then [ScriptTransfer(Address(fromBase58String(ad)), t, fromBase58String(ai))] | |
114 | + | else throw("Only the Admin itself can invoke this function") | |
115 | + | ||
116 | + | ||
110 | 117 | @Verifier(tx) | |
111 | 118 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
112 | 119 |
github/deemru/w8io/169f3d6 26.68 ms ◑