tx · 99nmnPvBm2aSz1jRiN6CCR9cSowfAwT9a1CAF29HBeRQ 3NAsFvuLwxz1iUtZ9fmhfmSN16r9NEsPqsh: -0.01800000 Waves 2023.01.16 12:49 [2407343] smart account 3NAsFvuLwxz1iUtZ9fmhfmSN16r9NEsPqsh > SELF 0.00000000 Waves
{ "type": 13, "id": "99nmnPvBm2aSz1jRiN6CCR9cSowfAwT9a1CAF29HBeRQ", "fee": 1800000, "feeAssetId": null, "timestamp": 1673862615752, "version": 1, "sender": "3NAsFvuLwxz1iUtZ9fmhfmSN16r9NEsPqsh", "senderPublicKey": "33fpjdpM9FMu87RZKePniPardKqQXM96sm7VhAk3JEVQ", "proofs": [ "2EqMepQGiN1jac4kNu7i1YD8gGYrLogs4hYpQATLjmzk2CqMKUnX934GrHkPtMd8aqxjissw8ubh4AFQy2aiqc64" ], "script": "base64:BgKZEwgCEgUKAwgIBBIFCgMIGAESBwoFEQgYAQESBgoECAgICBIGCgQICAgCEgUKAwgIBBIGCgQICAEBEgQKAggYEgMKAQgSABIECgIICBIDCgEIEgQKAggIEgMKAQgSACIJc2VwYXJhdG9yIgxrZXlXeEFzc2V0SWQiE2tleUJhY2tlbmRQdWJsaWNLZXkiG2tleUV4aXN0c1JlZmVycmVyVG9SZWZlcnJhbCILcHJvZ3JhbU5hbWUiD3JlZmVycmVyQWRkcmVzcyIPcmVmZXJyYWxBZGRyZXNzIhJrZXlDbGFpbWVkUmVmZXJyZXIiDmNsYWltZXJBZGRyZXNzIhJrZXlDbGFpbWVkUmVmZXJyYWwiFGtleVVuY2xhaW1lZFJlZmVycmVyIhRrZXlVbmNsYWltZWRSZWZlcnJhbCILa2V5UmVmZXJyZXIiDmtleVByb2dyYW1OYW1lIhVrZXlUb3RhbFJlZmVycmFsQ291bnQiFmtleUFjdGl2ZVJlZmVycmFsQ291bnQiE2tleUlzUmVmZXJyYWxBY3RpdmUiFmtleUNsYWltZWRUb3RhbEFkZHJlc3MiB2FkZHJlc3MiGGtleVVuY2x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UCYk0JAMwIAgkBC0RlbGV0ZUVudHJ5AQkBAUIABQNuaWwJAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4JAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4BAmJQAQJiUQAEAmJSBAFMCQEBSwADCQABAgUBTAIKQnl0ZVZlY3RvcgQBUgUBTAUBUgMJAAECBQFMAgRVbml0CAUCYlAPc2VuZGVyUHVibGljS2V5CQACAQILTWF0Y2ggZXJyb3IJAPQDAwgFAmJQCWJvZHlCeXRlcwkAkQMCCAUCYlAGcHJvb2ZzAAAFAmJSpph9nA==", "chainId": 84, "height": 2407343, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: EPiqXdrakwq5NydtB98s9ydE91rgp4i8zkvyUeRVvp8v Next: BQe9nfNJPjetd98itdmwZ7wH52ELU2QD6JwE2sGDwv4F Diff:
Old | New | Differences | |
---|---|---|---|
60 | 60 | ||
61 | 61 | ||
62 | 62 | func keyAllReferralPrograms (address) = makeString(["%s%s", "allReferralPrograms", address], separator) | |
63 | - | ||
64 | - | ||
65 | - | func keyLastIncUnclaimedWithPaymentCallBlock (address) = makeString(["%s%s", "lastIncUnclaimedWithPaymentCallBlock", address], separator) | |
66 | 63 | ||
67 | 64 | ||
68 | 65 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
138 | 135 | else throwErr("program does not exist") | |
139 | 136 | if ((checkProgramExists == checkProgramExists)) | |
140 | 137 | then { | |
141 | - | let $ | |
138 | + | let $t046775614 = if (isImplementationContract) | |
142 | 139 | then $Tuple5(valueOrElse(getInteger(keyClaimedReferral(programName, claimerAddress)), 0), valueOrElse(getInteger(keyUnclaimedReferral(programName, claimerAddress)), 0), keyClaimedReferral(programName, claimerAddress), keyUnclaimedReferral(programName, claimerAddress), keyClaimHistory(programName, claimerAddress, toBase58String(i.transactionId), "claimReferral")) | |
143 | 140 | else $Tuple5(valueOrElse(getInteger(keyClaimedReferrer(programName, claimerAddress)), 0), valueOrElse(getInteger(keyUnclaimedReferrer(programName, claimerAddress)), 0), keyClaimedReferrer(programName, claimerAddress), keyUnclaimedReferrer(programName, claimerAddress), keyClaimHistory(programName, claimerAddress, toBase58String(i.transactionId), "claimReferrer")) | |
144 | - | let claimerClaimed = $ | |
145 | - | let claimerUnclaimed = $ | |
146 | - | let keyClaimed = $ | |
147 | - | let keyUnclaimed = $ | |
148 | - | let claimHistoryKey = $ | |
141 | + | let claimerClaimed = $t046775614._1 | |
142 | + | let claimerUnclaimed = $t046775614._2 | |
143 | + | let keyClaimed = $t046775614._3 | |
144 | + | let keyUnclaimed = $t046775614._4 | |
145 | + | let claimHistoryKey = $t046775614._5 | |
149 | 146 | let claimedTotal = valueOrElse(getInteger(keyClaimedTotal(programName)), 0) | |
150 | 147 | let treasuryContract = value(addressFromString(value(getString(keyTreasuryContract(programName))))) | |
151 | 148 | let rewardAssetId = fromBase58String(value(getString(keyRewardAssetId(programName)))) | |
426 | 423 | else throwErr("invalid program") | |
427 | 424 | if ((checkProgram == checkProgram)) | |
428 | 425 | then { | |
429 | - | let callerAddress = toString(i.caller) | |
430 | - | let lastCall = valueOrElse(getInteger(keyLastIncUnclaimedWithPaymentCallBlock(callerAddress)), 0) | |
431 | - | let waitBlocks = ((lastCall - height) + 3) | |
432 | - | let lastCallCheck = if (((height - 3) > lastCall)) | |
433 | - | then true | |
434 | - | else throwErr(makeString(["wait", toString(waitBlocks), "blocks"], " ")) | |
435 | - | if ((lastCallCheck == lastCallCheck)) | |
426 | + | func map (accum,next) = { | |
427 | + | let assetIdCheck = (toBase58String(value(next.assetId)) == value(getString(keyRewardAssetId(programName)))) | |
428 | + | let amountCheck = if (assetIdCheck) | |
429 | + | then true | |
430 | + | else throwErr("invalid asset id") | |
431 | + | if ((amountCheck == amountCheck)) | |
432 | + | then (accum :+ next.amount) | |
433 | + | else throw("Strict value is not equal to itself.") | |
434 | + | } | |
435 | + | ||
436 | + | let payments = { | |
437 | + | let $l = i.payments | |
438 | + | let $s = size($l) | |
439 | + | let $acc0 = nil | |
440 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
441 | + | then $a | |
442 | + | else map($a, $l[$i]) | |
443 | + | ||
444 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
445 | + | then $a | |
446 | + | else throw("List size exceeds 10") | |
447 | + | ||
448 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
449 | + | } | |
450 | + | let resAmount = { | |
451 | + | let @ = invoke(this, "incUnclaimedWithPaymentInternal", [payments, programName, referrerAddresses, 0, 0], nil) | |
452 | + | if ($isInstanceOf(@, "Int")) | |
453 | + | then @ | |
454 | + | else throw(($getType(@) + " couldn't be cast to Int")) | |
455 | + | } | |
456 | + | if ((resAmount == resAmount)) | |
436 | 457 | then { | |
437 | - | func map (accum,next) = { | |
438 | - | let assetIdCheck = (toBase58String(value(next.assetId)) == value(getString(keyRewardAssetId(programName)))) | |
439 | - | let amountCheck = if (assetIdCheck) | |
440 | - | then true | |
441 | - | else throwErr("invalid asset id") | |
442 | - | if ((amountCheck == amountCheck)) | |
443 | - | then (accum :+ next.amount) | |
444 | - | else throw("Strict value is not equal to itself.") | |
445 | - | } | |
446 | - | ||
447 | - | let payments = { | |
448 | - | let $l = i.payments | |
449 | - | let $s = size($l) | |
450 | - | let $acc0 = nil | |
451 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
452 | - | then $a | |
453 | - | else map($a, $l[$i]) | |
454 | - | ||
455 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
456 | - | then $a | |
457 | - | else throw("List size exceeds 10") | |
458 | - | ||
459 | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
460 | - | } | |
461 | - | let resAmount = { | |
462 | - | let @ = invoke(this, "incUnclaimedWithPaymentInternal", [payments, programName, referrerAddresses, 0, 0], nil) | |
463 | - | if ($isInstanceOf(@, "Int")) | |
464 | - | then @ | |
465 | - | else throw(($getType(@) + " couldn't be cast to Int")) | |
466 | - | } | |
467 | - | if ((resAmount == resAmount)) | |
468 | - | then { | |
469 | - | let treasuryContract = addressFromStringValue(value(getString(keyTreasuryContract(programName)))) | |
470 | - | let rewardAssetId = fromBase58String(value(getString(keyRewardAssetId(programName)))) | |
471 | - | [ScriptTransfer(treasuryContract, resAmount, rewardAssetId), IntegerEntry(keyLastIncUnclaimedWithPaymentCallBlock(callerAddress), height)] | |
472 | - | } | |
473 | - | else throw("Strict value is not equal to itself.") | |
458 | + | let treasuryContract = addressFromStringValue(value(getString(keyTreasuryContract(programName)))) | |
459 | + | let rewardAssetId = fromBase58String(value(getString(keyRewardAssetId(programName)))) | |
460 | + | [ScriptTransfer(treasuryContract, resAmount, rewardAssetId)] | |
474 | 461 | } | |
475 | 462 | else throw("Strict value is not equal to itself.") | |
476 | 463 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let separator = "__" | |
5 | 5 | ||
6 | 6 | func keyWxAssetId () = makeString(["%s", "wxAssetId"], separator) | |
7 | 7 | ||
8 | 8 | ||
9 | 9 | let keyBackendPublicKey = makeString(["%s", "backendPublicKey"], separator) | |
10 | 10 | ||
11 | 11 | func keyExistsReferrerToReferral (programName,referrerAddress,referralAddress) = makeString(["%s%s%s%s", "existsReferrerToReferral", programName, referrerAddress, referralAddress], separator) | |
12 | 12 | ||
13 | 13 | ||
14 | 14 | func keyClaimedReferrer (programName,claimerAddress) = makeString(["%s%s%s", "claimedReferrer", programName, claimerAddress], separator) | |
15 | 15 | ||
16 | 16 | ||
17 | 17 | func keyClaimedReferral (programName,claimerAddress) = makeString(["%s%s%s", "claimedReferral", programName, claimerAddress], separator) | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | func keyUnclaimedReferrer (programName,claimerAddress) = makeString(["%s%s%s", "unclaimedReferrer", programName, claimerAddress], separator) | |
21 | 21 | ||
22 | 22 | ||
23 | 23 | func keyUnclaimedReferral (programName,claimerAddress) = makeString(["%s%s%s", "unclaimedReferral", programName, claimerAddress], separator) | |
24 | 24 | ||
25 | 25 | ||
26 | 26 | func keyReferrer (programName,referralAddress) = makeString(["%s%s%s", "referrer", programName, referralAddress], separator) | |
27 | 27 | ||
28 | 28 | ||
29 | 29 | func keyProgramName (programName) = makeString(["%s%s", "programName", programName], separator) | |
30 | 30 | ||
31 | 31 | ||
32 | 32 | func keyTotalReferralCount (programName,referrerAddress) = makeString(["%s%s%s", "totalReferralCount", programName, referrerAddress], separator) | |
33 | 33 | ||
34 | 34 | ||
35 | 35 | func keyActiveReferralCount (programName,referrerAddress) = makeString(["%s%s%s", "activeReferralCount", programName, referrerAddress], separator) | |
36 | 36 | ||
37 | 37 | ||
38 | 38 | func keyIsReferralActive (programName,referralAddress) = makeString(["%s%s%s", "activeReferral", programName, referralAddress], separator) | |
39 | 39 | ||
40 | 40 | ||
41 | 41 | func keyClaimedTotalAddress (address) = makeString(["%s%s", "claimedTotalAddress", address], separator) | |
42 | 42 | ||
43 | 43 | ||
44 | 44 | func keyUnclaimedTotalAddress (address) = makeString(["%s%s", "unclaimedTotalAddress", address], separator) | |
45 | 45 | ||
46 | 46 | ||
47 | 47 | func keyClaimedTotal (programName) = makeString(["%s%s", "claimedTotal", programName], separator) | |
48 | 48 | ||
49 | 49 | ||
50 | 50 | func keyRewardsTotal (programName) = makeString(["%s%s", "rewardsTotal", programName], separator) | |
51 | 51 | ||
52 | 52 | ||
53 | 53 | func keyRewardAssetId (programName) = makeString(["%s%s", "rewardAssetId", programName], separator) | |
54 | 54 | ||
55 | 55 | ||
56 | 56 | func keyTreasuryContract (programName) = makeString(["%s%s", "treasuryContract", programName], separator) | |
57 | 57 | ||
58 | 58 | ||
59 | 59 | func keyImplementationContract (programName) = makeString(["%s%s", "implementationContract", programName], separator) | |
60 | 60 | ||
61 | 61 | ||
62 | 62 | func keyAllReferralPrograms (address) = makeString(["%s%s", "allReferralPrograms", address], separator) | |
63 | - | ||
64 | - | ||
65 | - | func keyLastIncUnclaimedWithPaymentCallBlock (address) = makeString(["%s%s", "lastIncUnclaimedWithPaymentCallBlock", address], separator) | |
66 | 63 | ||
67 | 64 | ||
68 | 65 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
69 | 66 | ||
70 | 67 | ||
71 | 68 | func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey" | |
72 | 69 | ||
73 | 70 | ||
74 | 71 | func keyClaimHistory (programName,userAddress,transactionId,type) = makeString(["%s%s%s%s%s", "history", type, programName, userAddress, transactionId], separator) | |
75 | 72 | ||
76 | 73 | ||
77 | 74 | func formatClaimHistory (amount) = makeString(["%d%d%d", toString(lastBlock.height), toString(lastBlock.timestamp), toString(amount)], separator) | |
78 | 75 | ||
79 | 76 | ||
80 | 77 | func throwErr (msg) = throw(makeString(["referral.ride:", msg], " ")) | |
81 | 78 | ||
82 | 79 | ||
83 | 80 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
84 | 81 | case s: String => | |
85 | 82 | fromBase58String(s) | |
86 | 83 | case _: Unit => | |
87 | 84 | unit | |
88 | 85 | case _ => | |
89 | 86 | throw("Match error") | |
90 | 87 | } | |
91 | 88 | ||
92 | 89 | ||
93 | 90 | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
94 | 91 | case s: String => | |
95 | 92 | fromBase58String(s) | |
96 | 93 | case _: Unit => | |
97 | 94 | unit | |
98 | 95 | case _ => | |
99 | 96 | throw("Match error") | |
100 | 97 | } | |
101 | 98 | ||
102 | 99 | ||
103 | 100 | func mustManager (i) = { | |
104 | 101 | let pd = throwErr("permission denied") | |
105 | 102 | match managerPublicKeyOrUnit() { | |
106 | 103 | case pk: ByteVector => | |
107 | 104 | if ((i.callerPublicKey == pk)) | |
108 | 105 | then true | |
109 | 106 | else pd | |
110 | 107 | case _: Unit => | |
111 | 108 | if ((i.caller == this)) | |
112 | 109 | then true | |
113 | 110 | else pd | |
114 | 111 | case _ => | |
115 | 112 | throw("Match error") | |
116 | 113 | } | |
117 | 114 | } | |
118 | 115 | ||
119 | 116 | ||
120 | 117 | func updateAllReferralPrograms (address,programName) = { | |
121 | 118 | let allReferralPrograms = valueOrElse(getString(keyAllReferralPrograms(address)), "") | |
122 | 119 | let updatedAllReferralPrograms = if (contains(allReferralPrograms, programName)) | |
123 | 120 | then nil | |
124 | 121 | else { | |
125 | 122 | let newAllReferralPrograms = if ((allReferralPrograms == "")) | |
126 | 123 | then programName | |
127 | 124 | else makeString([allReferralPrograms, programName], separator) | |
128 | 125 | [StringEntry(keyAllReferralPrograms(address), newAllReferralPrograms)] | |
129 | 126 | } | |
130 | 127 | updatedAllReferralPrograms | |
131 | 128 | } | |
132 | 129 | ||
133 | 130 | ||
134 | 131 | @Callable(i) | |
135 | 132 | func claimInternal (programName,claimerAddress,isImplementationContract) = { | |
136 | 133 | let checkProgramExists = if (valueOrElse(getBoolean(keyProgramName(programName)), false)) | |
137 | 134 | then true | |
138 | 135 | else throwErr("program does not exist") | |
139 | 136 | if ((checkProgramExists == checkProgramExists)) | |
140 | 137 | then { | |
141 | - | let $ | |
138 | + | let $t046775614 = if (isImplementationContract) | |
142 | 139 | then $Tuple5(valueOrElse(getInteger(keyClaimedReferral(programName, claimerAddress)), 0), valueOrElse(getInteger(keyUnclaimedReferral(programName, claimerAddress)), 0), keyClaimedReferral(programName, claimerAddress), keyUnclaimedReferral(programName, claimerAddress), keyClaimHistory(programName, claimerAddress, toBase58String(i.transactionId), "claimReferral")) | |
143 | 140 | else $Tuple5(valueOrElse(getInteger(keyClaimedReferrer(programName, claimerAddress)), 0), valueOrElse(getInteger(keyUnclaimedReferrer(programName, claimerAddress)), 0), keyClaimedReferrer(programName, claimerAddress), keyUnclaimedReferrer(programName, claimerAddress), keyClaimHistory(programName, claimerAddress, toBase58String(i.transactionId), "claimReferrer")) | |
144 | - | let claimerClaimed = $ | |
145 | - | let claimerUnclaimed = $ | |
146 | - | let keyClaimed = $ | |
147 | - | let keyUnclaimed = $ | |
148 | - | let claimHistoryKey = $ | |
141 | + | let claimerClaimed = $t046775614._1 | |
142 | + | let claimerUnclaimed = $t046775614._2 | |
143 | + | let keyClaimed = $t046775614._3 | |
144 | + | let keyUnclaimed = $t046775614._4 | |
145 | + | let claimHistoryKey = $t046775614._5 | |
149 | 146 | let claimedTotal = valueOrElse(getInteger(keyClaimedTotal(programName)), 0) | |
150 | 147 | let treasuryContract = value(addressFromString(value(getString(keyTreasuryContract(programName))))) | |
151 | 148 | let rewardAssetId = fromBase58String(value(getString(keyRewardAssetId(programName)))) | |
152 | 149 | let claimedTotalAddress = valueOrElse(getInteger(keyClaimedTotalAddress(claimerAddress)), 0) | |
153 | 150 | let unclaimedTotalAddress = valueOrElse(getInteger(keyUnclaimedTotalAddress(claimerAddress)), 0) | |
154 | 151 | if (if (isImplementationContract) | |
155 | 152 | then (claimerUnclaimed == 0) | |
156 | 153 | else false) | |
157 | 154 | then $Tuple2(nil, 0) | |
158 | 155 | else { | |
159 | 156 | let checkCanClaim = if ((claimerUnclaimed > 0)) | |
160 | 157 | then true | |
161 | 158 | else throwErr("nothing to claim") | |
162 | 159 | if ((checkCanClaim == checkCanClaim)) | |
163 | 160 | then { | |
164 | 161 | let newClaimerClaimed = (claimerClaimed + claimerUnclaimed) | |
165 | 162 | let newClaimedTotal = (claimedTotal + claimerUnclaimed) | |
166 | 163 | let newClaimedTotalAddress = (claimedTotalAddress + claimerUnclaimed) | |
167 | 164 | let newUnclaimedTotalAddress = (unclaimedTotalAddress - claimerUnclaimed) | |
168 | 165 | let balanceBefore = value(assetBalance(this, rewardAssetId)) | |
169 | 166 | if ((balanceBefore == balanceBefore)) | |
170 | 167 | then { | |
171 | 168 | let res = invoke(treasuryContract, "withdrawReferralReward", [claimerUnclaimed], nil) | |
172 | 169 | if ((res == res)) | |
173 | 170 | then { | |
174 | 171 | let balanceAfter = value(assetBalance(this, rewardAssetId)) | |
175 | 172 | if ((balanceAfter == balanceAfter)) | |
176 | 173 | then { | |
177 | 174 | let balanceDiff = (balanceAfter - balanceBefore) | |
178 | 175 | if ((balanceDiff == balanceDiff)) | |
179 | 176 | then { | |
180 | 177 | let checkBalance = if ((balanceDiff == claimerUnclaimed)) | |
181 | 178 | then true | |
182 | 179 | else throwErr("insufficient balance on referral contract") | |
183 | 180 | if ((checkBalance == checkBalance)) | |
184 | 181 | then $Tuple2([IntegerEntry(keyClaimed, newClaimerClaimed), IntegerEntry(keyUnclaimed, 0), IntegerEntry(keyClaimedTotal(programName), newClaimedTotal), IntegerEntry(keyClaimedTotalAddress(claimerAddress), newClaimedTotalAddress), IntegerEntry(keyUnclaimedTotalAddress(claimerAddress), newUnclaimedTotalAddress), ScriptTransfer(addressFromStringValue(claimerAddress), claimerUnclaimed, rewardAssetId), StringEntry(claimHistoryKey, formatClaimHistory(claimerUnclaimed))], claimerUnclaimed) | |
185 | 182 | else throw("Strict value is not equal to itself.") | |
186 | 183 | } | |
187 | 184 | else throw("Strict value is not equal to itself.") | |
188 | 185 | } | |
189 | 186 | else throw("Strict value is not equal to itself.") | |
190 | 187 | } | |
191 | 188 | else throw("Strict value is not equal to itself.") | |
192 | 189 | } | |
193 | 190 | else throw("Strict value is not equal to itself.") | |
194 | 191 | } | |
195 | 192 | else throw("Strict value is not equal to itself.") | |
196 | 193 | } | |
197 | 194 | } | |
198 | 195 | else throw("Strict value is not equal to itself.") | |
199 | 196 | } | |
200 | 197 | ||
201 | 198 | ||
202 | 199 | ||
203 | 200 | @Callable(i) | |
204 | 201 | func claimBulkInternal (claimer,programNames,currentIter) = { | |
205 | 202 | let checkCaller = if ((i.caller == this)) | |
206 | 203 | then true | |
207 | 204 | else throwErr("permission denied") | |
208 | 205 | if ((checkCaller == checkCaller)) | |
209 | 206 | then if ((currentIter == size(programNames))) | |
210 | 207 | then nil | |
211 | 208 | else { | |
212 | 209 | let programName = programNames[currentIter] | |
213 | 210 | let programUnclaimed = valueOrElse(getInteger(keyUnclaimedReferrer(programName, claimer)), 0) | |
214 | 211 | let claimHistoryKey = keyClaimHistory(programName, claimer, toBase58String(i.transactionId), "claimBulk") | |
215 | 212 | let claimBulkInternal = invoke(this, "claimBulkInternal", [claimer, programNames, (currentIter + 1)], nil) | |
216 | 213 | if ((claimBulkInternal == claimBulkInternal)) | |
217 | 214 | then { | |
218 | 215 | let unclaimedReferrer = valueOrElse(getInteger(keyUnclaimedReferrer(programName, claimer)), 0) | |
219 | 216 | let claim = if ((unclaimedReferrer > 0)) | |
220 | 217 | then invoke(this, "claimInternal", [programName, claimer, false], nil) | |
221 | 218 | else unit | |
222 | 219 | if ((claim == claim)) | |
223 | 220 | then $Tuple2(nil, [claimBulkInternal, claim]) | |
224 | 221 | else throw("Strict value is not equal to itself.") | |
225 | 222 | } | |
226 | 223 | else throw("Strict value is not equal to itself.") | |
227 | 224 | } | |
228 | 225 | else throw("Strict value is not equal to itself.") | |
229 | 226 | } | |
230 | 227 | ||
231 | 228 | ||
232 | 229 | ||
233 | 230 | @Callable(i) | |
234 | 231 | func incUnclaimedWithPaymentInternal (paymentAmounts,programName,referrerAddresses,currentIter,resAmount) = { | |
235 | 232 | let checkCaller = if ((i.caller == this)) | |
236 | 233 | then true | |
237 | 234 | else throwErr("permission denied") | |
238 | 235 | if ((checkCaller == checkCaller)) | |
239 | 236 | then { | |
240 | 237 | let argsComparison = (size(paymentAmounts) == size(referrerAddresses)) | |
241 | 238 | let check = if (argsComparison) | |
242 | 239 | then true | |
243 | 240 | else throwErr("lists in args must be same size") | |
244 | 241 | if ((check == check)) | |
245 | 242 | then if ((currentIter == size(paymentAmounts))) | |
246 | 243 | then $Tuple2(nil, resAmount) | |
247 | 244 | else { | |
248 | 245 | let referrerAddress = referrerAddresses[currentIter] | |
249 | 246 | let unclaimedTotalAddress = valueOrElse(getInteger(keyUnclaimedTotalAddress(referrerAddress)), 0) | |
250 | 247 | let referrerUnclaimed = valueOrElse(getInteger(keyUnclaimedReferrer(programName, referrerAddress)), 0) | |
251 | 248 | let rewardsTotal = valueOrElse(getInteger(keyRewardsTotal(programName)), 0) | |
252 | 249 | let newUnclaimedTotalAddress = (unclaimedTotalAddress + paymentAmounts[currentIter]) | |
253 | 250 | let newReferrerUnclaimed = (referrerUnclaimed + paymentAmounts[currentIter]) | |
254 | 251 | let newResAmount = (resAmount + paymentAmounts[currentIter]) | |
255 | 252 | let inv = invoke(this, "incUnclaimedWithPaymentInternal", [paymentAmounts, programName, referrerAddresses, (currentIter + 1), newResAmount], nil) | |
256 | 253 | if ((inv == inv)) | |
257 | 254 | then { | |
258 | 255 | let updatedAllReferrerPrograms = updateAllReferralPrograms(referrerAddress, programName) | |
259 | 256 | $Tuple2(([IntegerEntry(keyUnclaimedTotalAddress(referrerAddress), newUnclaimedTotalAddress), IntegerEntry(keyUnclaimedReferrer(programName, referrerAddress), newReferrerUnclaimed), IntegerEntry(keyRewardsTotal(programName), (rewardsTotal + paymentAmounts[currentIter]))] ++ updatedAllReferrerPrograms), inv) | |
260 | 257 | } | |
261 | 258 | else throw("Strict value is not equal to itself.") | |
262 | 259 | } | |
263 | 260 | else throw("Strict value is not equal to itself.") | |
264 | 261 | } | |
265 | 262 | else throw("Strict value is not equal to itself.") | |
266 | 263 | } | |
267 | 264 | ||
268 | 265 | ||
269 | 266 | ||
270 | 267 | @Callable(i) | |
271 | 268 | func createReferralProgram (programName,treasuryContract,implementationContract,rewardAssetId) = { | |
272 | 269 | let checkCaller = mustManager(i) | |
273 | 270 | if ((checkCaller == checkCaller)) | |
274 | 271 | then { | |
275 | 272 | let checkProgramName = if ((getBoolean(keyProgramName(programName)) == unit)) | |
276 | 273 | then true | |
277 | 274 | else throwErr("program name already exists") | |
278 | 275 | if ((checkProgramName == checkProgramName)) | |
279 | 276 | then { | |
280 | 277 | let programNameIsValid = if (!(contains(programName, separator))) | |
281 | 278 | then !(contains(programName, " ")) | |
282 | 279 | else false | |
283 | 280 | let checkProgramExists = if (programNameIsValid) | |
284 | 281 | then true | |
285 | 282 | else throwErr("invalid program name") | |
286 | 283 | if ((checkProgramExists == checkProgramExists)) | |
287 | 284 | then { | |
288 | 285 | let checkRewardAsset = if ((assetInfo(fromBase58String(rewardAssetId)) != unit)) | |
289 | 286 | then true | |
290 | 287 | else throwErr("invalid reward asset id") | |
291 | 288 | if ((checkRewardAsset == checkRewardAsset)) | |
292 | 289 | then $Tuple2([BooleanEntry(keyProgramName(programName), true), StringEntry(keyTreasuryContract(programName), treasuryContract), StringEntry(keyImplementationContract(programName), implementationContract), StringEntry(keyRewardAssetId(programName), rewardAssetId), IntegerEntry(keyRewardsTotal(programName), 0)], unit) | |
293 | 290 | else throw("Strict value is not equal to itself.") | |
294 | 291 | } | |
295 | 292 | else throw("Strict value is not equal to itself.") | |
296 | 293 | } | |
297 | 294 | else throw("Strict value is not equal to itself.") | |
298 | 295 | } | |
299 | 296 | else throw("Strict value is not equal to itself.") | |
300 | 297 | } | |
301 | 298 | ||
302 | 299 | ||
303 | 300 | ||
304 | 301 | @Callable(i) | |
305 | 302 | func createPair (programName,referrerAddress,referralAddress,signature) = { | |
306 | 303 | let checkProgramExists = if (valueOrElse(getBoolean(keyProgramName(programName)), false)) | |
307 | 304 | then true | |
308 | 305 | else throwErr("program does not exist") | |
309 | 306 | if ((checkProgramExists == checkProgramExists)) | |
310 | 307 | then { | |
311 | 308 | let pairReferrerToReferralExistCheck = if ((getBoolean(keyExistsReferrerToReferral(programName, referrerAddress, referralAddress)) == unit)) | |
312 | 309 | then true | |
313 | 310 | else throwErr("pair already exists") | |
314 | 311 | if ((pairReferrerToReferralExistCheck == pairReferrerToReferralExistCheck)) | |
315 | 312 | then { | |
316 | 313 | let noRefSelf = if ((referrerAddress != referralAddress)) | |
317 | 314 | then true | |
318 | 315 | else throwErr("cannot refer to self") | |
319 | 316 | if ((noRefSelf == noRefSelf)) | |
320 | 317 | then { | |
321 | 318 | let pair = toBytes(makeString([programName, referrerAddress, referralAddress], ":")) | |
322 | 319 | let backendPublicKey = fromBase58String(value(getString(keyBackendPublicKey))) | |
323 | 320 | let validateSignature = if (sigVerify(pair, signature, backendPublicKey)) | |
324 | 321 | then true | |
325 | 322 | else throwErr("bad signature") | |
326 | 323 | if ((validateSignature == validateSignature)) | |
327 | 324 | then { | |
328 | 325 | let totalReferralCount = valueOrElse(getInteger(keyTotalReferralCount(programName, referrerAddress)), 0) | |
329 | 326 | let newTotalReferralCount = (totalReferralCount + 1) | |
330 | 327 | let updatedAllReferrerPrograms = updateAllReferralPrograms(referrerAddress, programName) | |
331 | 328 | let updatedAllReferralPrograms = updateAllReferralPrograms(referralAddress, programName) | |
332 | 329 | $Tuple2((([BooleanEntry(keyExistsReferrerToReferral(programName, referrerAddress, referralAddress), true), IntegerEntry(keyTotalReferralCount(programName, referrerAddress), newTotalReferralCount), StringEntry(keyReferrer(programName, referralAddress), referrerAddress)] ++ updatedAllReferrerPrograms) ++ updatedAllReferralPrograms), unit) | |
333 | 330 | } | |
334 | 331 | else throw("Strict value is not equal to itself.") | |
335 | 332 | } | |
336 | 333 | else throw("Strict value is not equal to itself.") | |
337 | 334 | } | |
338 | 335 | else throw("Strict value is not equal to itself.") | |
339 | 336 | } | |
340 | 337 | else throw("Strict value is not equal to itself.") | |
341 | 338 | } | |
342 | 339 | ||
343 | 340 | ||
344 | 341 | ||
345 | 342 | @Callable(i) | |
346 | 343 | func updateReferralActivity (programName,referralAddress,isActive) = { | |
347 | 344 | let implementationContract = value(getString(keyImplementationContract(programName))) | |
348 | 345 | let isReferralActive = (getBoolean(keyIsReferralActive(programName, referralAddress)) != unit) | |
349 | 346 | let referrerAddress = value(getString(keyReferrer(programName, referralAddress))) | |
350 | 347 | let checkCaller = if ((toString(i.caller) == implementationContract)) | |
351 | 348 | then true | |
352 | 349 | else throwErr("permission denied") | |
353 | 350 | if ((checkCaller == checkCaller)) | |
354 | 351 | then { | |
355 | 352 | let update = if ((isReferralActive == isActive)) | |
356 | 353 | then $Tuple2(nil, unit) | |
357 | 354 | else { | |
358 | 355 | let update = if ((isActive == true)) | |
359 | 356 | then { | |
360 | 357 | let newActiveReferralCount = (valueOrElse(getInteger(keyActiveReferralCount(programName, referrerAddress)), 0) + 1) | |
361 | 358 | $Tuple2([BooleanEntry(keyIsReferralActive(programName, referralAddress), true), IntegerEntry(keyActiveReferralCount(programName, referrerAddress), newActiveReferralCount)], unit) | |
362 | 359 | } | |
363 | 360 | else { | |
364 | 361 | let newActiveReferralCount = (valueOrElse(getInteger(keyActiveReferralCount(programName, referrerAddress)), 0) - 1) | |
365 | 362 | $Tuple2([DeleteEntry(keyIsReferralActive(programName, referralAddress)), IntegerEntry(keyActiveReferralCount(programName, referrerAddress), newActiveReferralCount)], unit) | |
366 | 363 | } | |
367 | 364 | update | |
368 | 365 | } | |
369 | 366 | update | |
370 | 367 | } | |
371 | 368 | else throw("Strict value is not equal to itself.") | |
372 | 369 | } | |
373 | 370 | ||
374 | 371 | ||
375 | 372 | ||
376 | 373 | @Callable(i) | |
377 | 374 | func incUnclaimed (programName,referralAddress,referrerReward,referralReward) = { | |
378 | 375 | let implementationContract = value(getString(keyImplementationContract(programName))) | |
379 | 376 | let referrerAddress = value(getString(keyReferrer(programName, referralAddress))) | |
380 | 377 | let checkCaller = if ((toString(i.caller) == implementationContract)) | |
381 | 378 | then true | |
382 | 379 | else throwErr("permission denied") | |
383 | 380 | if ((checkCaller == checkCaller)) | |
384 | 381 | then { | |
385 | 382 | let checkProgram = if ((programName == "wxlock")) | |
386 | 383 | then true | |
387 | 384 | else throwErr("invalid program") | |
388 | 385 | if ((checkProgram == checkProgram)) | |
389 | 386 | then { | |
390 | 387 | let checkReferrerInProgram = if (contains(valueOrElse(getString(keyAllReferralPrograms(referrerAddress)), ""), programName)) | |
391 | 388 | then true | |
392 | 389 | else throwErr(((("referrer not in program=" + programName) + " addr=") + referrerAddress)) | |
393 | 390 | if ((checkReferrerInProgram == checkReferrerInProgram)) | |
394 | 391 | then { | |
395 | 392 | let checkReferralInProgram = if (contains(valueOrElse(getString(keyAllReferralPrograms(referralAddress)), ""), programName)) | |
396 | 393 | then true | |
397 | 394 | else throwErr(((("referral not in program=" + programName) + " addr=") + referralAddress)) | |
398 | 395 | if ((checkReferralInProgram == checkReferralInProgram)) | |
399 | 396 | then { | |
400 | 397 | let unclaimedTotalReferrer = valueOrElse(getInteger(keyUnclaimedTotalAddress(referrerAddress)), 0) | |
401 | 398 | let referrerUnclaimed = valueOrElse(getInteger(keyUnclaimedReferrer(programName, referrerAddress)), 0) | |
402 | 399 | let unclaimedTotalReferral = valueOrElse(getInteger(keyUnclaimedTotalAddress(referralAddress)), 0) | |
403 | 400 | let referralUnclaimed = valueOrElse(getInteger(keyUnclaimedReferral(programName, referralAddress)), 0) | |
404 | 401 | let rewardsTotal = valueOrElse(getInteger(keyRewardsTotal(programName)), 0) | |
405 | 402 | let newUnclaimedTotalReferrer = (unclaimedTotalReferrer + referrerReward) | |
406 | 403 | let newReferrerUnclaimed = (referrerUnclaimed + referrerReward) | |
407 | 404 | let newUnclaimedTotalReferral = (unclaimedTotalReferral + referralReward) | |
408 | 405 | let newReferralUnclaimed = (referralUnclaimed + referralReward) | |
409 | 406 | $Tuple2([IntegerEntry(keyUnclaimedTotalAddress(referrerAddress), newUnclaimedTotalReferrer), IntegerEntry(keyUnclaimedTotalAddress(referralAddress), newUnclaimedTotalReferral), IntegerEntry(keyUnclaimedReferrer(programName, referrerAddress), newReferrerUnclaimed), IntegerEntry(keyUnclaimedReferral(programName, referralAddress), newReferralUnclaimed), IntegerEntry(keyRewardsTotal(programName), ((rewardsTotal + referrerReward) + referralReward))], unit) | |
410 | 407 | } | |
411 | 408 | else throw("Strict value is not equal to itself.") | |
412 | 409 | } | |
413 | 410 | else throw("Strict value is not equal to itself.") | |
414 | 411 | } | |
415 | 412 | else throw("Strict value is not equal to itself.") | |
416 | 413 | } | |
417 | 414 | else throw("Strict value is not equal to itself.") | |
418 | 415 | } | |
419 | 416 | ||
420 | 417 | ||
421 | 418 | ||
422 | 419 | @Callable(i) | |
423 | 420 | func incUnclaimedWithPayment (programName,referrerAddresses) = { | |
424 | 421 | let checkProgram = if ((programName == "wxSpotFee")) | |
425 | 422 | then true | |
426 | 423 | else throwErr("invalid program") | |
427 | 424 | if ((checkProgram == checkProgram)) | |
428 | 425 | then { | |
429 | - | let callerAddress = toString(i.caller) | |
430 | - | let lastCall = valueOrElse(getInteger(keyLastIncUnclaimedWithPaymentCallBlock(callerAddress)), 0) | |
431 | - | let waitBlocks = ((lastCall - height) + 3) | |
432 | - | let lastCallCheck = if (((height - 3) > lastCall)) | |
433 | - | then true | |
434 | - | else throwErr(makeString(["wait", toString(waitBlocks), "blocks"], " ")) | |
435 | - | if ((lastCallCheck == lastCallCheck)) | |
426 | + | func map (accum,next) = { | |
427 | + | let assetIdCheck = (toBase58String(value(next.assetId)) == value(getString(keyRewardAssetId(programName)))) | |
428 | + | let amountCheck = if (assetIdCheck) | |
429 | + | then true | |
430 | + | else throwErr("invalid asset id") | |
431 | + | if ((amountCheck == amountCheck)) | |
432 | + | then (accum :+ next.amount) | |
433 | + | else throw("Strict value is not equal to itself.") | |
434 | + | } | |
435 | + | ||
436 | + | let payments = { | |
437 | + | let $l = i.payments | |
438 | + | let $s = size($l) | |
439 | + | let $acc0 = nil | |
440 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
441 | + | then $a | |
442 | + | else map($a, $l[$i]) | |
443 | + | ||
444 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
445 | + | then $a | |
446 | + | else throw("List size exceeds 10") | |
447 | + | ||
448 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
449 | + | } | |
450 | + | let resAmount = { | |
451 | + | let @ = invoke(this, "incUnclaimedWithPaymentInternal", [payments, programName, referrerAddresses, 0, 0], nil) | |
452 | + | if ($isInstanceOf(@, "Int")) | |
453 | + | then @ | |
454 | + | else throw(($getType(@) + " couldn't be cast to Int")) | |
455 | + | } | |
456 | + | if ((resAmount == resAmount)) | |
436 | 457 | then { | |
437 | - | func map (accum,next) = { | |
438 | - | let assetIdCheck = (toBase58String(value(next.assetId)) == value(getString(keyRewardAssetId(programName)))) | |
439 | - | let amountCheck = if (assetIdCheck) | |
440 | - | then true | |
441 | - | else throwErr("invalid asset id") | |
442 | - | if ((amountCheck == amountCheck)) | |
443 | - | then (accum :+ next.amount) | |
444 | - | else throw("Strict value is not equal to itself.") | |
445 | - | } | |
446 | - | ||
447 | - | let payments = { | |
448 | - | let $l = i.payments | |
449 | - | let $s = size($l) | |
450 | - | let $acc0 = nil | |
451 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
452 | - | then $a | |
453 | - | else map($a, $l[$i]) | |
454 | - | ||
455 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
456 | - | then $a | |
457 | - | else throw("List size exceeds 10") | |
458 | - | ||
459 | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
460 | - | } | |
461 | - | let resAmount = { | |
462 | - | let @ = invoke(this, "incUnclaimedWithPaymentInternal", [payments, programName, referrerAddresses, 0, 0], nil) | |
463 | - | if ($isInstanceOf(@, "Int")) | |
464 | - | then @ | |
465 | - | else throw(($getType(@) + " couldn't be cast to Int")) | |
466 | - | } | |
467 | - | if ((resAmount == resAmount)) | |
468 | - | then { | |
469 | - | let treasuryContract = addressFromStringValue(value(getString(keyTreasuryContract(programName)))) | |
470 | - | let rewardAssetId = fromBase58String(value(getString(keyRewardAssetId(programName)))) | |
471 | - | [ScriptTransfer(treasuryContract, resAmount, rewardAssetId), IntegerEntry(keyLastIncUnclaimedWithPaymentCallBlock(callerAddress), height)] | |
472 | - | } | |
473 | - | else throw("Strict value is not equal to itself.") | |
458 | + | let treasuryContract = addressFromStringValue(value(getString(keyTreasuryContract(programName)))) | |
459 | + | let rewardAssetId = fromBase58String(value(getString(keyRewardAssetId(programName)))) | |
460 | + | [ScriptTransfer(treasuryContract, resAmount, rewardAssetId)] | |
474 | 461 | } | |
475 | 462 | else throw("Strict value is not equal to itself.") | |
476 | 463 | } | |
477 | 464 | else throw("Strict value is not equal to itself.") | |
478 | 465 | } | |
479 | 466 | ||
480 | 467 | ||
481 | 468 | ||
482 | 469 | @Callable(i) | |
483 | 470 | func claim (programName) = { | |
484 | 471 | let checkProgramExists = if (valueOrElse(getBoolean(keyProgramName(programName)), false)) | |
485 | 472 | then true | |
486 | 473 | else throwErr("program does not exist") | |
487 | 474 | if ((checkProgramExists == checkProgramExists)) | |
488 | 475 | then { | |
489 | 476 | let isImplementationContract = (toString(i.caller) == value(getString(keyImplementationContract(programName)))) | |
490 | 477 | let claimerAddress = if (isImplementationContract) | |
491 | 478 | then toString(i.originCaller) | |
492 | 479 | else toString(i.caller) | |
493 | 480 | let claimInternal = invoke(this, "claimInternal", [programName, claimerAddress, isImplementationContract], nil) | |
494 | 481 | if ((claimInternal == claimInternal)) | |
495 | 482 | then $Tuple2(nil, claimInternal) | |
496 | 483 | else throw("Strict value is not equal to itself.") | |
497 | 484 | } | |
498 | 485 | else throw("Strict value is not equal to itself.") | |
499 | 486 | } | |
500 | 487 | ||
501 | 488 | ||
502 | 489 | ||
503 | 490 | @Callable(i) | |
504 | 491 | func claimBulk () = { | |
505 | 492 | let callerAddress = toString(i.caller) | |
506 | 493 | let callerProgramsStr = getString(keyAllReferralPrograms(toString(i.caller))) | |
507 | 494 | let programsExists = if (isDefined(callerProgramsStr)) | |
508 | 495 | then true | |
509 | 496 | else throwErr("no referral programs") | |
510 | 497 | if ((programsExists == programsExists)) | |
511 | 498 | then { | |
512 | 499 | let callerPrograms = split(value(callerProgramsStr), "__") | |
513 | 500 | let bulkClaim = invoke(this, "claimBulkInternal", [callerAddress, callerPrograms, 0], nil) | |
514 | 501 | if ((bulkClaim == bulkClaim)) | |
515 | 502 | then $Tuple2(nil, bulkClaim) | |
516 | 503 | else throw("Strict value is not equal to itself.") | |
517 | 504 | } | |
518 | 505 | else throw("Strict value is not equal to itself.") | |
519 | 506 | } | |
520 | 507 | ||
521 | 508 | ||
522 | 509 | ||
523 | 510 | @Callable(i) | |
524 | 511 | func claimREADONLY (programName,userAddress) = { | |
525 | 512 | let claimerClaimed = valueOrElse(getInteger(keyClaimedReferrer(programName, userAddress)), 0) | |
526 | 513 | let claimerUnclaimed = valueOrElse(getInteger(keyUnclaimedReferrer(programName, userAddress)), 0) | |
527 | 514 | $Tuple2(nil, [claimerUnclaimed, claimerClaimed]) | |
528 | 515 | } | |
529 | 516 | ||
530 | 517 | ||
531 | 518 | ||
532 | 519 | @Callable(i) | |
533 | 520 | func claimBulkREADONLY (claimer) = { | |
534 | 521 | let claimedTotalAddress = valueOrElse(getInteger(keyClaimedTotalAddress(claimer)), 0) | |
535 | 522 | let unclaimedTotalAddress = valueOrElse(getInteger(keyUnclaimedTotalAddress(claimer)), 0) | |
536 | 523 | $Tuple2(nil, [unclaimedTotalAddress, claimedTotalAddress]) | |
537 | 524 | } | |
538 | 525 | ||
539 | 526 | ||
540 | 527 | ||
541 | 528 | @Callable(i) | |
542 | 529 | func setTotalKeys (programName,address) = { | |
543 | 530 | let claimedReferrer = valueOrElse(getInteger(keyClaimedReferrer(programName, address)), 0) | |
544 | 531 | let claimedReferral = valueOrElse(getInteger(keyClaimedReferral(programName, address)), 0) | |
545 | 532 | let unclaimedReferrer = valueOrElse(getInteger(keyUnclaimedReferrer(programName, address)), 0) | |
546 | 533 | let unclaimedReferral = valueOrElse(getInteger(keyUnclaimedReferral(programName, address)), 0) | |
547 | 534 | let claimedTotalAddress = (claimedReferrer + claimedReferral) | |
548 | 535 | let unclaimedTotalAddress = (unclaimedReferrer + unclaimedReferral) | |
549 | 536 | $Tuple2([IntegerEntry(keyClaimedTotalAddress(address), claimedTotalAddress), IntegerEntry(keyUnclaimedTotalAddress(address), unclaimedTotalAddress)], unit) | |
550 | 537 | } | |
551 | 538 | ||
552 | 539 | ||
553 | 540 | ||
554 | 541 | @Callable(i) | |
555 | 542 | func setManager (pendingManagerPublicKey) = { | |
556 | 543 | let checkCaller = mustManager(i) | |
557 | 544 | if ((checkCaller == checkCaller)) | |
558 | 545 | then { | |
559 | 546 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
560 | 547 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
561 | 548 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
562 | 549 | else throw("Strict value is not equal to itself.") | |
563 | 550 | } | |
564 | 551 | else throw("Strict value is not equal to itself.") | |
565 | 552 | } | |
566 | 553 | ||
567 | 554 | ||
568 | 555 | ||
569 | 556 | @Callable(i) | |
570 | 557 | func confirmManager () = { | |
571 | 558 | let pm = pendingManagerPublicKeyOrUnit() | |
572 | 559 | let hasPM = if (isDefined(pm)) | |
573 | 560 | then true | |
574 | 561 | else throwErr("no pending manager") | |
575 | 562 | if ((hasPM == hasPM)) | |
576 | 563 | then { | |
577 | 564 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
578 | 565 | then true | |
579 | 566 | else throwErr("you are not pending manager") | |
580 | 567 | if ((checkPM == checkPM)) | |
581 | 568 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
582 | 569 | else throw("Strict value is not equal to itself.") | |
583 | 570 | } | |
584 | 571 | else throw("Strict value is not equal to itself.") | |
585 | 572 | } | |
586 | 573 | ||
587 | 574 | ||
588 | 575 | @Verifier(tx) | |
589 | 576 | func verify () = { | |
590 | 577 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
591 | 578 | case pk: ByteVector => | |
592 | 579 | pk | |
593 | 580 | case _: Unit => | |
594 | 581 | tx.senderPublicKey | |
595 | 582 | case _ => | |
596 | 583 | throw("Match error") | |
597 | 584 | } | |
598 | 585 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
599 | 586 | } | |
600 | 587 |
github/deemru/w8io/169f3d6 75.91 ms ◑