tx · CBTYBsa7RBN6d8kZrKtgcqSsEcjCAjy6Zm6vxikQEo8b 3N3PoX8z2Mvu5YbaqZmtyF3dRFjqvhRkB3M: -0.01400000 Waves 2022.03.10 15:59 [1957871] smart account 3N3PoX8z2Mvu5YbaqZmtyF3dRFjqvhRkB3M > SELF 0.00000000 Waves
{ "type": 13, "id": "CBTYBsa7RBN6d8kZrKtgcqSsEcjCAjy6Zm6vxikQEo8b", "fee": 1400000, "feeAssetId": null, "timestamp": 1646917219991, "version": 2, "chainId": 84, "sender": "3N3PoX8z2Mvu5YbaqZmtyF3dRFjqvhRkB3M", "senderPublicKey": "FWZMxrtn6KRrWMPXmQPqDg5eRzwB2YvHhMjMJpwnLmBi", "proofs": [ "5effBCrMPkCjaHvfJyNEm33ZvAnVJGDx2uFA6KUeJhJSG2KszXfdH9e8K8CbWboTW5HUmvGbJo6TQBLNj5rmJveg" ], "script": "base64:AAIFAAAAAAAABr0IAhIJCgcIAQEBAQEIEgMKAQESABIDCgEIEgAaHQoBQRIYZ2V0RW1pc3Npb25BZGRyZXNzT3JGYWlsGhwKAUISF2dldFN0YWtpbmdBZGRyZXNzT3JGYWlsGh4KAUMSGWdldEd3eFJld2FyZEFkZHJlc3NPckZhaWwaDgoBRBIJa2V5Q29uZmlnGh4KAUUSGWtleVJhdGVQZXJCbG9ja01heEN1cnJlbnQaIAoBRhIba2V5UmF0ZVBlckJsb2NrTWF4U3RhcnRGcm9tGg4KAUcSCXRpbWVzdGFtcBoKCgFIEgVibG9jaxobCgFJEhZrZXlSYXRlUGVyQmxvY2tDdXJyZW50Gh0KAUoSGGtleVJhdGVQZXJCbG9ja1N0YXJ0RnJvbRoaCgFLEhVrZXlFbWlzc2lvblN0YXJ0QmxvY2saIAoBTBIba2V5RW1pc3Npb25EdXJhdGlvbkluQmxvY2tzGhgKAU0SE2tleUVtaXNzaW9uRW5kQmxvY2saGAoBThITa2V5TWFuYWdlclB1YmxpY0tleRofCgFPEhprZXlQZW5kaW5nTWFuYW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original | compacted Prev: GA4wjDNWTNPnP47Afay9RXsK8k8829yXpMkg67i7ob8r Next: 3agbDC377kX4quSvwhKBdkGyNhmoELSL3e5RKm5SXGcd Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let SEP = "__" | |
5 | + | ||
6 | + | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), (("mandatory this." + key) + " is not defined")) | |
7 | + | ||
8 | + | ||
9 | + | func keyFactoryAddress () = "%s%s__config__factoryAddress" | |
10 | + | ||
11 | + | ||
12 | + | let IdxFactoryCfgStakingDapp = 1 | |
13 | + | ||
14 | + | let IdxFactoryCfgBoostingDapp = 2 | |
15 | + | ||
16 | + | let IdxFactoryCfgIdoDapp = 3 | |
17 | + | ||
18 | + | let IdxFactoryCfgTeamDapp = 4 | |
19 | + | ||
20 | + | let IdxFactoryCfgEmissionDapp = 5 | |
21 | + | ||
22 | + | let IdxFactoryCfgRestDapp = 6 | |
23 | + | ||
24 | + | let IdxFactoryCfgSlippageDapp = 7 | |
25 | + | ||
26 | + | let IdxFactoryCfgGwxRewardDapp = 10 | |
27 | + | ||
28 | + | func keyFactoryCfg () = "%s__factoryConfig" | |
29 | + | ||
30 | + | ||
31 | + | func keyFactoryLp2AssetsMapping (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
32 | + | ||
33 | + | ||
34 | + | func keyFactoryLpList () = "%s__lpTokensList" | |
35 | + | ||
36 | + | ||
37 | + | func keyFactoryLpAssetToPoolContractAddress (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
38 | + | ||
39 | + | ||
40 | + | func keyFactoryPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP) | |
41 | + | ||
42 | + | ||
43 | + | func readFactoryAddressOrFail () = addressFromStringValue(getStringOrFail(this, keyFactoryAddress())) | |
44 | + | ||
45 | + | ||
46 | + | func readLpList () = split(valueOrElse(getString(readFactoryAddressOrFail(), keyFactoryLpList()), ""), SEP) | |
47 | + | ||
48 | + | ||
49 | + | func readFactoryCfgOrFail (factory) = split(getStringOrFail(factory, keyFactoryCfg()), SEP) | |
50 | + | ||
51 | + | ||
52 | + | func getBoostingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgBoostingDapp]) | |
53 | + | ||
54 | + | ||
55 | + | func getEmissionAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgEmissionDapp]) | |
56 | + | ||
57 | + | ||
58 | + | func getStakingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgStakingDapp]) | |
59 | + | ||
60 | + | ||
61 | + | func getGwxRewardAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgGwxRewardDapp]) | |
62 | + | ||
63 | + | ||
64 | + | func keyConfig () = "%s__config" | |
65 | + | ||
66 | + | ||
67 | + | func keyRatePerBlockMaxCurrent () = "%s%s__ratePerBlockMax__current" | |
68 | + | ||
69 | + | ||
70 | + | func keyRatePerBlockMaxStartFrom (timestamp,block) = makeString(["%s%s%d%d__ratePerBlockMax__start", toString(timestamp), toString(block)], SEP) | |
71 | + | ||
72 | + | ||
73 | + | func keyRatePerBlockCurrent () = "%s%s__ratePerBlock__current" | |
74 | + | ||
75 | + | ||
76 | + | func keyRatePerBlockStartFrom (timestamp,block) = makeString(["%s%s%d%d__ratePerBlock__start", toString(timestamp), toString(block)], SEP) | |
77 | + | ||
78 | + | ||
79 | + | func keyEmissionStartBlock () = "%s%s__emission__startBlock" | |
80 | + | ||
81 | + | ||
82 | + | func keyEmissionDurationInBlocks () = "%s%s__emission__duration" | |
83 | + | ||
84 | + | ||
85 | + | func keyEmissionEndBlock () = "%s%s__emission__endBlock" | |
86 | + | ||
87 | + | ||
4 | 88 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
5 | 89 | ||
6 | 90 | ||
7 | 91 | func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey" | |
8 | - | ||
9 | - | ||
10 | - | let separator = "__" | |
11 | - | ||
12 | - | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), (((("mandatory " + toString(address)) + ".") + key) + " is not defined")) | |
13 | - | ||
14 | - | ||
15 | - | let keyStart = makeString(["%s", "start"], separator) | |
16 | - | ||
17 | - | let keyDuration = makeString(["%s", "duration"], separator) | |
18 | - | ||
19 | - | let keyAsset = makeString(["%s", "asset"], separator) | |
20 | - | ||
21 | - | let keyIsDataReady = makeString(["%s", "isDataReady"], separator) | |
22 | - | ||
23 | - | func keyUserRewardInfo (address) = makeString(["%s%s", "userRewardInfo", toString(address)], separator) | |
24 | - | ||
25 | - | ||
26 | - | func keyClaimHistoryRecord (address,txId) = makeString(["%s%s%s", "claimHistoryRecord", toString(address), toBase58String(txId)], separator) | |
27 | - | ||
28 | - | ||
29 | - | func formatHistoryRecord (amount) = makeString(["%d%d%d", toString(height), toString(lastBlock.timestamp), toString(amount)], separator) | |
30 | - | ||
31 | - | ||
32 | - | func dataUserRewardInfo (totalAmt,claimedAmt) = makeString(["%d%d", toString(totalAmt), toString(claimedAmt)], separator) | |
33 | - | ||
34 | - | ||
35 | - | func readUserRewardInfo (userAddr) = split(getStringOrFail(this, keyUserRewardInfo(userAddr)), separator) | |
36 | - | ||
37 | - | ||
38 | - | func checkIfDataIsReady () = { | |
39 | - | let isDataReady = valueOrElse(getBoolean(this, keyIsDataReady), false) | |
40 | - | if (isDataReady) | |
41 | - | then true | |
42 | - | else throw("Data is not ready") | |
43 | - | } | |
44 | - | ||
45 | - | ||
46 | - | func getUserRewards (address) = { | |
47 | - | let start = valueOrErrorMessage(getInteger(this, keyStart), "Start block is not specified") | |
48 | - | let duration = valueOrErrorMessage(getInteger(this, keyDuration), "Duration is not specified") | |
49 | - | let userRewardInfo = readUserRewardInfo(address) | |
50 | - | let total = parseIntValue(userRewardInfo[1]) | |
51 | - | let claimed = parseIntValue(userRewardInfo[2]) | |
52 | - | let availableTotal = fraction(total, min([duration, max([0, (height - start)])]), duration) | |
53 | - | let available = max([0, (availableTotal - claimed)]) | |
54 | - | $Tuple3(total, claimed, available) | |
55 | - | } | |
56 | 92 | ||
57 | 93 | ||
58 | 94 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
93 | 129 | ||
94 | 130 | ||
95 | 131 | @Callable(i) | |
96 | - | func constructor ( | |
132 | + | func constructor (factoryAddress,ratePerBlockMax,ratePerBlock,emissionStartBlock,emissionDuration,emissionStartTimestamp,wxAssetIdStr) = { | |
97 | 133 | let checkCaller = mustManager(i) | |
98 | 134 | if ((checkCaller == checkCaller)) | |
99 | - | then [IntegerEntry( | |
135 | + | then [IntegerEntry(keyRatePerBlockMaxStartFrom(emissionStartTimestamp, emissionStartBlock), ratePerBlockMax), IntegerEntry(keyRatePerBlockMaxCurrent(), ratePerBlockMax), IntegerEntry(keyRatePerBlockStartFrom(emissionStartTimestamp, emissionStartBlock), ratePerBlock), IntegerEntry(keyRatePerBlockCurrent(), ratePerBlock), IntegerEntry(keyEmissionStartBlock(), emissionStartBlock), IntegerEntry(keyEmissionDurationInBlocks(), emissionDuration), IntegerEntry(keyEmissionEndBlock(), (emissionStartBlock + emissionDuration)), StringEntry(keyFactoryAddress(), factoryAddress), StringEntry(keyConfig(), ("%s__" + wxAssetIdStr))] | |
100 | 136 | else throw("Strict value is not equal to itself.") | |
101 | 137 | } | |
102 | 138 | ||
103 | 139 | ||
104 | 140 | ||
105 | 141 | @Callable(i) | |
106 | - | func claim () = { | |
107 | - | let $t030183077 = getUserRewards(i.caller) | |
108 | - | let total = $t030183077._1 | |
109 | - | let claimed = $t030183077._2 | |
110 | - | let available = $t030183077._3 | |
111 | - | let asset = fromBase58String(getStringOrFail(this, keyAsset)) | |
112 | - | let balance = assetBalance(this, asset) | |
113 | - | let checks = [checkIfDataIsReady(), if ((available > 0)) | |
114 | - | then true | |
115 | - | else throw("No reward available"), if ((balance >= available)) | |
116 | - | then true | |
117 | - | else throw("Insufficient funds. Contact support")] | |
118 | - | if ((checks == checks)) | |
119 | - | then [ScriptTransfer(i.caller, available, asset), StringEntry(keyUserRewardInfo(i.caller), dataUserRewardInfo(total, (claimed + available))), StringEntry(keyClaimHistoryRecord(i.caller, i.transactionId), formatHistoryRecord(available))] | |
120 | - | else throw("Strict value is not equal to itself.") | |
121 | - | } | |
142 | + | func emit (amount) = if ((0 >= amount)) | |
143 | + | then $Tuple2(nil, nil) | |
144 | + | else { | |
145 | + | let factoryContract = readFactoryAddressOrFail() | |
146 | + | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
147 | + | let stakingContract = getStakingAddressOrFail(factoryCfg) | |
148 | + | let gwxRewardsContract = getGwxRewardAddressOrFail(factoryCfg) | |
149 | + | let caller = i.caller | |
150 | + | if (if ((caller != stakingContract)) | |
151 | + | then (caller != gwxRewardsContract) | |
152 | + | else false) | |
153 | + | then throw("permissions denied") | |
154 | + | else { | |
155 | + | let wxAssetIdStr = split(getStringOrFail(this, keyConfig()), SEP)[1] | |
156 | + | let wxAssetId = fromBase58String(wxAssetIdStr) | |
157 | + | $Tuple2([ScriptTransfer(caller, amount, wxAssetId)], [wxAssetId]) | |
158 | + | } | |
159 | + | } | |
122 | 160 | ||
123 | 161 | ||
124 | 162 | ||
125 | 163 | @Callable(i) | |
126 | - | func getUserRewardsREADONLY (address) = { | |
127 | - | let checks = [checkIfDataIsReady()] | |
128 | - | if ((checks == checks)) | |
129 | - | then { | |
130 | - | let $t037563839 = getUserRewards(addressFromStringValue(address)) | |
131 | - | let total = $t037563839._1 | |
132 | - | let claimed = $t037563839._2 | |
133 | - | let available = $t037563839._3 | |
134 | - | $Tuple2(nil, makeString(["%d%d%d", toString(total), toString(claimed), toString(available)], separator)) | |
164 | + | func burn () = { | |
165 | + | let factoryContract = readFactoryAddressOrFail() | |
166 | + | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
167 | + | let boostingContract = getBoostingAddressOrFail(factoryCfg) | |
168 | + | if ((size(i.payments) != 1)) | |
169 | + | then throw("exact one payment is allowed") | |
170 | + | else { | |
171 | + | let pmt = i.payments[0] | |
172 | + | let assetId = value(pmt.assetId) | |
173 | + | let pmtAmount = pmt.amount | |
174 | + | let wxAssetId = fromBase58String(split(getStringOrFail(this, keyConfig()), SEP)[1]) | |
175 | + | if ((assetId != wxAssetId)) | |
176 | + | then throw("invalid wxAssetId is passed") | |
177 | + | else if ((i.caller != boostingContract)) | |
178 | + | then throw("permissions denied") | |
179 | + | else [Burn(assetId, pmtAmount), StringEntry(("%s%s%s__history__burn__" + toBase58String(i.transactionId)), makeString(["%d%d%d", toString(height), toString(lastBlock.timestamp), toString(pmtAmount)], SEP))] | |
135 | 180 | } | |
136 | - | else throw("Strict value is not equal to itself.") | |
137 | 181 | } | |
138 | 182 | ||
139 | 183 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let SEP = "__" | |
5 | + | ||
6 | + | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), (("mandatory this." + key) + " is not defined")) | |
7 | + | ||
8 | + | ||
9 | + | func keyFactoryAddress () = "%s%s__config__factoryAddress" | |
10 | + | ||
11 | + | ||
12 | + | let IdxFactoryCfgStakingDapp = 1 | |
13 | + | ||
14 | + | let IdxFactoryCfgBoostingDapp = 2 | |
15 | + | ||
16 | + | let IdxFactoryCfgIdoDapp = 3 | |
17 | + | ||
18 | + | let IdxFactoryCfgTeamDapp = 4 | |
19 | + | ||
20 | + | let IdxFactoryCfgEmissionDapp = 5 | |
21 | + | ||
22 | + | let IdxFactoryCfgRestDapp = 6 | |
23 | + | ||
24 | + | let IdxFactoryCfgSlippageDapp = 7 | |
25 | + | ||
26 | + | let IdxFactoryCfgGwxRewardDapp = 10 | |
27 | + | ||
28 | + | func keyFactoryCfg () = "%s__factoryConfig" | |
29 | + | ||
30 | + | ||
31 | + | func keyFactoryLp2AssetsMapping (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
32 | + | ||
33 | + | ||
34 | + | func keyFactoryLpList () = "%s__lpTokensList" | |
35 | + | ||
36 | + | ||
37 | + | func keyFactoryLpAssetToPoolContractAddress (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
38 | + | ||
39 | + | ||
40 | + | func keyFactoryPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP) | |
41 | + | ||
42 | + | ||
43 | + | func readFactoryAddressOrFail () = addressFromStringValue(getStringOrFail(this, keyFactoryAddress())) | |
44 | + | ||
45 | + | ||
46 | + | func readLpList () = split(valueOrElse(getString(readFactoryAddressOrFail(), keyFactoryLpList()), ""), SEP) | |
47 | + | ||
48 | + | ||
49 | + | func readFactoryCfgOrFail (factory) = split(getStringOrFail(factory, keyFactoryCfg()), SEP) | |
50 | + | ||
51 | + | ||
52 | + | func getBoostingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgBoostingDapp]) | |
53 | + | ||
54 | + | ||
55 | + | func getEmissionAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgEmissionDapp]) | |
56 | + | ||
57 | + | ||
58 | + | func getStakingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgStakingDapp]) | |
59 | + | ||
60 | + | ||
61 | + | func getGwxRewardAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgGwxRewardDapp]) | |
62 | + | ||
63 | + | ||
64 | + | func keyConfig () = "%s__config" | |
65 | + | ||
66 | + | ||
67 | + | func keyRatePerBlockMaxCurrent () = "%s%s__ratePerBlockMax__current" | |
68 | + | ||
69 | + | ||
70 | + | func keyRatePerBlockMaxStartFrom (timestamp,block) = makeString(["%s%s%d%d__ratePerBlockMax__start", toString(timestamp), toString(block)], SEP) | |
71 | + | ||
72 | + | ||
73 | + | func keyRatePerBlockCurrent () = "%s%s__ratePerBlock__current" | |
74 | + | ||
75 | + | ||
76 | + | func keyRatePerBlockStartFrom (timestamp,block) = makeString(["%s%s%d%d__ratePerBlock__start", toString(timestamp), toString(block)], SEP) | |
77 | + | ||
78 | + | ||
79 | + | func keyEmissionStartBlock () = "%s%s__emission__startBlock" | |
80 | + | ||
81 | + | ||
82 | + | func keyEmissionDurationInBlocks () = "%s%s__emission__duration" | |
83 | + | ||
84 | + | ||
85 | + | func keyEmissionEndBlock () = "%s%s__emission__endBlock" | |
86 | + | ||
87 | + | ||
4 | 88 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
5 | 89 | ||
6 | 90 | ||
7 | 91 | func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey" | |
8 | - | ||
9 | - | ||
10 | - | let separator = "__" | |
11 | - | ||
12 | - | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), (((("mandatory " + toString(address)) + ".") + key) + " is not defined")) | |
13 | - | ||
14 | - | ||
15 | - | let keyStart = makeString(["%s", "start"], separator) | |
16 | - | ||
17 | - | let keyDuration = makeString(["%s", "duration"], separator) | |
18 | - | ||
19 | - | let keyAsset = makeString(["%s", "asset"], separator) | |
20 | - | ||
21 | - | let keyIsDataReady = makeString(["%s", "isDataReady"], separator) | |
22 | - | ||
23 | - | func keyUserRewardInfo (address) = makeString(["%s%s", "userRewardInfo", toString(address)], separator) | |
24 | - | ||
25 | - | ||
26 | - | func keyClaimHistoryRecord (address,txId) = makeString(["%s%s%s", "claimHistoryRecord", toString(address), toBase58String(txId)], separator) | |
27 | - | ||
28 | - | ||
29 | - | func formatHistoryRecord (amount) = makeString(["%d%d%d", toString(height), toString(lastBlock.timestamp), toString(amount)], separator) | |
30 | - | ||
31 | - | ||
32 | - | func dataUserRewardInfo (totalAmt,claimedAmt) = makeString(["%d%d", toString(totalAmt), toString(claimedAmt)], separator) | |
33 | - | ||
34 | - | ||
35 | - | func readUserRewardInfo (userAddr) = split(getStringOrFail(this, keyUserRewardInfo(userAddr)), separator) | |
36 | - | ||
37 | - | ||
38 | - | func checkIfDataIsReady () = { | |
39 | - | let isDataReady = valueOrElse(getBoolean(this, keyIsDataReady), false) | |
40 | - | if (isDataReady) | |
41 | - | then true | |
42 | - | else throw("Data is not ready") | |
43 | - | } | |
44 | - | ||
45 | - | ||
46 | - | func getUserRewards (address) = { | |
47 | - | let start = valueOrErrorMessage(getInteger(this, keyStart), "Start block is not specified") | |
48 | - | let duration = valueOrErrorMessage(getInteger(this, keyDuration), "Duration is not specified") | |
49 | - | let userRewardInfo = readUserRewardInfo(address) | |
50 | - | let total = parseIntValue(userRewardInfo[1]) | |
51 | - | let claimed = parseIntValue(userRewardInfo[2]) | |
52 | - | let availableTotal = fraction(total, min([duration, max([0, (height - start)])]), duration) | |
53 | - | let available = max([0, (availableTotal - claimed)]) | |
54 | - | $Tuple3(total, claimed, available) | |
55 | - | } | |
56 | 92 | ||
57 | 93 | ||
58 | 94 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
59 | 95 | case s: String => | |
60 | 96 | fromBase58String(s) | |
61 | 97 | case _: Unit => | |
62 | 98 | unit | |
63 | 99 | case _ => | |
64 | 100 | throw("Match error") | |
65 | 101 | } | |
66 | 102 | ||
67 | 103 | ||
68 | 104 | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
69 | 105 | case s: String => | |
70 | 106 | fromBase58String(s) | |
71 | 107 | case _: Unit => | |
72 | 108 | unit | |
73 | 109 | case _ => | |
74 | 110 | throw("Match error") | |
75 | 111 | } | |
76 | 112 | ||
77 | 113 | ||
78 | 114 | func mustManager (i) = { | |
79 | 115 | let pd = throw("Permission denied") | |
80 | 116 | match managerPublicKeyOrUnit() { | |
81 | 117 | case pk: ByteVector => | |
82 | 118 | if ((i.callerPublicKey == pk)) | |
83 | 119 | then true | |
84 | 120 | else pd | |
85 | 121 | case _: Unit => | |
86 | 122 | if ((i.caller == this)) | |
87 | 123 | then true | |
88 | 124 | else pd | |
89 | 125 | case _ => | |
90 | 126 | throw("Match error") | |
91 | 127 | } | |
92 | 128 | } | |
93 | 129 | ||
94 | 130 | ||
95 | 131 | @Callable(i) | |
96 | - | func constructor ( | |
132 | + | func constructor (factoryAddress,ratePerBlockMax,ratePerBlock,emissionStartBlock,emissionDuration,emissionStartTimestamp,wxAssetIdStr) = { | |
97 | 133 | let checkCaller = mustManager(i) | |
98 | 134 | if ((checkCaller == checkCaller)) | |
99 | - | then [IntegerEntry( | |
135 | + | then [IntegerEntry(keyRatePerBlockMaxStartFrom(emissionStartTimestamp, emissionStartBlock), ratePerBlockMax), IntegerEntry(keyRatePerBlockMaxCurrent(), ratePerBlockMax), IntegerEntry(keyRatePerBlockStartFrom(emissionStartTimestamp, emissionStartBlock), ratePerBlock), IntegerEntry(keyRatePerBlockCurrent(), ratePerBlock), IntegerEntry(keyEmissionStartBlock(), emissionStartBlock), IntegerEntry(keyEmissionDurationInBlocks(), emissionDuration), IntegerEntry(keyEmissionEndBlock(), (emissionStartBlock + emissionDuration)), StringEntry(keyFactoryAddress(), factoryAddress), StringEntry(keyConfig(), ("%s__" + wxAssetIdStr))] | |
100 | 136 | else throw("Strict value is not equal to itself.") | |
101 | 137 | } | |
102 | 138 | ||
103 | 139 | ||
104 | 140 | ||
105 | 141 | @Callable(i) | |
106 | - | func claim () = { | |
107 | - | let $t030183077 = getUserRewards(i.caller) | |
108 | - | let total = $t030183077._1 | |
109 | - | let claimed = $t030183077._2 | |
110 | - | let available = $t030183077._3 | |
111 | - | let asset = fromBase58String(getStringOrFail(this, keyAsset)) | |
112 | - | let balance = assetBalance(this, asset) | |
113 | - | let checks = [checkIfDataIsReady(), if ((available > 0)) | |
114 | - | then true | |
115 | - | else throw("No reward available"), if ((balance >= available)) | |
116 | - | then true | |
117 | - | else throw("Insufficient funds. Contact support")] | |
118 | - | if ((checks == checks)) | |
119 | - | then [ScriptTransfer(i.caller, available, asset), StringEntry(keyUserRewardInfo(i.caller), dataUserRewardInfo(total, (claimed + available))), StringEntry(keyClaimHistoryRecord(i.caller, i.transactionId), formatHistoryRecord(available))] | |
120 | - | else throw("Strict value is not equal to itself.") | |
121 | - | } | |
142 | + | func emit (amount) = if ((0 >= amount)) | |
143 | + | then $Tuple2(nil, nil) | |
144 | + | else { | |
145 | + | let factoryContract = readFactoryAddressOrFail() | |
146 | + | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
147 | + | let stakingContract = getStakingAddressOrFail(factoryCfg) | |
148 | + | let gwxRewardsContract = getGwxRewardAddressOrFail(factoryCfg) | |
149 | + | let caller = i.caller | |
150 | + | if (if ((caller != stakingContract)) | |
151 | + | then (caller != gwxRewardsContract) | |
152 | + | else false) | |
153 | + | then throw("permissions denied") | |
154 | + | else { | |
155 | + | let wxAssetIdStr = split(getStringOrFail(this, keyConfig()), SEP)[1] | |
156 | + | let wxAssetId = fromBase58String(wxAssetIdStr) | |
157 | + | $Tuple2([ScriptTransfer(caller, amount, wxAssetId)], [wxAssetId]) | |
158 | + | } | |
159 | + | } | |
122 | 160 | ||
123 | 161 | ||
124 | 162 | ||
125 | 163 | @Callable(i) | |
126 | - | func getUserRewardsREADONLY (address) = { | |
127 | - | let checks = [checkIfDataIsReady()] | |
128 | - | if ((checks == checks)) | |
129 | - | then { | |
130 | - | let $t037563839 = getUserRewards(addressFromStringValue(address)) | |
131 | - | let total = $t037563839._1 | |
132 | - | let claimed = $t037563839._2 | |
133 | - | let available = $t037563839._3 | |
134 | - | $Tuple2(nil, makeString(["%d%d%d", toString(total), toString(claimed), toString(available)], separator)) | |
164 | + | func burn () = { | |
165 | + | let factoryContract = readFactoryAddressOrFail() | |
166 | + | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
167 | + | let boostingContract = getBoostingAddressOrFail(factoryCfg) | |
168 | + | if ((size(i.payments) != 1)) | |
169 | + | then throw("exact one payment is allowed") | |
170 | + | else { | |
171 | + | let pmt = i.payments[0] | |
172 | + | let assetId = value(pmt.assetId) | |
173 | + | let pmtAmount = pmt.amount | |
174 | + | let wxAssetId = fromBase58String(split(getStringOrFail(this, keyConfig()), SEP)[1]) | |
175 | + | if ((assetId != wxAssetId)) | |
176 | + | then throw("invalid wxAssetId is passed") | |
177 | + | else if ((i.caller != boostingContract)) | |
178 | + | then throw("permissions denied") | |
179 | + | else [Burn(assetId, pmtAmount), StringEntry(("%s%s%s__history__burn__" + toBase58String(i.transactionId)), makeString(["%d%d%d", toString(height), toString(lastBlock.timestamp), toString(pmtAmount)], SEP))] | |
135 | 180 | } | |
136 | - | else throw("Strict value is not equal to itself.") | |
137 | 181 | } | |
138 | 182 | ||
139 | 183 | ||
140 | 184 | ||
141 | 185 | @Callable(i) | |
142 | 186 | func setManager (pendingManagerPublicKey) = { | |
143 | 187 | let checkCaller = mustManager(i) | |
144 | 188 | if ((checkCaller == checkCaller)) | |
145 | 189 | then { | |
146 | 190 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
147 | 191 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
148 | 192 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
149 | 193 | else throw("Strict value is not equal to itself.") | |
150 | 194 | } | |
151 | 195 | else throw("Strict value is not equal to itself.") | |
152 | 196 | } | |
153 | 197 | ||
154 | 198 | ||
155 | 199 | ||
156 | 200 | @Callable(i) | |
157 | 201 | func confirmManager () = { | |
158 | 202 | let pm = pendingManagerPublicKeyOrUnit() | |
159 | 203 | let hasPM = if (isDefined(pm)) | |
160 | 204 | then true | |
161 | 205 | else throw("No pending manager") | |
162 | 206 | if ((hasPM == hasPM)) | |
163 | 207 | then { | |
164 | 208 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
165 | 209 | then true | |
166 | 210 | else throw("You are not pending manager") | |
167 | 211 | if ((checkPM == checkPM)) | |
168 | 212 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
169 | 213 | else throw("Strict value is not equal to itself.") | |
170 | 214 | } | |
171 | 215 | else throw("Strict value is not equal to itself.") | |
172 | 216 | } | |
173 | 217 | ||
174 | 218 | ||
175 | 219 | @Verifier(tx) | |
176 | 220 | func verify () = { | |
177 | 221 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
178 | 222 | case pk: ByteVector => | |
179 | 223 | pk | |
180 | 224 | case _: Unit => | |
181 | 225 | tx.senderPublicKey | |
182 | 226 | case _ => | |
183 | 227 | throw("Match error") | |
184 | 228 | } | |
185 | 229 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
186 | 230 | } | |
187 | 231 |
github/deemru/w8io/026f985 39.82 ms ◑