tx · Hdsb21yL2a9KVv3iJU5nDwbjhjmwbLFn1DriWJ5z3Cw6

3N3y7DVmszkgFYMGoDtNnPjrNmLTf1rRUKJ:  -0.01990000 Waves

2020.10.20 20:05 [1229160] smart account 3N3y7DVmszkgFYMGoDtNnPjrNmLTf1rRUKJ > SELF 0.00000000 Waves

{ "type": 13, "id": "Hdsb21yL2a9KVv3iJU5nDwbjhjmwbLFn1DriWJ5z3Cw6", "fee": 1990000, "feeAssetId": null, "timestamp": 1603213515215, "version": 2, "chainId": 84, "sender": "3N3y7DVmszkgFYMGoDtNnPjrNmLTf1rRUKJ", "senderPublicKey": "EPmZCX2H4AC1hUmAFRUfWrhzXrNjf3wPaybY6jHZQphj", "proofs": [ "7h4Xu3vnokvK7Jvhn2rTR1X9VJKtPXb8JjMFaTHBRxSqkpwAGeu8gxHgVnPvbhcDERmCQgTSncpF9Qsnz6pk8Jr" ], "script": "base64:AAIDAAAAAAAAABEIARIAEgASABIAEgMKAQESAAAAAAAAAAAGAAAAAWkBAAAAFFJlYWRNYXhHb3Zlcm5EZXBvc2l0AAAAAAQAAAAOR292ZXJuVG9rZW5LZXkCAAAAFUdvdmVyblRva2VuTWF4RGVwb3NpdAQAAAAaTWF4R292ZXJuVG9rZW5EZXBvc2l0ZXJLZXkCAAAAGk1heEdvdmVyblRva2VuRGVwb3NpdGVyS2V5BAAAAAZXaW5uZXIJAQAAABFAZXh0ck5hdGl2ZSgxMDUzKQAAAAIFAAAABHRoaXMFAAAAGk1heEdvdmVyblRva2VuRGVwb3NpdGVyS2V5BAAAABVNYXhHb3Zlcm5Ub2tlbkRlcG9zaXQEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAAOR292ZXJuVG9rZW5LZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAkAAAIAAAABCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAABJXaW5uZX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VVXNlclN0YWtlZFRva2VuQW1vdW50AwkAAGYAAAACBQAAABVVc2VyR292ZXJuVG9rZW5BbW91bnQAAAAAAAAAAGQJAQAAAAxTY3JpcHRSZXN1bHQAAAACCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAAtQcml6ZVdpbm5lcgUAAAALUHJpemVBbW91bnQJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAAEkZ1bmRCb3hTdGFrZWRUb2tlbgAAAAAAAAAAAAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAASVXNlckdvdmVyblRva2VuS2V5AAAAAAAAAAAABQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAAtQcml6ZUFtb3VudAUAAAALU3Rha2VkVG9rZW4JAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyAAAAAAAAAABkBQAAAAtHb3Zlcm5Ub2tlbgUAAAADbmlsCQAAAgAAAAEJAAEsAAAAAgIAAABHWW91IGhhdmUgdG8gZGVwb3NpdCAxMDAgR292ZXJuVG9rZW4gdG8gY2xhaW0gUmV3YXJkIAogWW91ciBCYWxhbmNlIGlzOiAJAAGkAAAAAQUAAAAVVXNlckdvdmVyblRva2VuQW1vdW50AAAAAEDWZnA=", "height": 1229160, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: AnsQJFbGC5wDvtzp3MBwnh2GMezS2nGKteGEVbKXWnbY Next: DbKwXfPW86TEi4NZcCcQWZBrNyx9TvVZdzXWodhntc5q Diff:
OldNewDifferences
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(PrizeWinner, PrizeAmount), DataEntry(FundBoxStakedToken, 0), DataEntry(UserGovernTokenKey, 100)]), TransferSet([ScriptTransfer(i.caller, PrizeAmount, StakedToken), ScriptTransfer(i.caller, 100, GovernToken)]))
171+ then ScriptResult(WriteSet([DataEntry(PrizeWinner, PrizeAmount), DataEntry(FundBoxStakedToken, 0), DataEntry(UserGovernTokenKey, 0)]), 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 }
1717 throw(((("Winner is.....: " + Winner) + "
1818 Total GovernToken: ") + toString(MaxGovernTokenDeposit)))
1919 }
2020
2121
2222
2323 @Callable(i)
2424 func payYield () = {
2525 let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ'
2626 let currentKey = toBase58String(i.caller.bytes)
2727 let currentAmount = match getInteger(this, currentKey) {
2828 case a: Int =>
2929 a
3030 case _ =>
3131 0
3232 }
3333 if ((currentAmount > 0))
3434 then {
3535 let GovernTokenAmount = assetBalance(this, GovernToken)
3636 if ((1 > GovernTokenAmount))
3737 then throw("No enough GovernToken In Contract")
3838 else ScriptResult(WriteSet([DataEntry(currentKey, 10)]), TransferSet([ScriptTransfer(i.caller, 1, GovernToken)]))
3939 }
4040 else throw("You need to deposit Collateral Token to receive Govern Token")
4141 }
4242
4343
4444
4545 @Callable(i)
4646 func Stake () = {
4747 let StakedToken = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN'
4848 let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ'
4949 let pmt = extract(i.payment)
5050 if (if (isDefined(pmt.assetId))
5151 then (extract(pmt.assetId) == StakedToken)
5252 else false)
5353 then {
5454 let UserStakedTokenKey = ((toBase58String(i.caller.bytes) + "_") + toBase58String(StakedToken))
5555 let UserGovernTokenKey = ((toBase58String(i.caller.bytes) + "_") + toBase58String(GovernToken))
5656 let currentAmount = match getInteger(this, UserStakedTokenKey) {
5757 case a: Int =>
5858 a
5959 case _ =>
6060 0
6161 }
6262 let newAmount = (currentAmount + pmt.amount)
6363 let GovernTokenSmartContractBalance = assetBalance(this, GovernToken)
6464 if ((1 > GovernTokenSmartContractBalance))
6565 then throw("No enough GovernToken In Contract")
6666 else ScriptResult(WriteSet([DataEntry(UserGovernTokenKey, 10), DataEntry(UserStakedTokenKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, 10, GovernToken)]))
6767 }
6868 else throw("Can deposit only StakeToken")
6969 }
7070
7171
7272
7373 @Callable(i)
7474 func DepositGovernToken () = {
7575 let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ'
7676 let GovernTokenMaxDeposit = toBase58String(GovernToken)
7777 let pmt = extract(i.payment)
7878 if (if (isDefined(pmt.assetId))
7979 then (extract(pmt.assetId) == GovernToken)
8080 else false)
8181 then {
8282 let currentKey = ((toBase58String(i.caller.bytes) + "_") + toBase58String(GovernToken))
8383 let currentAmount = match getInteger(this, currentKey) {
8484 case a: Int =>
8585 a
8686 case _ =>
8787 0
8888 }
8989 let CurrrentGovernTokenDeposit = (currentAmount + pmt.amount)
9090 let GovernTokenKey = "GovernTokenMaxDeposit"
9191 let MaxGovernTokenDepositerKey = "MaxGovernTokenDepositerKey"
9292 let MaxGovernTokenDeposit = match getInteger(this, GovernTokenKey) {
9393 case a: Int =>
9494 a
9595 case _ =>
9696 0
9797 }
9898 if (if ((CurrrentGovernTokenDeposit > MaxGovernTokenDeposit))
9999 then true
100100 else (MaxGovernTokenDeposit == 0))
101101 then WriteSet([DataEntry(currentKey, CurrrentGovernTokenDeposit), DataEntry(GovernTokenKey, CurrrentGovernTokenDeposit), DataEntry(MaxGovernTokenDepositerKey, currentKey)])
102102 else WriteSet([DataEntry(currentKey, CurrrentGovernTokenDeposit)])
103103 }
104104 else throw("Can deposit only Govern Token")
105105 }
106106
107107
108108
109109 @Callable(i)
110110 func WithdrawStakedFunds (amount) = {
111111 let CollateralToken = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN'
112112 let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ'
113113 let currentKey = toBase58String(i.caller.bytes)
114114 let currentAmount = match getInteger(this, currentKey) {
115115 case a: Int =>
116116 a
117117 case _ =>
118118 0
119119 }
120120 let newAmount = (currentAmount - amount)
121121 if ((0 > amount))
122122 then throw("Can't withdraw negative amount")
123123 else if ((0 > newAmount))
124124 then throw("User cannot withdraw more than deposited funds")
125125 else {
126126 let GovernTokenAmount = assetBalance(this, GovernToken)
127127 if ((1 > GovernTokenAmount))
128128 then throw("No enough GovernToken In Contract")
129129 else ScriptResult(WriteSet([DataEntry(currentKey, 1), DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, 1, GovernToken), ScriptTransfer(i.caller, amount, CollateralToken)]))
130130 }
131131 }
132132
133133
134134
135135 @Callable(i)
136136 func ClaimPrize () = {
137137 let StakedToken = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN'
138138 let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ'
139139 let FundBoxAddress58 = base58'3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD'
140140 let UserStakedTokenKey = ((toBase58String(i.caller.bytes) + "_") + toBase58String(StakedToken))
141141 let UserGovernTokenKey = ((toBase58String(i.caller.bytes) + "_") + toBase58String(GovernToken))
142142 let FundBoxStakedToken = ((toBase58String(FundBoxAddress58) + "_") + toBase58String(StakedToken))
143143 let UserGovernTokenAmount = match getInteger(this, UserGovernTokenKey) {
144144 case a: Int =>
145145 a
146146 case _ =>
147147 0
148148 }
149149 let UserStakedTokenAmount = match getInteger(this, UserStakedTokenKey) {
150150 case a: Int =>
151151 a
152152 case _ =>
153153 0
154154 }
155155 let PrizeAmount = match getInteger(this, FundBoxStakedToken) {
156156 case a: Int =>
157157 a
158158 case _ =>
159159 0
160160 }
161161 let MaxGovernTokenDepositerKey = "MaxGovernTokenDepositerKey"
162162 let PrizeWinner = getStringValue(this, MaxGovernTokenDepositerKey)
163163 if ((PrizeAmount == 0))
164164 then throw("No prize to Claim")
165165 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(PrizeWinner, PrizeAmount), DataEntry(FundBoxStakedToken, 0), DataEntry(UserGovernTokenKey, 100)]), TransferSet([ScriptTransfer(i.caller, PrizeAmount, StakedToken), ScriptTransfer(i.caller, 100, GovernToken)]))
171+ then ScriptResult(WriteSet([DataEntry(PrizeWinner, PrizeAmount), DataEntry(FundBoxStakedToken, 0), DataEntry(UserGovernTokenKey, 0)]), 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/026f985 
36.13 ms