tx · 7TiS2YNcrFD46uNRk1wMUazwgz6i9MFC5TgDbRGsotT7 3Mtb4XjrpoT181pEmn2kF73PTm4vjMoRoVS: -0.01300000 Waves 2023.05.10 13:15 [2571655] smart account 3Mtb4XjrpoT181pEmn2kF73PTm4vjMoRoVS > SELF 0.00000000 Waves
{ "type": 13, "id": "7TiS2YNcrFD46uNRk1wMUazwgz6i9MFC5TgDbRGsotT7", "fee": 1300000, "feeAssetId": null, "timestamp": 1683713758920, "version": 2, "chainId": 84, "sender": "3Mtb4XjrpoT181pEmn2kF73PTm4vjMoRoVS", "senderPublicKey": "Edx9ZQDtX2gxHL28zDigjvqpeQqJ9X6Mh7ZxyVRDkjHr", "proofs": [ "3vi7y5xNPXCTbPdpxrUm9xyyXqLQ2tGCw1RZGYQayedtBPj7Xx6F2aaXcZmtinTN3RBRYdQvomjL9sbU9VGk6ydf" ], "script": "base64:AAIFAAAAAAAABocIAhIFCgMBAQgSAwoBARIAEgMKAQEiA1NFUCILa2V5UmVmZXJyYWwiDGtleVd4QXNzZXRJZCITa2V5TWFuYWdlclB1YmxpY0tleSIWa2V5TWFuYWdlclZhdWx0QWRkcmVzcyIVSWR4Q2ZnQ2xhaW1TdGFydEJsb2NrIhhJZHhDZmdDbGFpbVZlc3RpbmdQZXJpb2QiEklkeENmZ0NsYWltQXNzZXRJZCIUSWR4Q2ZnQ2xhaW1Bc3NldE11bHQiFUlkeENmZ0NsYWltQXNzZXRPd25lciIbSWR4Q2ZnQ2xhaW1Bc3NldFRvdGFsQW1vdW50IhtJZHhUb3RhbHNUb3RhbENsYWltZWRBbW91bnQiGElkeFRvdGFsc1JlbWFpbmluZ0Ftb3VudCIaSWR4VG90YWxzTGFzdENsYWltZWRIZWlnaHQiCHRocm93RXJyIgNtc2ciD2dldFN0cmluZ09yRmFpbCIDa2V5IhJmb3JtYXRDb25maWdTdHJpbmciD2NsYWltU3RhcnRCbG9jayINdmVzdGluZ1BlcmlvZCINYXNzZXRJZEJhc2U1OCIJYXN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AAAANdHJhbnNhY3Rpb25JZAUAAAADbmlsBQAAAAR1bml0CQAAAgAAAAECAAAAJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgAAAAEAAAACYVMBAAAAAmFUAAAAAAQAAAACYVUEAAAAAVYJAQAAAAJhaQAAAAADCQAAAQAAAAIFAAAAAVYCAAAACkJ5dGVWZWN0b3IEAAAAAmFuBQAAAAFWBQAAAAJhbgMJAAABAAAAAgUAAAABVgIAAAAEVW5pdAgFAAAAAmFTAAAAD3NlbmRlclB1YmxpY0tleQkAAAIAAAABAgAAAAtNYXRjaCBlcnJvcgkAAfQAAAADCAUAAAACYVMAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJhUwAAAAZwcm9vZnMAAAAAAAAAAAAFAAAAAmFVtU9pKA==", "height": 2571655, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CcTwqBsw6WEHhh8CgkaxxDkETPAH6NWroZNnNMP9uvPn Next: none Diff:
Old | New | Differences | |
---|---|---|---|
66 | 66 | func readTotalsArray () = split(getStringOrFail(keyTotals()), SEP) | |
67 | 67 | ||
68 | 68 | ||
69 | - | func getManagerAddressOrFail () = addressFromStringValue(getStringValue(keyManagerVaultAddress())) | |
69 | + | func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) { | |
70 | + | case s: String => | |
71 | + | addressFromStringValue(s) | |
72 | + | case _ => | |
73 | + | this | |
74 | + | } | |
70 | 75 | ||
71 | 76 | ||
72 | 77 | func TotalsEntry (key,origArray,claimedAmt,newLastClaimedHeight) = { | |
85 | 90 | ||
86 | 91 | ||
87 | 92 | func managerPublicKeyOrUnit () = { | |
88 | - | let managerVaultAddress = | |
93 | + | let managerVaultAddress = getManagerVaultAddressOrThis() | |
89 | 94 | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
90 | 95 | case s: String => | |
91 | 96 | fromBase58String(s) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SEP = "__" | |
5 | 5 | ||
6 | 6 | let keyReferral = makeString(["%s", "referral"], SEP) | |
7 | 7 | ||
8 | 8 | let keyWxAssetId = makeString(["%s", "wxAssetId"], SEP) | |
9 | 9 | ||
10 | 10 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
11 | 11 | ||
12 | 12 | ||
13 | 13 | func keyManagerVaultAddress () = "%s__managerVaultAddress" | |
14 | 14 | ||
15 | 15 | ||
16 | 16 | let IdxCfgClaimStartBlock = 1 | |
17 | 17 | ||
18 | 18 | let IdxCfgClaimVestingPeriod = 2 | |
19 | 19 | ||
20 | 20 | let IdxCfgClaimAssetId = 3 | |
21 | 21 | ||
22 | 22 | let IdxCfgClaimAssetMult = 4 | |
23 | 23 | ||
24 | 24 | let IdxCfgClaimAssetOwner = 5 | |
25 | 25 | ||
26 | 26 | let IdxCfgClaimAssetTotalAmount = 6 | |
27 | 27 | ||
28 | 28 | let IdxTotalsTotalClaimedAmount = 1 | |
29 | 29 | ||
30 | 30 | let IdxTotalsRemainingAmount = 2 | |
31 | 31 | ||
32 | 32 | let IdxTotalsLastClaimedHeight = 3 | |
33 | 33 | ||
34 | 34 | func throwErr (msg) = throw(makeString(["marketing.ride:", msg], " ")) | |
35 | 35 | ||
36 | 36 | ||
37 | 37 | func getStringOrFail (key) = valueOrErrorMessage(getString(key), (("mandatory this." + key) + " is not defined")) | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func formatConfigString (claimStartBlock,vestingPeriod,assetIdBase58,assetMult,assetOwner,assetTotalAmt) = makeString(["%d%d%s%d%s%d%", claimStartBlock, vestingPeriod, assetIdBase58, assetMult, assetOwner, assetTotalAmt], SEP) | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | func formatConfig (claimStartBlock,vestingPeriod,assetIdBase58,assetMult,claimAssetOwner,claimAssetTotalAmount) = formatConfigString(toString(claimStartBlock), toString(vestingPeriod), assetIdBase58, toString(assetMult), claimAssetOwner, toString(claimAssetTotalAmount)) | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func formatTotalsString (totalClaimedAmount,remainingAmountForClaim,lastClaimedHeight) = makeString(["%d%d%d", totalClaimedAmount, remainingAmountForClaim, lastClaimedHeight], SEP) | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | func formatHistoryRecord (claimedAssetAmount,claimingBlocks,firstCalulationBlock,lastCalulationBlock) = makeString(["%d%d%d%d%d%d", toString(height), toString(lastBlock.timestamp), toString(claimedAssetAmount), toString(claimingBlocks), toString(firstCalulationBlock), toString(lastCalulationBlock)], SEP) | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func keyConfig () = "%s__config" | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | func keyTotals () = "%s__totals" | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | let keyAmountUnclaimed = makeString(["%s", "amountUnclaimed"], SEP) | |
59 | 59 | ||
60 | 60 | func keyOperationHistoryRecord (type,userAddress,txId58) = makeString(["%s%s%s%s__history", type, userAddress, txId58], SEP) | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | func readConfigArray () = split(getStringOrFail(keyConfig()), SEP) | |
64 | 64 | ||
65 | 65 | ||
66 | 66 | func readTotalsArray () = split(getStringOrFail(keyTotals()), SEP) | |
67 | 67 | ||
68 | 68 | ||
69 | - | func getManagerAddressOrFail () = addressFromStringValue(getStringValue(keyManagerVaultAddress())) | |
69 | + | func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) { | |
70 | + | case s: String => | |
71 | + | addressFromStringValue(s) | |
72 | + | case _ => | |
73 | + | this | |
74 | + | } | |
70 | 75 | ||
71 | 76 | ||
72 | 77 | func TotalsEntry (key,origArray,claimedAmt,newLastClaimedHeight) = { | |
73 | 78 | let totalClaimedAmount = parseIntValue(origArray[IdxTotalsTotalClaimedAmount]) | |
74 | 79 | let remainingAmount = parseIntValue(origArray[IdxTotalsRemainingAmount]) | |
75 | 80 | let lastClaimedHeight = parseIntValue(origArray[IdxTotalsLastClaimedHeight]) | |
76 | 81 | let newTotalClaimedAmount = (totalClaimedAmount + claimedAmt) | |
77 | 82 | let newRemainingAmount = (remainingAmount - claimedAmt) | |
78 | 83 | if ((0 > newRemainingAmount)) | |
79 | 84 | then throw("invalid math") | |
80 | 85 | else StringEntry(key, formatTotalsString(toString(newTotalClaimedAmount), toString(newRemainingAmount), toString(newLastClaimedHeight))) | |
81 | 86 | } | |
82 | 87 | ||
83 | 88 | ||
84 | 89 | func ClaimOperationHistoryEntry (userAddress,claimedAssetAmount,claimingBlocks,firstCalculationBlock,lastCalculationBlock,txId) = StringEntry(keyOperationHistoryRecord("claim", userAddress, toBase58String(txId)), formatHistoryRecord(claimedAssetAmount, claimingBlocks, firstCalculationBlock, lastCalculationBlock)) | |
85 | 90 | ||
86 | 91 | ||
87 | 92 | func managerPublicKeyOrUnit () = { | |
88 | - | let managerVaultAddress = | |
93 | + | let managerVaultAddress = getManagerVaultAddressOrThis() | |
89 | 94 | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
90 | 95 | case s: String => | |
91 | 96 | fromBase58String(s) | |
92 | 97 | case _: Unit => | |
93 | 98 | unit | |
94 | 99 | case _ => | |
95 | 100 | throw("Match error") | |
96 | 101 | } | |
97 | 102 | } | |
98 | 103 | ||
99 | 104 | ||
100 | 105 | func mustManager (i) = { | |
101 | 106 | let pd = throwErr("permission denied") | |
102 | 107 | match managerPublicKeyOrUnit() { | |
103 | 108 | case pk: ByteVector => | |
104 | 109 | if ((i.callerPublicKey == pk)) | |
105 | 110 | then true | |
106 | 111 | else pd | |
107 | 112 | case _: Unit => | |
108 | 113 | if ((i.caller == this)) | |
109 | 114 | then true | |
110 | 115 | else pd | |
111 | 116 | case _ => | |
112 | 117 | throw("Match error") | |
113 | 118 | } | |
114 | 119 | } | |
115 | 120 | ||
116 | 121 | ||
117 | 122 | func claimCommon (i,amount) = { | |
118 | 123 | let cfgArray = readConfigArray() | |
119 | 124 | let cfgClaimStartHeight = parseIntValue(cfgArray[IdxCfgClaimStartBlock]) | |
120 | 125 | let cfgClaimDuration = parseIntValue(cfgArray[IdxCfgClaimVestingPeriod]) | |
121 | 126 | let cfgClaimEnd = (cfgClaimStartHeight + cfgClaimDuration) | |
122 | 127 | let cfgClaimAssetId = fromBase58String(cfgArray[IdxCfgClaimAssetId]) | |
123 | 128 | let cfgClaimAssetOwner = addressFromStringValue(cfgArray[IdxCfgClaimAssetOwner]) | |
124 | 129 | let cfgClaimAssetTotalAmount = parseIntValue(cfgArray[IdxCfgClaimAssetTotalAmount]) | |
125 | 130 | let origTotalsArray = readTotalsArray() | |
126 | 131 | let totalClaimedAmount = parseIntValue(origTotalsArray[IdxTotalsTotalClaimedAmount]) | |
127 | 132 | let totalRemainingAmount = parseIntValue(origTotalsArray[IdxTotalsRemainingAmount]) | |
128 | 133 | let lastClaimedHeight = parseIntValue(origTotalsArray[IdxTotalsLastClaimedHeight]) | |
129 | 134 | if ((i.caller != cfgClaimAssetOwner)) | |
130 | 135 | then throw("permissions denied") | |
131 | 136 | else if ((cfgClaimStartHeight > height)) | |
132 | 137 | then throw(("Wait claim start block: " + toString(cfgClaimStartHeight))) | |
133 | 138 | else { | |
134 | 139 | let lastCalulationBlock = if ((height > cfgClaimEnd)) | |
135 | 140 | then cfgClaimEnd | |
136 | 141 | else height | |
137 | 142 | let firstCalulationBlock = if ((lastClaimedHeight == 0)) | |
138 | 143 | then cfgClaimStartHeight | |
139 | 144 | else lastClaimedHeight | |
140 | 145 | let claimingBlocks = (lastCalulationBlock - firstCalulationBlock) | |
141 | 146 | let amountAvailable = fraction(cfgClaimAssetTotalAmount, claimingBlocks, cfgClaimDuration) | |
142 | 147 | let amountUnclaimed = valueOrElse(getInteger(this, keyAmountUnclaimed), 0) | |
143 | 148 | let amountAvailableTotal = (amountAvailable + amountUnclaimed) | |
144 | 149 | let amountToClaim = if (if ((0 >= amount)) | |
145 | 150 | then true | |
146 | 151 | else (amount >= amountAvailableTotal)) | |
147 | 152 | then amountAvailableTotal | |
148 | 153 | else amount | |
149 | 154 | let amountUnclaimedNew = (amountAvailableTotal - amountToClaim) | |
150 | 155 | $Tuple2([IntegerEntry(keyAmountUnclaimed, amountUnclaimedNew), ScriptTransfer(cfgClaimAssetOwner, amountToClaim, cfgClaimAssetId), TotalsEntry(keyTotals(), readTotalsArray(), amountToClaim, lastCalulationBlock), ClaimOperationHistoryEntry(toString(cfgClaimAssetOwner), amountToClaim, claimingBlocks, firstCalulationBlock, lastCalulationBlock, i.transactionId)], amountToClaim) | |
151 | 156 | } | |
152 | 157 | } | |
153 | 158 | ||
154 | 159 | ||
155 | 160 | @Callable(i) | |
156 | 161 | func constructor (claimStartBlock,vestingPeriodBlocks,beneficiaryAddress) = { | |
157 | 162 | let vestingEnd = (claimStartBlock + vestingPeriodBlocks) | |
158 | 163 | if (isDefined(getString(keyConfig()))) | |
159 | 164 | then throw("already initialized") | |
160 | 165 | else if ((size(i.payments) != 1)) | |
161 | 166 | then throw("exactly 1 payment must be attached") | |
162 | 167 | else if ((i.callerPublicKey != base58'2Cbd8ozG7A1RyRNC3nNnZgHu7Ru4K3JCfpyPkhqr9zxq')) | |
163 | 168 | then throw("not authorized") | |
164 | 169 | else { | |
165 | 170 | let beneficiaryAddressParsed = valueOrErrorMessage(addressFromString(beneficiaryAddress), "Invalid beneficiarAddress passed") | |
166 | 171 | let pmt = value(i.payments[0]) | |
167 | 172 | let claimAssetId = value(pmt.assetId) | |
168 | 173 | let claimAssetInfo = valueOrErrorMessage(assetInfo(claimAssetId), "fail to load ido asset info") | |
169 | 174 | let claimAssetId58 = toBase58String(claimAssetId) | |
170 | 175 | let claimAssetMult = pow(10, 0, claimAssetInfo.decimals, 0, 0, DOWN) | |
171 | 176 | let claimAssetAmount = pmt.amount | |
172 | 177 | [StringEntry(keyConfig(), formatConfig(claimStartBlock, vestingPeriodBlocks, claimAssetId58, claimAssetMult, toString(beneficiaryAddressParsed), claimAssetAmount)), StringEntry(keyTotals(), formatTotalsString("0", toString(claimAssetAmount), "0"))] | |
173 | 178 | } | |
174 | 179 | } | |
175 | 180 | ||
176 | 181 | ||
177 | 182 | ||
178 | 183 | @Callable(i) | |
179 | 184 | func claimAmount (amount) = claimCommon(i, amount) | |
180 | 185 | ||
181 | 186 | ||
182 | 187 | ||
183 | 188 | @Callable(i) | |
184 | 189 | func claim () = claimCommon(i, -1) | |
185 | 190 | ||
186 | 191 | ||
187 | 192 | ||
188 | 193 | @Callable(i) | |
189 | 194 | func withdrawReferralReward (wxAmount) = { | |
190 | 195 | let referralContractAddress = value(getString(keyReferral)) | |
191 | 196 | let mustReferral = if ((toString(i.caller) == referralContractAddress)) | |
192 | 197 | then true | |
193 | 198 | else throwErr("permission denied") | |
194 | 199 | if ((mustReferral == mustReferral)) | |
195 | 200 | then { | |
196 | 201 | let wxAssetId = fromBase58String(value(getString(keyWxAssetId))) | |
197 | 202 | $Tuple2([ScriptTransfer(i.caller, wxAmount, wxAssetId), ClaimOperationHistoryEntry(referralContractAddress, wxAmount, 0, 0, 0, i.transactionId)], unit) | |
198 | 203 | } | |
199 | 204 | else throw("Strict value is not equal to itself.") | |
200 | 205 | } | |
201 | 206 | ||
202 | 207 | ||
203 | 208 | @Verifier(tx) | |
204 | 209 | func verify () = { | |
205 | 210 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
206 | 211 | case pk: ByteVector => | |
207 | 212 | pk | |
208 | 213 | case _: Unit => | |
209 | 214 | tx.senderPublicKey | |
210 | 215 | case _ => | |
211 | 216 | throw("Match error") | |
212 | 217 | } | |
213 | 218 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
214 | 219 | } | |
215 | 220 |
github/deemru/w8io/169f3d6 40.80 ms ◑