tx · HiW16mYq6KyiLmdMS3vLGTRWu8widLEP9dKFYCw9kpxg

3N5rNyYSAsaP9QL2eQq286RhevB8msHFffu:  -0.05000000 Waves

2020.11.15 17:31 [1266602] smart account 3N5rNyYSAsaP9QL2eQq286RhevB8msHFffu > SELF 0.00000000 Waves

{ "type": 13, "id": "HiW16mYq6KyiLmdMS3vLGTRWu8widLEP9dKFYCw9kpxg", "fee": 5000000, "feeAssetId": null, "timestamp": 1605450738161, "version": 2, "chainId": 84, "sender": "3N5rNyYSAsaP9QL2eQq286RhevB8msHFffu", "senderPublicKey": "CBTEuFN6ku1LNaPuGHHTMh2CBb3kPa5D73XXTJvKydun", "proofs": [ "2LLdiwjZvaLTCzaPCszkwBdtPFf8PXWoC8bHrv8Eetwn7oywjB9tsXwwfA1P2waBMkPndym7EGFG4pNGy2Wsot3t" ], "script": "base64:AAIDAAAAAAAAACcIARIHCgUICAgICBIECgIICBIDCgEIEgMKAQgSABIDCgEBEgMKAQEAAAAQAAAAAAZ1cFZvdGUCAAAABnVwdm90ZQAAAAAMYWRtaW5BZGRyZXNzAQAAABoBVDi2IViANlgIPSCUAVQpoGSXhJ2Tw/Y0iwAAAAAFZHl6SWQBAAAAIH6rQdnOUsq3YY00nk9jVDL2OOQ/e846gXAImq8xTxZrAQAAAA9nZXRTdGFrZVBvb2xLZXkAAAAAAgAAAApzdGFrZV9wb29sAQAAAAxnZXRTdGFrZVBvb2wAAAAABAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMJAQAAAA9nZXRTdGFrZVBvb2xLZXkAAAAAAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAABAAAADGdldFN0YWtlcktleQAAAAEAAAAGc3Rha2VyCQABLAAAAAIFAAAABnN0YWtlcgIAAAAGX3N0YWtlAQAAAA9nZXRDdXJyZW50U3Rha2UAAAABAAAABnN0YWtlcgQAAAAHJG1hdGNoMAkABB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dhaW4gbGF0ZXIDCQAAZgAAAAIFAAAABnJld2FyZAUAAAAJc3Rha2VQb29sCQAAAgAAAAECAAAAF05vIHJld2FyZHMgYXQgdGhpcyB0aW1lBAAAAAxuZXdTdGFrZVBvb2wJAABlAAAAAgUAAAAJc3Rha2VQb29sBQAAAAZyZXdhcmQEAAAADm5ld1N0YWtlQW1vdW50CQAAZQAAAAIFAAAADGN1cnJlbnRTdGFrZQUAAAAGcmV3YXJkCQEAAAAMU2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAADGdldFN0YWtlcktleQAAAAEFAAAABnN0YWtlcgUAAAAObmV3U3Rha2VBbW91bnQJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAAA9nZXRTdGFrZVBvb2xLZXkAAAAABQAAAAxuZXdTdGFrZVBvb2wFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAABnJld2FyZAUAAAAFZHl6SWQFAAAAA25pbAAAAABIs+xe", "height": 1266602, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DBo8gern8siwr5h3cZKaV1p9GPuNDkkPEMVQ9rAq7kuf Next: HXhCWcTPfxBjG9SJEiqG3XwWDgfubBxrWKxoe55NwkKR Diff:
OldNewDifferences
33 {-# CONTENT_TYPE DAPP #-}
44 let upVote = "upvote"
55
6-let adminAddress1 = base58'3Mu5woJ54s7vHJgaeNcJ4C9ByfdmMF2jpjC'
7-
8-let adminAddress2 = base58'3NAqtCScgFynCuRLUoXm2BHTdu8suatCe7b'
9-
10-let adminAddress3 = base58'3Mucpi1K4FMVrZKnYEgjxQf5DkkBX7QrHoJ'
6+let adminAddress = base58'3Mu5woJ54s7vHJgaeNcJ4C9ByfdmMF2jpjC'
117
128 let dyzId = base58'9XTqBQeJvdMs8VNHv6rXiJLJichg2acG7wCfYcTajQ1G'
9+
10+func getStakePoolKey () = "stake_pool"
11+
12+
13+func getStakePool () = match getInteger(this, getStakePoolKey()) {
14+ case a: Int =>
15+ a
16+ case _ =>
17+ 0
18+}
19+
20+
21+func getStakerKey (staker) = (staker + "_stake")
22+
23+
24+func getCurrentStake (staker) = match getInteger(this, getStakerKey(staker)) {
25+ case a: Int =>
26+ a
27+ case _ =>
28+ 0
29+}
30+
1331
1432 func getProfileKey (id) = (id + "_entrepreneurProfile")
1533
1735 func getStatusKey (id) = (id + "_status")
1836
1937
20-func getVoterAmountKey (id,voteId) = (((id + "_") + voteId) + "_amount")
21-
22-
2338 func getVoteKey (id,type) = if ((type == "upvote"))
2439 then (id + "_upvote")
25- else throw("Invalid vote type")
26-
27-
28-func getVoteAmountKey (id,type) = if ((type == "upvote"))
29- then (((id + "_") + type) + "_amount")
3040 else throw("Invalid vote type")
3141
3242
5464 }
5565
5666
57-func getVoteAmountCount (voteId,vote) = match getInteger(this, getVoteAmountKey(voteId, vote)) {
58- case a: Int =>
59- a
60- case _ =>
61- 0
62-}
63-
64-
6567 func getVoterKey (address,voteId) = ((((address + "_") + voteId) + "_") + "vote")
6668
6769
8183 }
8284
8385
84-func getStakerKey (staker) = (staker + "_stake")
85-
86-
87-func getCurrentStake (staker) = match getInteger(this, getStakerKey(staker)) {
88- case a: Int =>
89- a
90- case _ =>
91- 0
92-}
93-
94-
95-func getStakePoolKey () = "stake_pool"
96-
97-
98-func getStakePool () = match getInteger(this, getStakePoolKey()) {
99- case a: Int =>
100- a
101- case _ =>
102- 0
103-}
104-
105-
10686 @Callable(i)
107-func addEntrepreneurProfile (name,avatar,bio,gender,location) = if (if (if ((i.caller.bytes == adminAddress1))
108- then true
109- else (i.caller.bytes == adminAddress2))
110- then true
111- else (i.caller.bytes == adminAddress3))
112- then {
87+func addEntrepreneurProfile (name,avatar,bio,gender,location) = if ((i.caller.bytes != adminAddress))
88+ then throw("Only Dyzrupt Admin can call this dApp function")
89+ else {
11390 let transactionId = toBase58String(i.transactionId)
114- WriteSet([DataEntry(getProfileKey(transactionId), ((((((((name + "_") + avatar) + "_") + bio) + "_") + gender) + "_") + location)), DataEntry(getVoteKey(transactionId, "upvote"), 0), DataEntry(getVoteAmountKey(transactionId, "upvote"), 0), DataEntry(getStatusKey(transactionId), "open")])
91+ WriteSet([DataEntry(getProfileKey(transactionId), ((((((((name + "_") + avatar) + "_") + bio) + "_") + gender) + "_") + location)), DataEntry(getVoteKey(transactionId, "upvote"), 0), DataEntry(getStatusKey(transactionId), "open")])
11592 }
116- else throw("Only Dyzrupt Admin can call this dApp function")
11793
11894
11995
12096 @Callable(i)
12197 func vote (voteId,vote) = {
12298 let pmt = extract(i.payment)
123- let voter = toBase58String(i.caller.bytes)
12499 if ((pmt.amount == 0))
125100 then throw("You cannot vote without paying voting fee")
126101 else if ((pmt.assetId != base58'9XTqBQeJvdMs8VNHv6rXiJLJichg2acG7wCfYcTajQ1G'))
127102 then throw("You can only vote with DYZRUPT token")
128- else if (canVote(voter, voteId))
103+ else if (canVote(toBase58String(i.caller.bytes), voteId))
129104 then if (profileExist(voteId))
130105 then if ((getVoteStatus(voteId) == "open"))
131106 then if ((vote == upVote))
132107 then {
133108 let voteCount = getVoteCount(voteId, vote)
134- let voteAmountCount = getVoteAmountCount(voteId, vote)
135109 let newVoteCount = (voteCount + 1)
136- let newVoteAmountCount = (voteAmountCount + pmt.amount)
137- ScriptResult(WriteSet([DataEntry(getVoteKey(voteId, vote), newVoteCount), DataEntry(getVoterKey(voter, voteId), voteId), DataEntry(getVoterAmountKey(voter, voteId), pmt.amount), DataEntry(getVoteAmountKey(voteId, vote), newVoteAmountCount)]), TransferSet([ScriptTransfer(this, pmt.amount, dyzId)]))
110+ ScriptResult(WriteSet([DataEntry(getVoteKey(voteId, vote), newVoteCount), DataEntry(getVoterKey(toBase58String(i.caller.bytes), voteId), voteId)]), TransferSet([ScriptTransfer(this, pmt.amount, dyzId)]))
138111 }
139112 else throw("Not a valid vote value")
140113 else throw("This profile is not open for voting")
145118
146119
147120 @Callable(i)
148-func openVote (voteId) = if (if (if ((i.caller.bytes == adminAddress1))
149- then true
150- else (i.caller.bytes == adminAddress2))
151- then true
152- else (i.caller.bytes == adminAddress3))
153- then if (profileExist(voteId))
121+func openVote (voteId) = if ((i.caller.bytes != adminAddress))
122+ then throw("Only Dyzrupt Admin can call this dApp function")
123+ else if (profileExist(voteId))
154124 then WriteSet([DataEntry(getStatusKey(voteId), "open")])
155125 else throw("Invalid ID")
156- else throw("Only Dyzrupt Admin can call this dApp function")
157126
158127
159128
160129 @Callable(i)
161-func closeVote (voteId) = if (if (if ((i.caller.bytes == adminAddress1))
162- then true
163- else (i.caller.bytes == adminAddress2))
164- then true
165- else (i.caller.bytes == adminAddress3))
166- then if (profileExist(voteId))
130+func closeVote (voteId) = if ((i.caller.bytes != adminAddress))
131+ then throw("Only Dyzrupt Admin can call this dApp function")
132+ else if (profileExist(voteId))
167133 then WriteSet([DataEntry(getStatusKey(voteId), "closed")])
168134 else throw("Invalid ID")
169- else throw("Only Dyzrupt Admin can call this dApp function")
170-
171-
172-
173-@Callable(i)
174-func withdraw (voteId) = {
175- let voter = toBase58String(i.caller.bytes)
176- if ((getVoter(voter, voteId) != ""))
177- then if ((getVoteStatus(voteId) == "closed"))
178- then {
179- let currentKey = getVoterAmountKey(voter, voteId)
180- let currentAmount = match getInteger(this, currentKey) {
181- case a: Int =>
182- a
183- case _ =>
184- throw("You didn't vote for this entrepreneur")
185- }
186- if ((currentAmount == 0))
187- then throw("Seems you have previously withdrawn.")
188- else ScriptResult(WriteSet([DataEntry(currentKey, 0)]), TransferSet([ScriptTransfer(i.caller, currentAmount, dyzId)]))
189- }
190- else throw("Can't withdraw vote amount while voting is still open.")
191- else throw("You didn't vote for this entrepreneur")
192- }
193135
194136
195137
203145 then throw("You can only stake with DYZRUPT token")
204146 else {
205147 let currentStake = getCurrentStake(staker)
206- let stakePercent = (10 / 100)
207- let stakeableAmount = (pmt.amount * stakePercent)
148+ let stakeableAmount = fraction(pmt.amount, 10, 100)
208149 let amountToStake = (pmt.amount - stakeableAmount)
209150 let newStakedAmount = (currentStake + amountToStake)
210151 let stakePool = getStakePool()
211152 let newStakePool = (stakePool + stakeableAmount)
212- ScriptResult(WriteSet([DataEntry(getStakerKey(staker), newStakedAmount), DataEntry(getStakePoolKey(), newStakePool)]), TransferSet([ScriptTransfer(this, pmt.amount, dyzId)]))
153+ ScriptResult(WriteSet([DataEntry(getStakerKey(staker), newStakedAmount), DataEntry(getStakePoolKey(), newStakePool)]), TransferSet(nil))
213154 }
214155 }
215156
224165 else if ((amount > currentStake))
225166 then throw("You can't withdraw an amount higher than you staked")
226167 else {
227- let unstakePercent = (20 / 100)
228- let unstakeableAmount = (amount * unstakePercent)
168+ let unstakeableAmount = fraction(amount, 20, 100)
229169 let amountToUnstake = (amount - unstakeableAmount)
230170 let newUnstakedAmount = (currentStake - amount)
231171 let stakePool = getStakePool()
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let upVote = "upvote"
55
6-let adminAddress1 = base58'3Mu5woJ54s7vHJgaeNcJ4C9ByfdmMF2jpjC'
7-
8-let adminAddress2 = base58'3NAqtCScgFynCuRLUoXm2BHTdu8suatCe7b'
9-
10-let adminAddress3 = base58'3Mucpi1K4FMVrZKnYEgjxQf5DkkBX7QrHoJ'
6+let adminAddress = base58'3Mu5woJ54s7vHJgaeNcJ4C9ByfdmMF2jpjC'
117
128 let dyzId = base58'9XTqBQeJvdMs8VNHv6rXiJLJichg2acG7wCfYcTajQ1G'
9+
10+func getStakePoolKey () = "stake_pool"
11+
12+
13+func getStakePool () = match getInteger(this, getStakePoolKey()) {
14+ case a: Int =>
15+ a
16+ case _ =>
17+ 0
18+}
19+
20+
21+func getStakerKey (staker) = (staker + "_stake")
22+
23+
24+func getCurrentStake (staker) = match getInteger(this, getStakerKey(staker)) {
25+ case a: Int =>
26+ a
27+ case _ =>
28+ 0
29+}
30+
1331
1432 func getProfileKey (id) = (id + "_entrepreneurProfile")
1533
1634
1735 func getStatusKey (id) = (id + "_status")
1836
1937
20-func getVoterAmountKey (id,voteId) = (((id + "_") + voteId) + "_amount")
21-
22-
2338 func getVoteKey (id,type) = if ((type == "upvote"))
2439 then (id + "_upvote")
25- else throw("Invalid vote type")
26-
27-
28-func getVoteAmountKey (id,type) = if ((type == "upvote"))
29- then (((id + "_") + type) + "_amount")
3040 else throw("Invalid vote type")
3141
3242
3343 func profileExist (id) = match getString(this, getProfileKey(id)) {
3444 case a: String =>
3545 true
3646 case _ =>
3747 false
3848 }
3949
4050
4151 func getVoteStatus (voteId) = match getString(this, getStatusKey(voteId)) {
4252 case a: String =>
4353 a
4454 case _ =>
4555 false
4656 }
4757
4858
4959 func getVoteCount (voteId,vote) = match getInteger(this, getVoteKey(voteId, vote)) {
5060 case a: Int =>
5161 a
5262 case _ =>
5363 throw("Not a valid vote ID")
5464 }
5565
5666
57-func getVoteAmountCount (voteId,vote) = match getInteger(this, getVoteAmountKey(voteId, vote)) {
58- case a: Int =>
59- a
60- case _ =>
61- 0
62-}
63-
64-
6567 func getVoterKey (address,voteId) = ((((address + "_") + voteId) + "_") + "vote")
6668
6769
6870 func getVoter (address,voteId) = match getString(this, getVoterKey(address, voteId)) {
6971 case a: String =>
7072 a
7173 case _ =>
7274 ""
7375 }
7476
7577
7678 func canVote (address,voteId) = {
7779 let voter = getVoter(address, voteId)
7880 if ((voter == ""))
7981 then true
8082 else false
8183 }
8284
8385
84-func getStakerKey (staker) = (staker + "_stake")
85-
86-
87-func getCurrentStake (staker) = match getInteger(this, getStakerKey(staker)) {
88- case a: Int =>
89- a
90- case _ =>
91- 0
92-}
93-
94-
95-func getStakePoolKey () = "stake_pool"
96-
97-
98-func getStakePool () = match getInteger(this, getStakePoolKey()) {
99- case a: Int =>
100- a
101- case _ =>
102- 0
103-}
104-
105-
10686 @Callable(i)
107-func addEntrepreneurProfile (name,avatar,bio,gender,location) = if (if (if ((i.caller.bytes == adminAddress1))
108- then true
109- else (i.caller.bytes == adminAddress2))
110- then true
111- else (i.caller.bytes == adminAddress3))
112- then {
87+func addEntrepreneurProfile (name,avatar,bio,gender,location) = if ((i.caller.bytes != adminAddress))
88+ then throw("Only Dyzrupt Admin can call this dApp function")
89+ else {
11390 let transactionId = toBase58String(i.transactionId)
114- WriteSet([DataEntry(getProfileKey(transactionId), ((((((((name + "_") + avatar) + "_") + bio) + "_") + gender) + "_") + location)), DataEntry(getVoteKey(transactionId, "upvote"), 0), DataEntry(getVoteAmountKey(transactionId, "upvote"), 0), DataEntry(getStatusKey(transactionId), "open")])
91+ WriteSet([DataEntry(getProfileKey(transactionId), ((((((((name + "_") + avatar) + "_") + bio) + "_") + gender) + "_") + location)), DataEntry(getVoteKey(transactionId, "upvote"), 0), DataEntry(getStatusKey(transactionId), "open")])
11592 }
116- else throw("Only Dyzrupt Admin can call this dApp function")
11793
11894
11995
12096 @Callable(i)
12197 func vote (voteId,vote) = {
12298 let pmt = extract(i.payment)
123- let voter = toBase58String(i.caller.bytes)
12499 if ((pmt.amount == 0))
125100 then throw("You cannot vote without paying voting fee")
126101 else if ((pmt.assetId != base58'9XTqBQeJvdMs8VNHv6rXiJLJichg2acG7wCfYcTajQ1G'))
127102 then throw("You can only vote with DYZRUPT token")
128- else if (canVote(voter, voteId))
103+ else if (canVote(toBase58String(i.caller.bytes), voteId))
129104 then if (profileExist(voteId))
130105 then if ((getVoteStatus(voteId) == "open"))
131106 then if ((vote == upVote))
132107 then {
133108 let voteCount = getVoteCount(voteId, vote)
134- let voteAmountCount = getVoteAmountCount(voteId, vote)
135109 let newVoteCount = (voteCount + 1)
136- let newVoteAmountCount = (voteAmountCount + pmt.amount)
137- ScriptResult(WriteSet([DataEntry(getVoteKey(voteId, vote), newVoteCount), DataEntry(getVoterKey(voter, voteId), voteId), DataEntry(getVoterAmountKey(voter, voteId), pmt.amount), DataEntry(getVoteAmountKey(voteId, vote), newVoteAmountCount)]), TransferSet([ScriptTransfer(this, pmt.amount, dyzId)]))
110+ ScriptResult(WriteSet([DataEntry(getVoteKey(voteId, vote), newVoteCount), DataEntry(getVoterKey(toBase58String(i.caller.bytes), voteId), voteId)]), TransferSet([ScriptTransfer(this, pmt.amount, dyzId)]))
138111 }
139112 else throw("Not a valid vote value")
140113 else throw("This profile is not open for voting")
141114 else throw("Invalid Profile")
142115 else throw("You can't vote twice")
143116 }
144117
145118
146119
147120 @Callable(i)
148-func openVote (voteId) = if (if (if ((i.caller.bytes == adminAddress1))
149- then true
150- else (i.caller.bytes == adminAddress2))
151- then true
152- else (i.caller.bytes == adminAddress3))
153- then if (profileExist(voteId))
121+func openVote (voteId) = if ((i.caller.bytes != adminAddress))
122+ then throw("Only Dyzrupt Admin can call this dApp function")
123+ else if (profileExist(voteId))
154124 then WriteSet([DataEntry(getStatusKey(voteId), "open")])
155125 else throw("Invalid ID")
156- else throw("Only Dyzrupt Admin can call this dApp function")
157126
158127
159128
160129 @Callable(i)
161-func closeVote (voteId) = if (if (if ((i.caller.bytes == adminAddress1))
162- then true
163- else (i.caller.bytes == adminAddress2))
164- then true
165- else (i.caller.bytes == adminAddress3))
166- then if (profileExist(voteId))
130+func closeVote (voteId) = if ((i.caller.bytes != adminAddress))
131+ then throw("Only Dyzrupt Admin can call this dApp function")
132+ else if (profileExist(voteId))
167133 then WriteSet([DataEntry(getStatusKey(voteId), "closed")])
168134 else throw("Invalid ID")
169- else throw("Only Dyzrupt Admin can call this dApp function")
170-
171-
172-
173-@Callable(i)
174-func withdraw (voteId) = {
175- let voter = toBase58String(i.caller.bytes)
176- if ((getVoter(voter, voteId) != ""))
177- then if ((getVoteStatus(voteId) == "closed"))
178- then {
179- let currentKey = getVoterAmountKey(voter, voteId)
180- let currentAmount = match getInteger(this, currentKey) {
181- case a: Int =>
182- a
183- case _ =>
184- throw("You didn't vote for this entrepreneur")
185- }
186- if ((currentAmount == 0))
187- then throw("Seems you have previously withdrawn.")
188- else ScriptResult(WriteSet([DataEntry(currentKey, 0)]), TransferSet([ScriptTransfer(i.caller, currentAmount, dyzId)]))
189- }
190- else throw("Can't withdraw vote amount while voting is still open.")
191- else throw("You didn't vote for this entrepreneur")
192- }
193135
194136
195137
196138 @Callable(i)
197139 func stake () = {
198140 let staker = toBase58String(i.caller.bytes)
199141 let pmt = extract(i.payment)
200142 if ((pmt.amount == 0))
201143 then throw("Stake amount too low")
202144 else if ((pmt.assetId != base58'9XTqBQeJvdMs8VNHv6rXiJLJichg2acG7wCfYcTajQ1G'))
203145 then throw("You can only stake with DYZRUPT token")
204146 else {
205147 let currentStake = getCurrentStake(staker)
206- let stakePercent = (10 / 100)
207- let stakeableAmount = (pmt.amount * stakePercent)
148+ let stakeableAmount = fraction(pmt.amount, 10, 100)
208149 let amountToStake = (pmt.amount - stakeableAmount)
209150 let newStakedAmount = (currentStake + amountToStake)
210151 let stakePool = getStakePool()
211152 let newStakePool = (stakePool + stakeableAmount)
212- ScriptResult(WriteSet([DataEntry(getStakerKey(staker), newStakedAmount), DataEntry(getStakePoolKey(), newStakePool)]), TransferSet([ScriptTransfer(this, pmt.amount, dyzId)]))
153+ ScriptResult(WriteSet([DataEntry(getStakerKey(staker), newStakedAmount), DataEntry(getStakePoolKey(), newStakePool)]), TransferSet(nil))
213154 }
214155 }
215156
216157
217158
218159 @Callable(i)
219160 func unstake (amount) = {
220161 let staker = toBase58String(i.caller.bytes)
221162 let currentStake = getCurrentStake(staker)
222163 if ((currentStake == 0))
223164 then throw("You don't have any stakes")
224165 else if ((amount > currentStake))
225166 then throw("You can't withdraw an amount higher than you staked")
226167 else {
227- let unstakePercent = (20 / 100)
228- let unstakeableAmount = (amount * unstakePercent)
168+ let unstakeableAmount = fraction(amount, 20, 100)
229169 let amountToUnstake = (amount - unstakeableAmount)
230170 let newUnstakedAmount = (currentStake - amount)
231171 let stakePool = getStakePool()
232172 let newStakePool = (stakePool + unstakeableAmount)
233173 ScriptResult(WriteSet([DataEntry(getStakerKey(staker), newUnstakedAmount), DataEntry(getStakePoolKey(), newStakePool)]), TransferSet([ScriptTransfer(i.caller, amountToUnstake, dyzId)]))
234174 }
235175 }
236176
237177
238178
239179 @Callable(i)
240180 func claimDailyStakeReward (reward) = {
241181 let staker = toBase58String(i.caller.bytes)
242182 let currentStake = getCurrentStake(staker)
243183 let stakePool = getStakePool()
244184 if ((currentStake == 0))
245185 then throw("You don't have any stakes")
246186 else if ((stakePool == 0))
247187 then throw("Nothing in Stake pool at this time. Try again later")
248188 else if ((reward > stakePool))
249189 then throw("No rewards at this time")
250190 else {
251191 let newStakePool = (stakePool - reward)
252192 let newStakeAmount = (currentStake - reward)
253193 ScriptResult(WriteSet([DataEntry(getStakerKey(staker), newStakeAmount), DataEntry(getStakePoolKey(), newStakePool)]), TransferSet([ScriptTransfer(i.caller, reward, dyzId)]))
254194 }
255195 }
256196
257197

github/deemru/w8io/169f3d6 
54.86 ms