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