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:AAIFAAAAAAAABocIAhIFCgMBAQgSAwoBARIAEgMKAQEiA1NFUCILa2V5UmVmZXJyYWwiDGtleVd4QXNzZXRJZCITa2V5TWFuYWdlclB1YmxpY0tleSIWa2V5TWFuYWdlclZhdWx0QWRkcmVzcyIVSWR4Q2ZnQ2xhaW1TdGFydEJsb2NrIhhJZHhDZmdDbGFpbVZlc3RpbmdQZXJpb2QiEklkeENmZ0NsYWltQXNzZXRJZCIUSWR4Q2ZnQ2xhaW1Bc3NldE11bHQiFUlkeENmZ0NsYWltQXNzZXRPd25lciIbSWR4Q2ZnQ2xhaW1Bc3NldFRvdGFsQW1vdW50IhtJZHhUb3RhbHNUb3RhbENsYWltZWRBbW91bnQiGElkeFRvdGFsc1JlbWFpbmluZ0Ftb3VudCIaSWR4VG90YWxzTGFzdENsYWltZWRIZWlnaHQiCHRocm93RXJyIgNtc2ciD2dldFN0cmluZ09yRmFpbCIDa2V5IhJmb3JtYXRDb25maWdTdHJpbmciD2NsYWltU3RhcnRCbG9jayINdmVzdGluZ1BlcmlvZCINYXNzZXRJZEJhc2U1OCIJYX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wAAAANdHJhbnNhY3Rpb25JZAUAAAADbmlsBQAAAAR1bml0CQAAAgAAAAECAAAAJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgAAAAEAAAACYVMBAAAAAmFUAAAAAAQAAAACYVUEAAAAAVYJAQAAAAJhaQAAAAADCQAAAQAAAAIFAAAAAVYCAAAACkJ5dGVWZWN0b3IEAAAAAmFuBQAAAAFWBQAAAAJhbgMJAAABAAAAAgUAAAABVgIAAAAEVW5pdAgFAAAAAmFTAAAAD3NlbmRlclB1YmxpY0tleQkAAAIAAAABAgAAAAtNYXRjaCBlcnJvcgkAAfQAAAADCAUAAAACYVMAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJhUwAAAAZwcm9vZnMAAAAAAAAAAAAFAAAAAmFVtU9pKA==", "height": 2571655, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CcTwqBsw6WEHhh8CgkaxxDkETPAH6NWroZNnNMP9uvPn Next: none Diff:
OldNewDifferences
6666 func readTotalsArray () = split(getStringOrFail(keyTotals()), SEP)
6767
6868
69-func getManagerAddressOrFail () = addressFromStringValue(getStringValue(keyManagerVaultAddress()))
69+func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) {
70+ case s: String =>
71+ addressFromStringValue(s)
72+ case _ =>
73+ this
74+}
7075
7176
7277 func TotalsEntry (key,origArray,claimedAmt,newLastClaimedHeight) = {
8590
8691
8792 func managerPublicKeyOrUnit () = {
88- let managerVaultAddress = getManagerAddressOrFail()
93+ let managerVaultAddress = getManagerVaultAddressOrThis()
8994 match getString(managerVaultAddress, keyManagerPublicKey()) {
9095 case s: String =>
9196 fromBase58String(s)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SEP = "__"
55
66 let keyReferral = makeString(["%s", "referral"], SEP)
77
88 let keyWxAssetId = makeString(["%s", "wxAssetId"], SEP)
99
1010 func keyManagerPublicKey () = "%s__managerPublicKey"
1111
1212
1313 func keyManagerVaultAddress () = "%s__managerVaultAddress"
1414
1515
1616 let IdxCfgClaimStartBlock = 1
1717
1818 let IdxCfgClaimVestingPeriod = 2
1919
2020 let IdxCfgClaimAssetId = 3
2121
2222 let IdxCfgClaimAssetMult = 4
2323
2424 let IdxCfgClaimAssetOwner = 5
2525
2626 let IdxCfgClaimAssetTotalAmount = 6
2727
2828 let IdxTotalsTotalClaimedAmount = 1
2929
3030 let IdxTotalsRemainingAmount = 2
3131
3232 let IdxTotalsLastClaimedHeight = 3
3333
3434 func throwErr (msg) = throw(makeString(["marketing.ride:", msg], " "))
3535
3636
3737 func getStringOrFail (key) = valueOrErrorMessage(getString(key), (("mandatory this." + key) + " is not defined"))
3838
3939
4040 func formatConfigString (claimStartBlock,vestingPeriod,assetIdBase58,assetMult,assetOwner,assetTotalAmt) = makeString(["%d%d%s%d%s%d%", claimStartBlock, vestingPeriod, assetIdBase58, assetMult, assetOwner, assetTotalAmt], SEP)
4141
4242
4343 func formatConfig (claimStartBlock,vestingPeriod,assetIdBase58,assetMult,claimAssetOwner,claimAssetTotalAmount) = formatConfigString(toString(claimStartBlock), toString(vestingPeriod), assetIdBase58, toString(assetMult), claimAssetOwner, toString(claimAssetTotalAmount))
4444
4545
4646 func formatTotalsString (totalClaimedAmount,remainingAmountForClaim,lastClaimedHeight) = makeString(["%d%d%d", totalClaimedAmount, remainingAmountForClaim, lastClaimedHeight], SEP)
4747
4848
4949 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)
5050
5151
5252 func keyConfig () = "%s__config"
5353
5454
5555 func keyTotals () = "%s__totals"
5656
5757
5858 let keyAmountUnclaimed = makeString(["%s", "amountUnclaimed"], SEP)
5959
6060 func keyOperationHistoryRecord (type,userAddress,txId58) = makeString(["%s%s%s%s__history", type, userAddress, txId58], SEP)
6161
6262
6363 func readConfigArray () = split(getStringOrFail(keyConfig()), SEP)
6464
6565
6666 func readTotalsArray () = split(getStringOrFail(keyTotals()), SEP)
6767
6868
69-func getManagerAddressOrFail () = addressFromStringValue(getStringValue(keyManagerVaultAddress()))
69+func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) {
70+ case s: String =>
71+ addressFromStringValue(s)
72+ case _ =>
73+ this
74+}
7075
7176
7277 func TotalsEntry (key,origArray,claimedAmt,newLastClaimedHeight) = {
7378 let totalClaimedAmount = parseIntValue(origArray[IdxTotalsTotalClaimedAmount])
7479 let remainingAmount = parseIntValue(origArray[IdxTotalsRemainingAmount])
7580 let lastClaimedHeight = parseIntValue(origArray[IdxTotalsLastClaimedHeight])
7681 let newTotalClaimedAmount = (totalClaimedAmount + claimedAmt)
7782 let newRemainingAmount = (remainingAmount - claimedAmt)
7883 if ((0 > newRemainingAmount))
7984 then throw("invalid math")
8085 else StringEntry(key, formatTotalsString(toString(newTotalClaimedAmount), toString(newRemainingAmount), toString(newLastClaimedHeight)))
8186 }
8287
8388
8489 func ClaimOperationHistoryEntry (userAddress,claimedAssetAmount,claimingBlocks,firstCalculationBlock,lastCalculationBlock,txId) = StringEntry(keyOperationHistoryRecord("claim", userAddress, toBase58String(txId)), formatHistoryRecord(claimedAssetAmount, claimingBlocks, firstCalculationBlock, lastCalculationBlock))
8590
8691
8792 func managerPublicKeyOrUnit () = {
88- let managerVaultAddress = getManagerAddressOrFail()
93+ let managerVaultAddress = getManagerVaultAddressOrThis()
8994 match getString(managerVaultAddress, keyManagerPublicKey()) {
9095 case s: String =>
9196 fromBase58String(s)
9297 case _: Unit =>
9398 unit
9499 case _ =>
95100 throw("Match error")
96101 }
97102 }
98103
99104
100105 func mustManager (i) = {
101106 let pd = throwErr("permission denied")
102107 match managerPublicKeyOrUnit() {
103108 case pk: ByteVector =>
104109 if ((i.callerPublicKey == pk))
105110 then true
106111 else pd
107112 case _: Unit =>
108113 if ((i.caller == this))
109114 then true
110115 else pd
111116 case _ =>
112117 throw("Match error")
113118 }
114119 }
115120
116121
117122 func claimCommon (i,amount) = {
118123 let cfgArray = readConfigArray()
119124 let cfgClaimStartHeight = parseIntValue(cfgArray[IdxCfgClaimStartBlock])
120125 let cfgClaimDuration = parseIntValue(cfgArray[IdxCfgClaimVestingPeriod])
121126 let cfgClaimEnd = (cfgClaimStartHeight + cfgClaimDuration)
122127 let cfgClaimAssetId = fromBase58String(cfgArray[IdxCfgClaimAssetId])
123128 let cfgClaimAssetOwner = addressFromStringValue(cfgArray[IdxCfgClaimAssetOwner])
124129 let cfgClaimAssetTotalAmount = parseIntValue(cfgArray[IdxCfgClaimAssetTotalAmount])
125130 let origTotalsArray = readTotalsArray()
126131 let totalClaimedAmount = parseIntValue(origTotalsArray[IdxTotalsTotalClaimedAmount])
127132 let totalRemainingAmount = parseIntValue(origTotalsArray[IdxTotalsRemainingAmount])
128133 let lastClaimedHeight = parseIntValue(origTotalsArray[IdxTotalsLastClaimedHeight])
129134 if ((i.caller != cfgClaimAssetOwner))
130135 then throw("permissions denied")
131136 else if ((cfgClaimStartHeight > height))
132137 then throw(("Wait claim start block: " + toString(cfgClaimStartHeight)))
133138 else {
134139 let lastCalulationBlock = if ((height > cfgClaimEnd))
135140 then cfgClaimEnd
136141 else height
137142 let firstCalulationBlock = if ((lastClaimedHeight == 0))
138143 then cfgClaimStartHeight
139144 else lastClaimedHeight
140145 let claimingBlocks = (lastCalulationBlock - firstCalulationBlock)
141146 let amountAvailable = fraction(cfgClaimAssetTotalAmount, claimingBlocks, cfgClaimDuration)
142147 let amountUnclaimed = valueOrElse(getInteger(this, keyAmountUnclaimed), 0)
143148 let amountAvailableTotal = (amountAvailable + amountUnclaimed)
144149 let amountToClaim = if (if ((0 >= amount))
145150 then true
146151 else (amount >= amountAvailableTotal))
147152 then amountAvailableTotal
148153 else amount
149154 let amountUnclaimedNew = (amountAvailableTotal - amountToClaim)
150155 $Tuple2([IntegerEntry(keyAmountUnclaimed, amountUnclaimedNew), ScriptTransfer(cfgClaimAssetOwner, amountToClaim, cfgClaimAssetId), TotalsEntry(keyTotals(), readTotalsArray(), amountToClaim, lastCalulationBlock), ClaimOperationHistoryEntry(toString(cfgClaimAssetOwner), amountToClaim, claimingBlocks, firstCalulationBlock, lastCalulationBlock, i.transactionId)], amountToClaim)
151156 }
152157 }
153158
154159
155160 @Callable(i)
156161 func constructor (claimStartBlock,vestingPeriodBlocks,beneficiaryAddress) = {
157162 let vestingEnd = (claimStartBlock + vestingPeriodBlocks)
158163 if (isDefined(getString(keyConfig())))
159164 then throw("already initialized")
160165 else if ((size(i.payments) != 1))
161166 then throw("exactly 1 payment must be attached")
162167 else if ((i.callerPublicKey != base58'2Cbd8ozG7A1RyRNC3nNnZgHu7Ru4K3JCfpyPkhqr9zxq'))
163168 then throw("not authorized")
164169 else {
165170 let beneficiaryAddressParsed = valueOrErrorMessage(addressFromString(beneficiaryAddress), "Invalid beneficiarAddress passed")
166171 let pmt = value(i.payments[0])
167172 let claimAssetId = value(pmt.assetId)
168173 let claimAssetInfo = valueOrErrorMessage(assetInfo(claimAssetId), "fail to load ido asset info")
169174 let claimAssetId58 = toBase58String(claimAssetId)
170175 let claimAssetMult = pow(10, 0, claimAssetInfo.decimals, 0, 0, DOWN)
171176 let claimAssetAmount = pmt.amount
172177 [StringEntry(keyConfig(), formatConfig(claimStartBlock, vestingPeriodBlocks, claimAssetId58, claimAssetMult, toString(beneficiaryAddressParsed), claimAssetAmount)), StringEntry(keyTotals(), formatTotalsString("0", toString(claimAssetAmount), "0"))]
173178 }
174179 }
175180
176181
177182
178183 @Callable(i)
179184 func claimAmount (amount) = claimCommon(i, amount)
180185
181186
182187
183188 @Callable(i)
184189 func claim () = claimCommon(i, -1)
185190
186191
187192
188193 @Callable(i)
189194 func withdrawReferralReward (wxAmount) = {
190195 let referralContractAddress = value(getString(keyReferral))
191196 let mustReferral = if ((toString(i.caller) == referralContractAddress))
192197 then true
193198 else throwErr("permission denied")
194199 if ((mustReferral == mustReferral))
195200 then {
196201 let wxAssetId = fromBase58String(value(getString(keyWxAssetId)))
197202 $Tuple2([ScriptTransfer(i.caller, wxAmount, wxAssetId), ClaimOperationHistoryEntry(referralContractAddress, wxAmount, 0, 0, 0, i.transactionId)], unit)
198203 }
199204 else throw("Strict value is not equal to itself.")
200205 }
201206
202207
203208 @Verifier(tx)
204209 func verify () = {
205210 let targetPublicKey = match managerPublicKeyOrUnit() {
206211 case pk: ByteVector =>
207212 pk
208213 case _: Unit =>
209214 tx.senderPublicKey
210215 case _ =>
211216 throw("Match error")
212217 }
213218 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
214219 }
215220

github/deemru/w8io/169f3d6 
40.80 ms