tx · FuAM13VtSqt6ZEoxLHxtWqk71LZR751juqjjTyXX9KSb 3Ms38PbYnARMUMorWK8SqRBhKKQq2yhXPB1: -0.01500000 Waves 2022.08.11 16:11 [2179861] smart account 3Ms38PbYnARMUMorWK8SqRBhKKQq2yhXPB1 > SELF 0.00000000 Waves
{ "type": 13, "id": "FuAM13VtSqt6ZEoxLHxtWqk71LZR751juqjjTyXX9KSb", "fee": 1500000, "feeAssetId": null, "timestamp": 1660223541925, "version": 1, "sender": "3Ms38PbYnARMUMorWK8SqRBhKKQq2yhXPB1", "senderPublicKey": "3EfudNNQNACtTotZKwkRu97fZW5fFjUPwuP1gd3oBHJs", "proofs": [ "CD7nZ1tV6JHxPXWhZeuAMGvaZTUsXM2oig5oSnfKpnzypxNTJ1kmvNQNvEcwqVsrPdWqpN5BdC3SxNsqS6YmmtT" ], "script": "base64:AAIFAAAAAAAAABwIAhIFCgMBAQgSAwoBARIAEgMKAQESAwoBCBIAAAAAIAAAAAADU0VQAgAAAAJfXwAAAAALa2V5UmVmZXJyYWwJAAS5AAAAAgkABEwAAAACAgAAAAIlcwkABEwAAAACAgAAAAhyZWZlcnJhbAUAAAADbmlsBQAAAANTRVAAAAAADGtleVd4QXNzZXRJZAkABLkAAAACCQAETAAAAAICAAAAAiVzCQAETAAAAAICAAAACXd4QXNzZXRJZAUAAAADbmlsBQAAAANTRVABAAAAE2tleU1hbmFnZXJQdWJsaWNLZXkAAAAAAgAAABQlc19fbWFuYWdlclB1YmxpY0tleQEAAAAaa2V5UGVuZGluZ01hbmFnZXJQdWJsaWNLZXkAAAAAAgAAABslc19fcGVuZGluZ01hbmFnZXJQdWJsaWNLZXkAAAAAFUlkeENmZ0NsYWltU3RhcnRCbG9jawAAAAAAAAAAAQAAAAAYSWR4Q2ZnQ2xhaW1WZXN0aW5nUGVyaW9kAAAAAAAAAAACAAAAABJJZHhDZmdDbGFpbUFzc2V0SWQAAAAAAAAAAAMAAAAAFElkeENmZ0NsYWltQXNzZXRNdWx0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vcgQAAAACcGsFAAAAByRtYXRjaDAFAAAAAnBrAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAARVbml0CAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5CQAAAgAAAAECAAAAC01hdGNoIGVycm9yCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAUAAAAPdGFyZ2V0UHVibGljS2V5l5Hrzw==", "chainId": 84, "height": 2179861, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Fui2GKQ9krB8w49JU6riV8BW3J7EpZmt53HiSzU3zytJ Next: Eh52Cg3tEoteQCsW3X17rjqMpGjubyTRTNvMbQH8jKVR Diff:
Old | New | Differences | |
---|---|---|---|
54 | 54 | ||
55 | 55 | func keyTotals () = "%s__totals" | |
56 | 56 | ||
57 | + | ||
58 | + | let keyAmountUnclaimed = makeString(["%s", "amountUnclaimed"], SEP) | |
57 | 59 | ||
58 | 60 | func keyOperationHistoryRecord (type,userAddress,txId58) = makeString(["%s%s%s%s__history", type, userAddress, txId58], SEP) | |
59 | 61 | ||
116 | 118 | } | |
117 | 119 | ||
118 | 120 | ||
121 | + | func claimCommon (i,amount) = { | |
122 | + | let cfgArray = readConfigArray() | |
123 | + | let cfgClaimStartHeight = parseIntValue(cfgArray[IdxCfgClaimStartBlock]) | |
124 | + | let cfgClaimDuration = parseIntValue(cfgArray[IdxCfgClaimVestingPeriod]) | |
125 | + | let cfgClaimEnd = (cfgClaimStartHeight + cfgClaimDuration) | |
126 | + | let cfgClaimAssetId = fromBase58String(cfgArray[IdxCfgClaimAssetId]) | |
127 | + | let cfgClaimAssetOwner = addressFromStringValue(cfgArray[IdxCfgClaimAssetOwner]) | |
128 | + | let cfgClaimAssetTotalAmount = parseIntValue(cfgArray[IdxCfgClaimAssetTotalAmount]) | |
129 | + | let origTotalsArray = readTotalsArray() | |
130 | + | let totalClaimedAmount = parseIntValue(origTotalsArray[IdxTotalsTotalClaimedAmount]) | |
131 | + | let totalRemainingAmount = parseIntValue(origTotalsArray[IdxTotalsRemainingAmount]) | |
132 | + | let lastClaimedHeight = parseIntValue(origTotalsArray[IdxTotalsLastClaimedHeight]) | |
133 | + | if ((i.caller != cfgClaimAssetOwner)) | |
134 | + | then throw("permissions denied") | |
135 | + | else if ((cfgClaimStartHeight > height)) | |
136 | + | then throw(("Wait claim start block: " + toString(cfgClaimStartHeight))) | |
137 | + | else { | |
138 | + | let lastCalulationBlock = if ((height > cfgClaimEnd)) | |
139 | + | then cfgClaimEnd | |
140 | + | else height | |
141 | + | let firstCalulationBlock = if ((lastClaimedHeight == 0)) | |
142 | + | then cfgClaimStartHeight | |
143 | + | else lastClaimedHeight | |
144 | + | let claimingBlocks = (lastCalulationBlock - firstCalulationBlock) | |
145 | + | let amountAvailable = fraction(cfgClaimAssetTotalAmount, claimingBlocks, cfgClaimDuration) | |
146 | + | let amountUnclaimed = valueOrElse(getInteger(this, keyAmountUnclaimed), 0) | |
147 | + | let amountAvailableTotal = (amountAvailable + amountUnclaimed) | |
148 | + | let amountToClaim = if (if ((0 >= amount)) | |
149 | + | then true | |
150 | + | else (amount >= amountAvailableTotal)) | |
151 | + | then amountAvailableTotal | |
152 | + | else amount | |
153 | + | let amountUnclaimedNew = (amountAvailableTotal - amountToClaim) | |
154 | + | $Tuple2([IntegerEntry(keyAmountUnclaimed, amountUnclaimedNew), ScriptTransfer(cfgClaimAssetOwner, amountToClaim, cfgClaimAssetId), TotalsEntry(keyTotals(), readTotalsArray(), amountToClaim, lastCalulationBlock), ClaimOperationHistoryEntry(toString(cfgClaimAssetOwner), amountToClaim, claimingBlocks, firstCalulationBlock, lastCalulationBlock, i.transactionId)], amountToClaim) | |
155 | + | } | |
156 | + | } | |
157 | + | ||
158 | + | ||
119 | 159 | @Callable(i) | |
120 | 160 | func constructor (claimStartBlock,vestingPeriodBlocks,beneficiaryAddress) = { | |
121 | 161 | let vestingEnd = (claimStartBlock + vestingPeriodBlocks) | |
140 | 180 | ||
141 | 181 | ||
142 | 182 | @Callable(i) | |
143 | - | func claim () = { | |
144 | - | let cfgArray = readConfigArray() | |
145 | - | let cfgClaimStartHeight = parseIntValue(cfgArray[IdxCfgClaimStartBlock]) | |
146 | - | let cfgClaimDuration = parseIntValue(cfgArray[IdxCfgClaimVestingPeriod]) | |
147 | - | let cfgClaimEnd = (cfgClaimStartHeight + cfgClaimDuration) | |
148 | - | let cfgClaimAssetId58 = cfgArray[IdxCfgClaimAssetId] | |
149 | - | let cfgClaimAssetOwner = cfgArray[IdxCfgClaimAssetOwner] | |
150 | - | let cfgClaimAssetTotalAmount = parseIntValue(cfgArray[IdxCfgClaimAssetTotalAmount]) | |
151 | - | let userAddress = i.caller | |
152 | - | let userAddress58 = toString(userAddress) | |
153 | - | let origTotalsArray = readTotalsArray() | |
154 | - | let totalClaimedAmount = parseIntValue(origTotalsArray[IdxTotalsTotalClaimedAmount]) | |
155 | - | let totalRemainingAmount = parseIntValue(origTotalsArray[IdxTotalsRemainingAmount]) | |
156 | - | let lastClaimedHeight = parseIntValue(origTotalsArray[IdxTotalsLastClaimedHeight]) | |
157 | - | if ((userAddress58 != cfgClaimAssetOwner)) | |
158 | - | then throw("permissions denied") | |
159 | - | else if ((cfgClaimStartHeight > height)) | |
160 | - | then throw(("Wait claim start block: " + toString(cfgClaimStartHeight))) | |
161 | - | else { | |
162 | - | let lastCalulationBlock = if ((height > cfgClaimEnd)) | |
163 | - | then cfgClaimEnd | |
164 | - | else height | |
165 | - | let firstCalulationBlock = if ((lastClaimedHeight == 0)) | |
166 | - | then cfgClaimStartHeight | |
167 | - | else lastClaimedHeight | |
168 | - | let claimingBlocks = (lastCalulationBlock - firstCalulationBlock) | |
169 | - | let claimingAssetAmount = fraction(cfgClaimAssetTotalAmount, claimingBlocks, cfgClaimDuration) | |
170 | - | [ScriptTransfer(userAddress, claimingAssetAmount, fromBase58String(cfgClaimAssetId58)), TotalsEntry(keyTotals(), readTotalsArray(), claimingAssetAmount, lastCalulationBlock), ClaimOperationHistoryEntry(userAddress58, claimingAssetAmount, claimingBlocks, firstCalulationBlock, lastCalulationBlock, i.transactionId)] | |
171 | - | } | |
172 | - | } | |
183 | + | func claimAmount (amount) = claimCommon(i, amount) | |
184 | + | ||
185 | + | ||
186 | + | ||
187 | + | @Callable(i) | |
188 | + | func claim () = claimCommon(i, -1) | |
173 | 189 | ||
174 | 190 | ||
175 | 191 |
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 keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey" | |
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 | + | ||
58 | + | let keyAmountUnclaimed = makeString(["%s", "amountUnclaimed"], SEP) | |
57 | 59 | ||
58 | 60 | func keyOperationHistoryRecord (type,userAddress,txId58) = makeString(["%s%s%s%s__history", type, userAddress, txId58], SEP) | |
59 | 61 | ||
60 | 62 | ||
61 | 63 | func readConfigArray () = split(getStringOrFail(keyConfig()), SEP) | |
62 | 64 | ||
63 | 65 | ||
64 | 66 | func readTotalsArray () = split(getStringOrFail(keyTotals()), SEP) | |
65 | 67 | ||
66 | 68 | ||
67 | 69 | func TotalsEntry (key,origArray,claimedAmt,newLastClaimedHeight) = { | |
68 | 70 | let totalClaimedAmount = parseIntValue(origArray[IdxTotalsTotalClaimedAmount]) | |
69 | 71 | let remainingAmount = parseIntValue(origArray[IdxTotalsRemainingAmount]) | |
70 | 72 | let lastClaimedHeight = parseIntValue(origArray[IdxTotalsLastClaimedHeight]) | |
71 | 73 | let newTotalClaimedAmount = (totalClaimedAmount + claimedAmt) | |
72 | 74 | let newRemainingAmount = (remainingAmount - claimedAmt) | |
73 | 75 | if ((0 > newRemainingAmount)) | |
74 | 76 | then throw("invalid math") | |
75 | 77 | else StringEntry(key, formatTotalsString(toString(newTotalClaimedAmount), toString(newRemainingAmount), toString(newLastClaimedHeight))) | |
76 | 78 | } | |
77 | 79 | ||
78 | 80 | ||
79 | 81 | func ClaimOperationHistoryEntry (userAddress,claimedAssetAmount,claimingBlocks,firstCalculationBlock,lastCalculationBlock,txId) = StringEntry(keyOperationHistoryRecord("claim", userAddress, toBase58String(txId)), formatHistoryRecord(claimedAssetAmount, claimingBlocks, firstCalculationBlock, lastCalculationBlock)) | |
80 | 82 | ||
81 | 83 | ||
82 | 84 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
83 | 85 | case s: String => | |
84 | 86 | fromBase58String(s) | |
85 | 87 | case _: Unit => | |
86 | 88 | unit | |
87 | 89 | case _ => | |
88 | 90 | throw("Match error") | |
89 | 91 | } | |
90 | 92 | ||
91 | 93 | ||
92 | 94 | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
93 | 95 | case s: String => | |
94 | 96 | fromBase58String(s) | |
95 | 97 | case _: Unit => | |
96 | 98 | unit | |
97 | 99 | case _ => | |
98 | 100 | throw("Match error") | |
99 | 101 | } | |
100 | 102 | ||
101 | 103 | ||
102 | 104 | func mustManager (i) = { | |
103 | 105 | let pd = throwErr("permission denied") | |
104 | 106 | match managerPublicKeyOrUnit() { | |
105 | 107 | case pk: ByteVector => | |
106 | 108 | if ((i.callerPublicKey == pk)) | |
107 | 109 | then true | |
108 | 110 | else pd | |
109 | 111 | case _: Unit => | |
110 | 112 | if ((i.caller == this)) | |
111 | 113 | then true | |
112 | 114 | else pd | |
113 | 115 | case _ => | |
114 | 116 | throw("Match error") | |
115 | 117 | } | |
116 | 118 | } | |
117 | 119 | ||
118 | 120 | ||
121 | + | func claimCommon (i,amount) = { | |
122 | + | let cfgArray = readConfigArray() | |
123 | + | let cfgClaimStartHeight = parseIntValue(cfgArray[IdxCfgClaimStartBlock]) | |
124 | + | let cfgClaimDuration = parseIntValue(cfgArray[IdxCfgClaimVestingPeriod]) | |
125 | + | let cfgClaimEnd = (cfgClaimStartHeight + cfgClaimDuration) | |
126 | + | let cfgClaimAssetId = fromBase58String(cfgArray[IdxCfgClaimAssetId]) | |
127 | + | let cfgClaimAssetOwner = addressFromStringValue(cfgArray[IdxCfgClaimAssetOwner]) | |
128 | + | let cfgClaimAssetTotalAmount = parseIntValue(cfgArray[IdxCfgClaimAssetTotalAmount]) | |
129 | + | let origTotalsArray = readTotalsArray() | |
130 | + | let totalClaimedAmount = parseIntValue(origTotalsArray[IdxTotalsTotalClaimedAmount]) | |
131 | + | let totalRemainingAmount = parseIntValue(origTotalsArray[IdxTotalsRemainingAmount]) | |
132 | + | let lastClaimedHeight = parseIntValue(origTotalsArray[IdxTotalsLastClaimedHeight]) | |
133 | + | if ((i.caller != cfgClaimAssetOwner)) | |
134 | + | then throw("permissions denied") | |
135 | + | else if ((cfgClaimStartHeight > height)) | |
136 | + | then throw(("Wait claim start block: " + toString(cfgClaimStartHeight))) | |
137 | + | else { | |
138 | + | let lastCalulationBlock = if ((height > cfgClaimEnd)) | |
139 | + | then cfgClaimEnd | |
140 | + | else height | |
141 | + | let firstCalulationBlock = if ((lastClaimedHeight == 0)) | |
142 | + | then cfgClaimStartHeight | |
143 | + | else lastClaimedHeight | |
144 | + | let claimingBlocks = (lastCalulationBlock - firstCalulationBlock) | |
145 | + | let amountAvailable = fraction(cfgClaimAssetTotalAmount, claimingBlocks, cfgClaimDuration) | |
146 | + | let amountUnclaimed = valueOrElse(getInteger(this, keyAmountUnclaimed), 0) | |
147 | + | let amountAvailableTotal = (amountAvailable + amountUnclaimed) | |
148 | + | let amountToClaim = if (if ((0 >= amount)) | |
149 | + | then true | |
150 | + | else (amount >= amountAvailableTotal)) | |
151 | + | then amountAvailableTotal | |
152 | + | else amount | |
153 | + | let amountUnclaimedNew = (amountAvailableTotal - amountToClaim) | |
154 | + | $Tuple2([IntegerEntry(keyAmountUnclaimed, amountUnclaimedNew), ScriptTransfer(cfgClaimAssetOwner, amountToClaim, cfgClaimAssetId), TotalsEntry(keyTotals(), readTotalsArray(), amountToClaim, lastCalulationBlock), ClaimOperationHistoryEntry(toString(cfgClaimAssetOwner), amountToClaim, claimingBlocks, firstCalulationBlock, lastCalulationBlock, i.transactionId)], amountToClaim) | |
155 | + | } | |
156 | + | } | |
157 | + | ||
158 | + | ||
119 | 159 | @Callable(i) | |
120 | 160 | func constructor (claimStartBlock,vestingPeriodBlocks,beneficiaryAddress) = { | |
121 | 161 | let vestingEnd = (claimStartBlock + vestingPeriodBlocks) | |
122 | 162 | if (isDefined(getString(keyConfig()))) | |
123 | 163 | then throw("already initialized") | |
124 | 164 | else if ((size(i.payments) != 1)) | |
125 | 165 | then throw("exactly 1 payment must be attached") | |
126 | 166 | else if ((i.callerPublicKey != base58'2Cbd8ozG7A1RyRNC3nNnZgHu7Ru4K3JCfpyPkhqr9zxq')) | |
127 | 167 | then throw("not authorized") | |
128 | 168 | else { | |
129 | 169 | let beneficiaryAddressParsed = valueOrErrorMessage(addressFromString(beneficiaryAddress), "Invalid beneficiarAddress passed") | |
130 | 170 | let pmt = value(i.payments[0]) | |
131 | 171 | let claimAssetId = value(pmt.assetId) | |
132 | 172 | let claimAssetInfo = valueOrErrorMessage(assetInfo(claimAssetId), "fail to load ido asset info") | |
133 | 173 | let claimAssetId58 = toBase58String(claimAssetId) | |
134 | 174 | let claimAssetMult = pow(10, 0, claimAssetInfo.decimals, 0, 0, DOWN) | |
135 | 175 | let claimAssetAmount = pmt.amount | |
136 | 176 | [StringEntry(keyConfig(), formatConfig(claimStartBlock, vestingPeriodBlocks, claimAssetId58, claimAssetMult, toString(beneficiaryAddressParsed), claimAssetAmount)), StringEntry(keyTotals(), formatTotalsString("0", toString(claimAssetAmount), "0"))] | |
137 | 177 | } | |
138 | 178 | } | |
139 | 179 | ||
140 | 180 | ||
141 | 181 | ||
142 | 182 | @Callable(i) | |
143 | - | func claim () = { | |
144 | - | let cfgArray = readConfigArray() | |
145 | - | let cfgClaimStartHeight = parseIntValue(cfgArray[IdxCfgClaimStartBlock]) | |
146 | - | let cfgClaimDuration = parseIntValue(cfgArray[IdxCfgClaimVestingPeriod]) | |
147 | - | let cfgClaimEnd = (cfgClaimStartHeight + cfgClaimDuration) | |
148 | - | let cfgClaimAssetId58 = cfgArray[IdxCfgClaimAssetId] | |
149 | - | let cfgClaimAssetOwner = cfgArray[IdxCfgClaimAssetOwner] | |
150 | - | let cfgClaimAssetTotalAmount = parseIntValue(cfgArray[IdxCfgClaimAssetTotalAmount]) | |
151 | - | let userAddress = i.caller | |
152 | - | let userAddress58 = toString(userAddress) | |
153 | - | let origTotalsArray = readTotalsArray() | |
154 | - | let totalClaimedAmount = parseIntValue(origTotalsArray[IdxTotalsTotalClaimedAmount]) | |
155 | - | let totalRemainingAmount = parseIntValue(origTotalsArray[IdxTotalsRemainingAmount]) | |
156 | - | let lastClaimedHeight = parseIntValue(origTotalsArray[IdxTotalsLastClaimedHeight]) | |
157 | - | if ((userAddress58 != cfgClaimAssetOwner)) | |
158 | - | then throw("permissions denied") | |
159 | - | else if ((cfgClaimStartHeight > height)) | |
160 | - | then throw(("Wait claim start block: " + toString(cfgClaimStartHeight))) | |
161 | - | else { | |
162 | - | let lastCalulationBlock = if ((height > cfgClaimEnd)) | |
163 | - | then cfgClaimEnd | |
164 | - | else height | |
165 | - | let firstCalulationBlock = if ((lastClaimedHeight == 0)) | |
166 | - | then cfgClaimStartHeight | |
167 | - | else lastClaimedHeight | |
168 | - | let claimingBlocks = (lastCalulationBlock - firstCalulationBlock) | |
169 | - | let claimingAssetAmount = fraction(cfgClaimAssetTotalAmount, claimingBlocks, cfgClaimDuration) | |
170 | - | [ScriptTransfer(userAddress, claimingAssetAmount, fromBase58String(cfgClaimAssetId58)), TotalsEntry(keyTotals(), readTotalsArray(), claimingAssetAmount, lastCalulationBlock), ClaimOperationHistoryEntry(userAddress58, claimingAssetAmount, claimingBlocks, firstCalulationBlock, lastCalulationBlock, i.transactionId)] | |
171 | - | } | |
172 | - | } | |
183 | + | func claimAmount (amount) = claimCommon(i, amount) | |
184 | + | ||
185 | + | ||
186 | + | ||
187 | + | @Callable(i) | |
188 | + | func claim () = claimCommon(i, -1) | |
173 | 189 | ||
174 | 190 | ||
175 | 191 | ||
176 | 192 | @Callable(i) | |
177 | 193 | func withdrawReferralReward (wxAmount) = { | |
178 | 194 | let referralContractAddress = value(getString(keyReferral)) | |
179 | 195 | let mustReferral = if ((toString(i.caller) == referralContractAddress)) | |
180 | 196 | then true | |
181 | 197 | else throwErr("permission denied") | |
182 | 198 | if ((mustReferral == mustReferral)) | |
183 | 199 | then { | |
184 | 200 | let wxAssetId = fromBase58String(value(getString(keyWxAssetId))) | |
185 | 201 | $Tuple2([ScriptTransfer(i.caller, wxAmount, wxAssetId), ClaimOperationHistoryEntry(referralContractAddress, wxAmount, 0, 0, 0, i.transactionId)], unit) | |
186 | 202 | } | |
187 | 203 | else throw("Strict value is not equal to itself.") | |
188 | 204 | } | |
189 | 205 | ||
190 | 206 | ||
191 | 207 | ||
192 | 208 | @Callable(i) | |
193 | 209 | func setManager (pendingManagerPublicKey) = { | |
194 | 210 | let checkCaller = mustManager(i) | |
195 | 211 | if ((checkCaller == checkCaller)) | |
196 | 212 | then { | |
197 | 213 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
198 | 214 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
199 | 215 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
200 | 216 | else throw("Strict value is not equal to itself.") | |
201 | 217 | } | |
202 | 218 | else throw("Strict value is not equal to itself.") | |
203 | 219 | } | |
204 | 220 | ||
205 | 221 | ||
206 | 222 | ||
207 | 223 | @Callable(i) | |
208 | 224 | func confirmManager () = { | |
209 | 225 | let pm = pendingManagerPublicKeyOrUnit() | |
210 | 226 | let hasPM = if (isDefined(pm)) | |
211 | 227 | then true | |
212 | 228 | else throwErr("no pending manager") | |
213 | 229 | if ((hasPM == hasPM)) | |
214 | 230 | then { | |
215 | 231 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
216 | 232 | then true | |
217 | 233 | else throwErr("you are not pending manager") | |
218 | 234 | if ((checkPM == checkPM)) | |
219 | 235 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
220 | 236 | else throw("Strict value is not equal to itself.") | |
221 | 237 | } | |
222 | 238 | else throw("Strict value is not equal to itself.") | |
223 | 239 | } | |
224 | 240 | ||
225 | 241 | ||
226 | 242 | @Verifier(tx) | |
227 | 243 | func verify () = { | |
228 | 244 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
229 | 245 | case pk: ByteVector => | |
230 | 246 | pk | |
231 | 247 | case _: Unit => | |
232 | 248 | tx.senderPublicKey | |
233 | 249 | case _ => | |
234 | 250 | throw("Match error") | |
235 | 251 | } | |
236 | 252 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
237 | 253 | } | |
238 | 254 |
github/deemru/w8io/169f3d6 36.08 ms ◑