tx · Ca1iEJr8YzvRHkuLtYZgUMzDtp2RJH64mx86HfdtEzH7

3N3y7DVmszkgFYMGoDtNnPjrNmLTf1rRUKJ:  -0.01990000 Waves

2020.10.20 19:50 [1229145] smart account 3N3y7DVmszkgFYMGoDtNnPjrNmLTf1rRUKJ > SELF 0.00000000 Waves

{ "type": 13, "id": "Ca1iEJr8YzvRHkuLtYZgUMzDtp2RJH64mx86HfdtEzH7", "fee": 1990000, "feeAssetId": null, "timestamp": 1603212514403, "version": 2, "chainId": 84, "sender": "3N3y7DVmszkgFYMGoDtNnPjrNmLTf1rRUKJ", "senderPublicKey": "EPmZCX2H4AC1hUmAFRUfWrhzXrNjf3wPaybY6jHZQphj", "proofs": [ "3PYDPteDQAsVXvmuijs1iAkNiBoicbj96WUcUjUyDApQph3Jc4PMzx1XhmDfJLgi4pbrHJuWGRT7xGoJxtm4kUPX" ], "script": "base64:AAIDAAAAAAAAABEIARIAEgASABIAEgMKAQESAAAAAAAAAAAGAAAAAWkBAAAAFFJlYWRNYXhHb3Zlcm5EZXBvc2l0AAAAAAQAAAAOR292ZXJuVG9rZW5LZXkCAAAAFUdvdmVyblRva2VuTWF4RGVwb3NpdAQAAAAaTWF4R292ZXJuVG9rZW5EZXBvc2l0ZXJLZXkCAAAAGk1heEdvdmVyblRva2VuRGVwb3NpdGVyS2V5BAAAAAZXaW5uZXIJAQAAABFAZXh0ck5hdGl2ZSgxMDUzKQAAAAIFAAAABHRoaXMFAAAAGk1heEdvdmVyblRva2VuRGVwb3NpdGVyS2V5BAAAABVNYXhHb3Zlcm5Ub2tlbkRlcG9zaXQEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAAOR292ZXJuVG9rZW5LZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAkAAAIAAAABCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAABJXaW5uZXIgaXMuLi4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VVzZXJHb3Zlcm5Ub2tlbkFtb3VudAAAAAAAAAAAZAkBAAAADFNjcmlwdFJlc3VsdAAAAAIJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAAC1ByaXplV2lubmVyBQAAAAtQcml6ZUFtb3VudAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAASRnVuZEJveFN0YWtlZFRva2VuAAAAAAAAAAAACQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAABJVc2VyR292ZXJuVG9rZW5LZXkAAAAAAAAAAGQFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAAC1ByaXplQW1vdW50BQAAAAtTdGFrZWRUb2tlbgkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIAAAAAAAAAAGQFAAAAC0dvdmVyblRva2VuBQAAAANuaWwJAAACAAAAAQkAASwAAAACAgAAAEdZb3UgaGF2ZSB0byBkZXBvc2l0IDEwMCBHb3Zlcm5Ub2tlbiB0byBjbGFpbSBSZXdhcmQgCiBZb3VyIEJhbGFuY2UgaXM6IAkAAaQAAAABBQAAABVVc2VyR292ZXJuVG9rZW5BbW91bnQAAAAA02yMyQ==", "height": 1229145, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 7UQxc8Qq9mdSyiTfmVcRpsfRUB1TkKDT3etK5Gr8MFip Next: AnsQJFbGC5wDvtzp3MBwnh2GMezS2nGKteGEVbKXWnbY Diff:
OldNewDifferences
1414 case _ =>
1515 0
1616 }
17- throw(((("Winner is.....: " + Winner) + " ") + toString(MaxGovernTokenDeposit)))
17+ throw(((("Winner is.....: " + Winner) + "
18+ Total GovernToken: ") + toString(MaxGovernTokenDeposit)))
1819 }
1920
2021
4344
4445 @Callable(i)
4546 func Stake () = {
46- let CollateralToken = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN'
47+ let StakedToken = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN'
4748 let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ'
4849 let pmt = extract(i.payment)
4950 if (if (isDefined(pmt.assetId))
50- then (extract(pmt.assetId) == CollateralToken)
51+ then (extract(pmt.assetId) == StakedToken)
5152 else false)
5253 then {
53- let currentKey = ((toBase58String(i.caller.bytes) + "_") + toBase58String(CollateralToken))
54- let currentAmount = match getInteger(this, currentKey) {
54+ let UserStakedTokenKey = ((toBase58String(i.caller.bytes) + "_") + toBase58String(StakedToken))
55+ let UserGovernTokenKey = ((toBase58String(i.caller.bytes) + "_") + toBase58String(GovernToken))
56+ let currentAmount = match getInteger(this, UserStakedTokenKey) {
5557 case a: Int =>
5658 a
5759 case _ =>
5860 0
5961 }
6062 let newAmount = (currentAmount + pmt.amount)
61- let GovernTokenAmount = assetBalance(this, GovernToken)
62- if ((1 > GovernTokenAmount))
63+ let GovernTokenSmartContractBalance = assetBalance(this, GovernToken)
64+ if ((1 > GovernTokenSmartContractBalance))
6365 then throw("No enough GovernToken In Contract")
64- else ScriptResult(WriteSet([DataEntry(currentKey, 10), DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, 10, GovernToken)]))
66+ else ScriptResult(WriteSet([DataEntry(UserGovernTokenKey, 10), DataEntry(UserStakedTokenKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, 10, GovernToken)]))
6567 }
6668 else throw("Can deposit only StakeToken")
6769 }
135137 let StakedToken = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN'
136138 let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ'
137139 let FundBoxAddress58 = base58'3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD'
138- let winnerPrize = (("3N1QzUHdfyXmKVFAn9TPHG7iuW4uK53pfXA" + "_") + toBase58String(StakedToken))
139- let winAddress = Address(base58'3N1QzUHdfyXmKVFAn9TPHG7iuW4uK53pfXA')
140- let FundBoxAddress = Address(base58'3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD')
141- let FundBox = "3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD"
140+ let UserStakedTokenKey = ((toBase58String(i.caller.bytes) + "_") + toBase58String(StakedToken))
142141 let UserGovernTokenKey = ((toBase58String(i.caller.bytes) + "_") + toBase58String(GovernToken))
143- let UserStakedToken = ((toBase58String(i.caller.bytes) + "_") + toBase58String(StakedToken))
144142 let FundBoxStakedToken = ((toBase58String(FundBoxAddress58) + "_") + toBase58String(StakedToken))
145143 let UserGovernTokenAmount = match getInteger(this, UserGovernTokenKey) {
146144 case a: Int =>
148146 case _ =>
149147 0
150148 }
151- let UserStakedTokenAmount = match getInteger(this, UserStakedToken) {
149+ let UserStakedTokenAmount = match getInteger(this, UserStakedTokenKey) {
152150 case a: Int =>
153151 a
154152 case _ =>
160158 case _ =>
161159 0
162160 }
161+ let MaxGovernTokenDepositerKey = "MaxGovernTokenDepositerKey"
162+ let PrizeWinner = getStringValue(this, MaxGovernTokenDepositerKey)
163163 if ((PrizeAmount == 0))
164164 then throw("No prize to Claim")
165- else if ((UserStakedToken != winnerPrize))
165+ else if ((toBase58String(i.caller.bytes) != PrizeWinner))
166166 then throw("You are not the winner hence cannot claim the reward ")
167167 else if ((1 > UserStakedTokenAmount))
168168 then throw(("You have to Stake StakedToken to claim reward
169169 Your Balance of Staked Tokens is: " + toString(UserStakedTokenAmount)))
170170 else if ((UserGovernTokenAmount > 100))
171- then ScriptResult(WriteSet([DataEntry(winnerPrize, PrizeAmount), DataEntry(FundBoxStakedToken, 0), DataEntry(UserGovernTokenKey, 100)]), TransferSet([ScriptTransfer(winAddress, PrizeAmount, StakedToken), ScriptTransfer(i.caller, 100, GovernToken)]))
171+ then ScriptResult(WriteSet([DataEntry(PrizeWinner, PrizeAmount), DataEntry(FundBoxStakedToken, 0), DataEntry(UserGovernTokenKey, 100)]), TransferSet([ScriptTransfer(i.caller, PrizeAmount, StakedToken), ScriptTransfer(i.caller, 100, GovernToken)]))
172172 else throw(("You have to deposit 100 GovernToken to claim Reward
173173 Your Balance is: " + toString(UserGovernTokenAmount)))
174174 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44
55
66 @Callable(i)
77 func ReadMaxGovernDeposit () = {
88 let GovernTokenKey = "GovernTokenMaxDeposit"
99 let MaxGovernTokenDepositerKey = "MaxGovernTokenDepositerKey"
1010 let Winner = getStringValue(this, MaxGovernTokenDepositerKey)
1111 let MaxGovernTokenDeposit = match getInteger(this, GovernTokenKey) {
1212 case a: Int =>
1313 a
1414 case _ =>
1515 0
1616 }
17- throw(((("Winner is.....: " + Winner) + " ") + toString(MaxGovernTokenDeposit)))
17+ throw(((("Winner is.....: " + Winner) + "
18+ Total GovernToken: ") + toString(MaxGovernTokenDeposit)))
1819 }
1920
2021
2122
2223 @Callable(i)
2324 func payYield () = {
2425 let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ'
2526 let currentKey = toBase58String(i.caller.bytes)
2627 let currentAmount = match getInteger(this, currentKey) {
2728 case a: Int =>
2829 a
2930 case _ =>
3031 0
3132 }
3233 if ((currentAmount > 0))
3334 then {
3435 let GovernTokenAmount = assetBalance(this, GovernToken)
3536 if ((1 > GovernTokenAmount))
3637 then throw("No enough GovernToken In Contract")
3738 else ScriptResult(WriteSet([DataEntry(currentKey, 10)]), TransferSet([ScriptTransfer(i.caller, 1, GovernToken)]))
3839 }
3940 else throw("You need to deposit Collateral Token to receive Govern Token")
4041 }
4142
4243
4344
4445 @Callable(i)
4546 func Stake () = {
46- let CollateralToken = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN'
47+ let StakedToken = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN'
4748 let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ'
4849 let pmt = extract(i.payment)
4950 if (if (isDefined(pmt.assetId))
50- then (extract(pmt.assetId) == CollateralToken)
51+ then (extract(pmt.assetId) == StakedToken)
5152 else false)
5253 then {
53- let currentKey = ((toBase58String(i.caller.bytes) + "_") + toBase58String(CollateralToken))
54- let currentAmount = match getInteger(this, currentKey) {
54+ let UserStakedTokenKey = ((toBase58String(i.caller.bytes) + "_") + toBase58String(StakedToken))
55+ let UserGovernTokenKey = ((toBase58String(i.caller.bytes) + "_") + toBase58String(GovernToken))
56+ let currentAmount = match getInteger(this, UserStakedTokenKey) {
5557 case a: Int =>
5658 a
5759 case _ =>
5860 0
5961 }
6062 let newAmount = (currentAmount + pmt.amount)
61- let GovernTokenAmount = assetBalance(this, GovernToken)
62- if ((1 > GovernTokenAmount))
63+ let GovernTokenSmartContractBalance = assetBalance(this, GovernToken)
64+ if ((1 > GovernTokenSmartContractBalance))
6365 then throw("No enough GovernToken In Contract")
64- else ScriptResult(WriteSet([DataEntry(currentKey, 10), DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, 10, GovernToken)]))
66+ else ScriptResult(WriteSet([DataEntry(UserGovernTokenKey, 10), DataEntry(UserStakedTokenKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, 10, GovernToken)]))
6567 }
6668 else throw("Can deposit only StakeToken")
6769 }
6870
6971
7072
7173 @Callable(i)
7274 func DepositGovernToken () = {
7375 let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ'
7476 let GovernTokenMaxDeposit = toBase58String(GovernToken)
7577 let pmt = extract(i.payment)
7678 if (if (isDefined(pmt.assetId))
7779 then (extract(pmt.assetId) == GovernToken)
7880 else false)
7981 then {
8082 let currentKey = toBase58String(i.caller.bytes)
8183 let currentAmount = match getInteger(this, currentKey) {
8284 case a: Int =>
8385 a
8486 case _ =>
8587 0
8688 }
8789 let CurrrentGovernTokenDeposit = (currentAmount + pmt.amount)
8890 let GovernTokenKey = "GovernTokenMaxDeposit"
8991 let MaxGovernTokenDepositerKey = "MaxGovernTokenDepositerKey"
9092 let MaxGovernTokenDeposit = match getInteger(this, GovernTokenKey) {
9193 case a: Int =>
9294 a
9395 case _ =>
9496 0
9597 }
9698 if (if ((CurrrentGovernTokenDeposit > MaxGovernTokenDeposit))
9799 then true
98100 else (MaxGovernTokenDeposit == 0))
99101 then WriteSet([DataEntry(currentKey, CurrrentGovernTokenDeposit), DataEntry(GovernTokenKey, CurrrentGovernTokenDeposit), DataEntry(MaxGovernTokenDepositerKey, currentKey)])
100102 else WriteSet([DataEntry(currentKey, CurrrentGovernTokenDeposit)])
101103 }
102104 else throw("Can deposit only Govern Token")
103105 }
104106
105107
106108
107109 @Callable(i)
108110 func WithdrawStakedFunds (amount) = {
109111 let CollateralToken = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN'
110112 let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ'
111113 let currentKey = toBase58String(i.caller.bytes)
112114 let currentAmount = match getInteger(this, currentKey) {
113115 case a: Int =>
114116 a
115117 case _ =>
116118 0
117119 }
118120 let newAmount = (currentAmount - amount)
119121 if ((0 > amount))
120122 then throw("Can't withdraw negative amount")
121123 else if ((0 > newAmount))
122124 then throw("User cannot withdraw more than deposited funds")
123125 else {
124126 let GovernTokenAmount = assetBalance(this, GovernToken)
125127 if ((1 > GovernTokenAmount))
126128 then throw("No enough GovernToken In Contract")
127129 else ScriptResult(WriteSet([DataEntry(currentKey, 1), DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, 1, GovernToken), ScriptTransfer(i.caller, amount, CollateralToken)]))
128130 }
129131 }
130132
131133
132134
133135 @Callable(i)
134136 func ClaimPrize () = {
135137 let StakedToken = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN'
136138 let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ'
137139 let FundBoxAddress58 = base58'3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD'
138- let winnerPrize = (("3N1QzUHdfyXmKVFAn9TPHG7iuW4uK53pfXA" + "_") + toBase58String(StakedToken))
139- let winAddress = Address(base58'3N1QzUHdfyXmKVFAn9TPHG7iuW4uK53pfXA')
140- let FundBoxAddress = Address(base58'3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD')
141- let FundBox = "3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD"
140+ let UserStakedTokenKey = ((toBase58String(i.caller.bytes) + "_") + toBase58String(StakedToken))
142141 let UserGovernTokenKey = ((toBase58String(i.caller.bytes) + "_") + toBase58String(GovernToken))
143- let UserStakedToken = ((toBase58String(i.caller.bytes) + "_") + toBase58String(StakedToken))
144142 let FundBoxStakedToken = ((toBase58String(FundBoxAddress58) + "_") + toBase58String(StakedToken))
145143 let UserGovernTokenAmount = match getInteger(this, UserGovernTokenKey) {
146144 case a: Int =>
147145 a
148146 case _ =>
149147 0
150148 }
151- let UserStakedTokenAmount = match getInteger(this, UserStakedToken) {
149+ let UserStakedTokenAmount = match getInteger(this, UserStakedTokenKey) {
152150 case a: Int =>
153151 a
154152 case _ =>
155153 0
156154 }
157155 let PrizeAmount = match getInteger(this, FundBoxStakedToken) {
158156 case a: Int =>
159157 a
160158 case _ =>
161159 0
162160 }
161+ let MaxGovernTokenDepositerKey = "MaxGovernTokenDepositerKey"
162+ let PrizeWinner = getStringValue(this, MaxGovernTokenDepositerKey)
163163 if ((PrizeAmount == 0))
164164 then throw("No prize to Claim")
165- else if ((UserStakedToken != winnerPrize))
165+ else if ((toBase58String(i.caller.bytes) != PrizeWinner))
166166 then throw("You are not the winner hence cannot claim the reward ")
167167 else if ((1 > UserStakedTokenAmount))
168168 then throw(("You have to Stake StakedToken to claim reward
169169 Your Balance of Staked Tokens is: " + toString(UserStakedTokenAmount)))
170170 else if ((UserGovernTokenAmount > 100))
171- then ScriptResult(WriteSet([DataEntry(winnerPrize, PrizeAmount), DataEntry(FundBoxStakedToken, 0), DataEntry(UserGovernTokenKey, 100)]), TransferSet([ScriptTransfer(winAddress, PrizeAmount, StakedToken), ScriptTransfer(i.caller, 100, GovernToken)]))
171+ then ScriptResult(WriteSet([DataEntry(PrizeWinner, PrizeAmount), DataEntry(FundBoxStakedToken, 0), DataEntry(UserGovernTokenKey, 100)]), TransferSet([ScriptTransfer(i.caller, PrizeAmount, StakedToken), ScriptTransfer(i.caller, 100, GovernToken)]))
172172 else throw(("You have to deposit 100 GovernToken to claim Reward
173173 Your Balance is: " + toString(UserGovernTokenAmount)))
174174 }
175175
176176

github/deemru/w8io/169f3d6 
36.67 ms