tx · HBPfn3XKJCRNCXJiBnPWVppmx8TE6SUGH3BrYnwho3bw 3Mw7mAf2p8drjeSSDEbq6yyFhjqTgDcwGFB: -0.04000000 Waves 2022.05.05 18:47 [2038595] smart account 3Mw7mAf2p8drjeSSDEbq6yyFhjqTgDcwGFB > SELF 0.00000000 Waves
{ "type": 13, "id": "HBPfn3XKJCRNCXJiBnPWVppmx8TE6SUGH3BrYnwho3bw", "fee": 4000000, "feeAssetId": null, "timestamp": 1651765646309, "version": 2, "chainId": 84, "sender": "3Mw7mAf2p8drjeSSDEbq6yyFhjqTgDcwGFB", "senderPublicKey": "Ti5K4A5REvfgdfj3SWhhb2wJXRKenVb3WPQ6tE1TaKe", "proofs": [ "2rxqyGdk3wMKvoHnJt6XUGd2cQqq2wpnF2rEBKKy5xkx8ybTJzytAdSfbw5vqazsgMR4JgFVb2n8MrRDfzHKPLA2" ], "script": "base64:AAIFAAAAAAAAABgIAhIDCgEIEgsKCQEBAQEBCAgIARIAEgAAAAAOAAAAAAJwcwIAAAANUFJFU0FMRV9TVEFSVAAAAAACcGQCAAAAEFBSRVNBTEVfRFVSQVRJT04AAAAAAmNzAgAAAAtDTEFJTV9TVEFSVAAAAAACY2QCAAAADkNMQUlNX0RVUkFUSU9OAAAAAAFwAgAAAAlQUklDRV9JRE8AAAAABHAxSUQCAAAAEFBSSUNFXzFfQVNTRVRfSUQAAAAABHAySUQCAAAAEFBSSUNFXzJfQVNTRVRfSUQAAAAABHAzSUQCAAAAEFBSSUNFXzNfQVNTRVRfSUQAAAAAA21pYQIAAAARTUlOX0FNT1VOVF9JTlZFU1QAAAAABW1haW5hAgAAAApNQUlOX0FTU0VUAAAAAAdmb3JTYWxlAgAAAA5UT1RBTF9GT1JfU0FMRQAAAAAJdG90YWxTYWxlAgAAAApUT1RBTF9TQUxFAAAAAAd0aW52ZXN0AgAAAA1UT1RBTF9JTlZFU1RfAQAAAA9nZXRBc3NldElmVmFsaWQAAAABAAAAB2Fzc2V0SWQJAAJYAA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c3NldAUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXkeaMJ1", "height": 2038595, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 37ueSBJtFKWQSaNpAYgSJUU4heZaNYL34xdL32ouqfms Next: A1PcvppsMLL2hUZUY3ufoEgLLBsf3SxmNP13yZ58Bpxk Diff:
Old | New | Differences | |
---|---|---|---|
31 | 31 | ||
32 | 32 | ||
33 | 33 | @Callable(i) | |
34 | + | func addAdmin (address) = if ((i.caller == this)) | |
35 | + | then [BinaryEntry("admin", fromBase58String(address))] | |
36 | + | else throw("Only the Admin itself can invoke this function") | |
37 | + | ||
38 | + | ||
39 | + | ||
40 | + | @Callable(i) | |
34 | 41 | func constructor (presaleStart,presaleDuration,claimStart,claimDuration,price,price1AssetId58,price2AssetId58,price3AssetId58,minInvestAmount) = { | |
35 | 42 | let asset1 = getAssetIfValid(price1AssetId58) | |
36 | 43 | let asset2 = getAssetIfValid(price2AssetId58) | |
37 | 44 | let asset3 = getAssetIfValid(price3AssetId58) | |
38 | - | if ((i.caller == this)) | |
45 | + | if (if ((i.caller == this)) | |
46 | + | then true | |
47 | + | else (i.caller == Address(getBinaryValue(this, "admin")))) | |
39 | 48 | then if ((presaleDuration >= presaleStart)) | |
40 | 49 | then throw("PresaleDuration can't be bigger than PresaleStart") | |
41 | 50 | else if ((presaleDuration >= claimStart)) |
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 | + | func addAdmin (address) = if ((i.caller == this)) | |
35 | + | then [BinaryEntry("admin", fromBase58String(address))] | |
36 | + | else throw("Only the Admin itself can invoke this function") | |
37 | + | ||
38 | + | ||
39 | + | ||
40 | + | @Callable(i) | |
34 | 41 | func constructor (presaleStart,presaleDuration,claimStart,claimDuration,price,price1AssetId58,price2AssetId58,price3AssetId58,minInvestAmount) = { | |
35 | 42 | let asset1 = getAssetIfValid(price1AssetId58) | |
36 | 43 | let asset2 = getAssetIfValid(price2AssetId58) | |
37 | 44 | let asset3 = getAssetIfValid(price3AssetId58) | |
38 | - | if ((i.caller == this)) | |
45 | + | if (if ((i.caller == this)) | |
46 | + | then true | |
47 | + | else (i.caller == Address(getBinaryValue(this, "admin")))) | |
39 | 48 | then if ((presaleDuration >= presaleStart)) | |
40 | 49 | then throw("PresaleDuration can't be bigger than PresaleStart") | |
41 | 50 | else if ((presaleDuration >= claimStart)) | |
42 | 51 | then throw("presaleDuration can't be bigger than claimStart") | |
43 | 52 | else if ((claimDuration >= claimStart)) | |
44 | 53 | then throw("claimDuration can't be bigger than claimStart") | |
45 | 54 | else if ((minInvestAmount >= price)) | |
46 | 55 | then throw("minInvestAmount can't be bigger than price") | |
47 | 56 | else if (if (if ((asset1 == asset2)) | |
48 | 57 | then true | |
49 | 58 | else (asset1 == asset3)) | |
50 | 59 | then true | |
51 | 60 | else (asset2 == asset3)) | |
52 | 61 | then throw("Each Asset must be different from the other.") | |
53 | 62 | else if ((size(i.payments) != 1)) | |
54 | 63 | then throw("exactly 1 payment must be attached") | |
55 | 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)] | |
56 | 65 | else throw("Only the Admin itself can invoke this function") | |
57 | 66 | } | |
58 | 67 | ||
59 | 68 | ||
60 | 69 | ||
61 | 70 | @Callable(i) | |
62 | 71 | func invest () = { | |
63 | 72 | let mainAsset = getBinary(this, maina) | |
64 | 73 | let presaleStart = getIntegerValue(this, ps) | |
65 | 74 | let presaleDuration = getIntegerValue(this, pd) | |
66 | 75 | let presaleEnd = (presaleStart + presaleDuration) | |
67 | 76 | let price = getIntegerValue(this, p) | |
68 | 77 | let h = height | |
69 | 78 | let pmt = value(i.payments[0]) | |
70 | 79 | let pmtAssetId = value(pmt.assetId) | |
71 | 80 | let pmtAmount = pmt.amount | |
72 | 81 | let asset1 = fromBase58String(getStringValue(this, p1ID)) | |
73 | 82 | let asset2 = fromBase58String(getStringValue(this, p2ID)) | |
74 | 83 | let asset3 = fromBase58String(getStringValue(this, p3ID)) | |
75 | 84 | let totalSalee = getIntegerValue(this, totalSale) | |
76 | 85 | let forSalee = getIntegerValue(this, forSale) | |
77 | 86 | let minInvest = getIntegerValue(this, mia) | |
78 | 87 | if ((presaleStart >= h)) | |
79 | 88 | then throw("presale has not been started yet") | |
80 | 89 | else if ((h >= presaleEnd)) | |
81 | 90 | then throw("presale has been already ended") | |
82 | 91 | else if ((size(i.payments) != 1)) | |
83 | 92 | then throw("exactly 1 payment is expected") | |
84 | 93 | else if (if (if ((pmtAssetId != asset1)) | |
85 | 94 | then true | |
86 | 95 | else (pmtAssetId != asset2)) | |
87 | 96 | then true | |
88 | 97 | else (pmtAssetId != asset3)) | |
89 | 98 | then throw("invalid payment asset id") | |
90 | 99 | else if ((totalSalee >= forSalee)) | |
91 | 100 | then throw("Pre-sale asset has been - sold consider to use smaller payment") | |
92 | 101 | else if ((minInvest > pmtAmount)) | |
93 | 102 | then throw("Amount less than the minimum to be invested.") | |
94 | 103 | else { | |
95 | 104 | let getTInvest = valueOrElse(getIntegerValue(this, (tinvest + toBase58String(i.caller.bytes))), 0) | |
96 | 105 | let calc = (pmtAmount / price) | |
97 | 106 | let totalAmount = (pmtAmount + getTInvest) | |
98 | 107 | [IntegerEntry((tinvest + toBase58String(i.caller.bytes)), totalAmount), IntegerEntry(totalSale, (totalSalee + calc)), BooleanEntry((((tinvest + toBase58String(i.caller.bytes)) + "__") + toBase58String(pmtAssetId)), true)] | |
99 | 108 | } | |
100 | 109 | } | |
101 | 110 | ||
102 | 111 | ||
103 | 112 | ||
104 | 113 | @Callable(i) | |
105 | 114 | func claimPresale () = { | |
106 | 115 | let mainAsset = getBinary(this, maina) | |
107 | 116 | let h = height | |
108 | 117 | let clainStart = getIntegerValue(this, cs) | |
109 | 118 | let clainDuration = getIntegerValue(this, cd) | |
110 | 119 | let clainEnd = (clainStart + clainDuration) | |
111 | 120 | let price = getIntegerValue(this, p) | |
112 | 121 | if ((clainStart >= h)) | |
113 | 122 | then throw("The Presale is still happening.") | |
114 | 123 | else if ((h > clainEnd)) | |
115 | 124 | then { | |
116 | 125 | let getTInvest = valueOrErrorMessage(getIntegerValue(this, (tinvest + toBase58String(i.caller.bytes))), "You were not part of the presale") | |
117 | 126 | let calc = (getTInvest / price) | |
118 | 127 | let distri = (calc / clainDuration) | |
119 | 128 | let hSolicitatin = valueOrElse(getIntegerValue(this, ((tinvest + toBase58String(i.caller.bytes)) + "_HISTORY")), 0) | |
120 | 129 | let diferencH = (clainDuration - hSolicitatin) | |
121 | 130 | let finalValue = (distri * diferencH) | |
122 | 131 | [IntegerEntry(((tinvest + toBase58String(i.caller.bytes)) + "_HISTORY"), (h - clainStart)), IntegerEntry((tinvest + toBase58String(i.caller.bytes)), (getTInvest - (finalValue * price))), ScriptTransfer(i.caller, finalValue, mainAsset)] | |
123 | 132 | } | |
124 | 133 | else { | |
125 | 134 | let getTInvest = valueOrErrorMessage(getIntegerValue(this, (tinvest + toBase58String(i.caller.bytes))), "You were not part of the presale") | |
126 | 135 | let calc = (getTInvest / price) | |
127 | 136 | let distri = (calc / clainDuration) | |
128 | 137 | let hSolicitatin = valueOrElse(getIntegerValue(this, ((tinvest + toBase58String(i.caller.bytes)) + "_HISTORY")), 0) | |
129 | 138 | let diferencH = ((clainDuration - hSolicitatin) - (h - clainStart)) | |
130 | 139 | let finalValue = (distri * diferencH) | |
131 | 140 | [IntegerEntry(((tinvest + toBase58String(i.caller.bytes)) + "_HISTORY"), (h - clainStart)), IntegerEntry((tinvest + toBase58String(i.caller.bytes)), (getTInvest - (finalValue * price))), ScriptTransfer(i.caller, finalValue, mainAsset)] | |
132 | 141 | } | |
133 | 142 | } | |
134 | 143 | ||
135 | 144 | ||
136 | 145 | @Verifier(tx) | |
137 | 146 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
138 | 147 |
github/deemru/w8io/169f3d6 29.25 ms ◑