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:AAIDAAAAAAAAABEIARIAEgASABIAEgMKAQESAAAAAAAAAAAGAAAAAWkBAAAAFFJlYWRNYXhHb3Zlcm5EZXBvc2l0AAAAAAQAAAAOR292ZXJuVG9rZW5LZXkCAAAAFUdvdmVyblRva2VuTWF4RGVwb3NpdAQAAAAaTWF4R292ZXJuVG9rZW5EZXBvc2l0ZXJLZXkCAAAAGk1heEdvdmVyblRva2VuRGVwb3NpdGVyS2V5BAAAAAZXaW5uZXIJAQAAABFAZXh0ck5hdGl2ZSgxMDUzKQAAAAIFAAAABHRoaXMFAAAAGk1heEdvdmVyblRva2VuRGVwb3NpdGVyS2V5BAAAABVNYXhHb3Zlcm5Ub2tlbkRlcG9zaXQEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAAOR292ZXJuVG9rZW5LZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAkAAAIAAAABCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAABJXaW5uZXI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VXNlclN0YWtlZFRva2VuQW1vdW50AwkAAGYAAAACBQAAABVVc2VyR292ZXJuVG9rZW5BbW91bnQAAAAAAAAAAGQJAQAAAAxTY3JpcHRSZXN1bHQAAAACCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAAtQcml6ZVdpbm5lcgUAAAALUHJpemVBbW91bnQJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAAEkZ1bmRCb3hTdGFrZWRUb2tlbgAAAAAAAAAAAAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAASVXNlckdvdmVyblRva2VuS2V5AAAAAAAAAAAABQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAAtQcml6ZUFtb3VudAUAAAALU3Rha2VkVG9rZW4JAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyAAAAAAAAAABkBQAAAAtHb3Zlcm5Ub2tlbgUAAAADbmlsCQAAAgAAAAEJAAEsAAAAAgIAAABHWW91IGhhdmUgdG8gZGVwb3NpdCAxMDAgR292ZXJuVG9rZW4gdG8gY2xhaW0gUmV3YXJkIAogWW91ciBCYWxhbmNlIGlzOiAJAAGkAAAAAQUAAAAVVXNlckdvdmVyblRva2VuQW1vdW50AAAAAEDWZnA=", "height": 1229160, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: AnsQJFbGC5wDvtzp3MBwnh2GMezS2nGKteGEVbKXWnbY Next: DbKwXfPW86TEi4NZcCcQWZBrNyx9TvVZdzXWodhntc5q Diff:
Old | New | Differences | |
---|---|---|---|
168 | 168 | then throw(("You have to Stake StakedToken to claim reward | |
169 | 169 | Your Balance of Staked Tokens is: " + toString(UserStakedTokenAmount))) | |
170 | 170 | else if ((UserGovernTokenAmount > 100)) | |
171 | - | then ScriptResult(WriteSet([DataEntry(PrizeWinner, PrizeAmount), DataEntry(FundBoxStakedToken, 0), DataEntry(UserGovernTokenKey, | |
171 | + | then ScriptResult(WriteSet([DataEntry(PrizeWinner, PrizeAmount), DataEntry(FundBoxStakedToken, 0), DataEntry(UserGovernTokenKey, 0)]), TransferSet([ScriptTransfer(i.caller, PrizeAmount, StakedToken), ScriptTransfer(i.caller, 100, GovernToken)])) | |
172 | 172 | else throw(("You have to deposit 100 GovernToken to claim Reward | |
173 | 173 | Your Balance is: " + toString(UserGovernTokenAmount))) | |
174 | 174 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | ||
5 | 5 | ||
6 | 6 | @Callable(i) | |
7 | 7 | func ReadMaxGovernDeposit () = { | |
8 | 8 | let GovernTokenKey = "GovernTokenMaxDeposit" | |
9 | 9 | let MaxGovernTokenDepositerKey = "MaxGovernTokenDepositerKey" | |
10 | 10 | let Winner = getStringValue(this, MaxGovernTokenDepositerKey) | |
11 | 11 | let MaxGovernTokenDeposit = match getInteger(this, GovernTokenKey) { | |
12 | 12 | case a: Int => | |
13 | 13 | a | |
14 | 14 | case _ => | |
15 | 15 | 0 | |
16 | 16 | } | |
17 | 17 | throw(((("Winner is.....: " + Winner) + " | |
18 | 18 | Total GovernToken: ") + toString(MaxGovernTokenDeposit))) | |
19 | 19 | } | |
20 | 20 | ||
21 | 21 | ||
22 | 22 | ||
23 | 23 | @Callable(i) | |
24 | 24 | func payYield () = { | |
25 | 25 | let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ' | |
26 | 26 | let currentKey = toBase58String(i.caller.bytes) | |
27 | 27 | let currentAmount = match getInteger(this, currentKey) { | |
28 | 28 | case a: Int => | |
29 | 29 | a | |
30 | 30 | case _ => | |
31 | 31 | 0 | |
32 | 32 | } | |
33 | 33 | if ((currentAmount > 0)) | |
34 | 34 | then { | |
35 | 35 | let GovernTokenAmount = assetBalance(this, GovernToken) | |
36 | 36 | if ((1 > GovernTokenAmount)) | |
37 | 37 | then throw("No enough GovernToken In Contract") | |
38 | 38 | else ScriptResult(WriteSet([DataEntry(currentKey, 10)]), TransferSet([ScriptTransfer(i.caller, 1, GovernToken)])) | |
39 | 39 | } | |
40 | 40 | else throw("You need to deposit Collateral Token to receive Govern Token") | |
41 | 41 | } | |
42 | 42 | ||
43 | 43 | ||
44 | 44 | ||
45 | 45 | @Callable(i) | |
46 | 46 | func Stake () = { | |
47 | 47 | let StakedToken = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN' | |
48 | 48 | let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ' | |
49 | 49 | let pmt = extract(i.payment) | |
50 | 50 | if (if (isDefined(pmt.assetId)) | |
51 | 51 | then (extract(pmt.assetId) == StakedToken) | |
52 | 52 | else false) | |
53 | 53 | then { | |
54 | 54 | let UserStakedTokenKey = ((toBase58String(i.caller.bytes) + "_") + toBase58String(StakedToken)) | |
55 | 55 | let UserGovernTokenKey = ((toBase58String(i.caller.bytes) + "_") + toBase58String(GovernToken)) | |
56 | 56 | let currentAmount = match getInteger(this, UserStakedTokenKey) { | |
57 | 57 | case a: Int => | |
58 | 58 | a | |
59 | 59 | case _ => | |
60 | 60 | 0 | |
61 | 61 | } | |
62 | 62 | let newAmount = (currentAmount + pmt.amount) | |
63 | 63 | let GovernTokenSmartContractBalance = assetBalance(this, GovernToken) | |
64 | 64 | if ((1 > GovernTokenSmartContractBalance)) | |
65 | 65 | then throw("No enough GovernToken In Contract") | |
66 | 66 | else ScriptResult(WriteSet([DataEntry(UserGovernTokenKey, 10), DataEntry(UserStakedTokenKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, 10, GovernToken)])) | |
67 | 67 | } | |
68 | 68 | else throw("Can deposit only StakeToken") | |
69 | 69 | } | |
70 | 70 | ||
71 | 71 | ||
72 | 72 | ||
73 | 73 | @Callable(i) | |
74 | 74 | func DepositGovernToken () = { | |
75 | 75 | let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ' | |
76 | 76 | let GovernTokenMaxDeposit = toBase58String(GovernToken) | |
77 | 77 | let pmt = extract(i.payment) | |
78 | 78 | if (if (isDefined(pmt.assetId)) | |
79 | 79 | then (extract(pmt.assetId) == GovernToken) | |
80 | 80 | else false) | |
81 | 81 | then { | |
82 | 82 | let currentKey = ((toBase58String(i.caller.bytes) + "_") + toBase58String(GovernToken)) | |
83 | 83 | let currentAmount = match getInteger(this, currentKey) { | |
84 | 84 | case a: Int => | |
85 | 85 | a | |
86 | 86 | case _ => | |
87 | 87 | 0 | |
88 | 88 | } | |
89 | 89 | let CurrrentGovernTokenDeposit = (currentAmount + pmt.amount) | |
90 | 90 | let GovernTokenKey = "GovernTokenMaxDeposit" | |
91 | 91 | let MaxGovernTokenDepositerKey = "MaxGovernTokenDepositerKey" | |
92 | 92 | let MaxGovernTokenDeposit = match getInteger(this, GovernTokenKey) { | |
93 | 93 | case a: Int => | |
94 | 94 | a | |
95 | 95 | case _ => | |
96 | 96 | 0 | |
97 | 97 | } | |
98 | 98 | if (if ((CurrrentGovernTokenDeposit > MaxGovernTokenDeposit)) | |
99 | 99 | then true | |
100 | 100 | else (MaxGovernTokenDeposit == 0)) | |
101 | 101 | then WriteSet([DataEntry(currentKey, CurrrentGovernTokenDeposit), DataEntry(GovernTokenKey, CurrrentGovernTokenDeposit), DataEntry(MaxGovernTokenDepositerKey, currentKey)]) | |
102 | 102 | else WriteSet([DataEntry(currentKey, CurrrentGovernTokenDeposit)]) | |
103 | 103 | } | |
104 | 104 | else throw("Can deposit only Govern Token") | |
105 | 105 | } | |
106 | 106 | ||
107 | 107 | ||
108 | 108 | ||
109 | 109 | @Callable(i) | |
110 | 110 | func WithdrawStakedFunds (amount) = { | |
111 | 111 | let CollateralToken = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN' | |
112 | 112 | let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ' | |
113 | 113 | let currentKey = toBase58String(i.caller.bytes) | |
114 | 114 | let currentAmount = match getInteger(this, currentKey) { | |
115 | 115 | case a: Int => | |
116 | 116 | a | |
117 | 117 | case _ => | |
118 | 118 | 0 | |
119 | 119 | } | |
120 | 120 | let newAmount = (currentAmount - amount) | |
121 | 121 | if ((0 > amount)) | |
122 | 122 | then throw("Can't withdraw negative amount") | |
123 | 123 | else if ((0 > newAmount)) | |
124 | 124 | then throw("User cannot withdraw more than deposited funds") | |
125 | 125 | else { | |
126 | 126 | let GovernTokenAmount = assetBalance(this, GovernToken) | |
127 | 127 | if ((1 > GovernTokenAmount)) | |
128 | 128 | then throw("No enough GovernToken In Contract") | |
129 | 129 | else ScriptResult(WriteSet([DataEntry(currentKey, 1), DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, 1, GovernToken), ScriptTransfer(i.caller, amount, CollateralToken)])) | |
130 | 130 | } | |
131 | 131 | } | |
132 | 132 | ||
133 | 133 | ||
134 | 134 | ||
135 | 135 | @Callable(i) | |
136 | 136 | func ClaimPrize () = { | |
137 | 137 | let StakedToken = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN' | |
138 | 138 | let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ' | |
139 | 139 | let FundBoxAddress58 = base58'3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD' | |
140 | 140 | let UserStakedTokenKey = ((toBase58String(i.caller.bytes) + "_") + toBase58String(StakedToken)) | |
141 | 141 | let UserGovernTokenKey = ((toBase58String(i.caller.bytes) + "_") + toBase58String(GovernToken)) | |
142 | 142 | let FundBoxStakedToken = ((toBase58String(FundBoxAddress58) + "_") + toBase58String(StakedToken)) | |
143 | 143 | let UserGovernTokenAmount = match getInteger(this, UserGovernTokenKey) { | |
144 | 144 | case a: Int => | |
145 | 145 | a | |
146 | 146 | case _ => | |
147 | 147 | 0 | |
148 | 148 | } | |
149 | 149 | let UserStakedTokenAmount = match getInteger(this, UserStakedTokenKey) { | |
150 | 150 | case a: Int => | |
151 | 151 | a | |
152 | 152 | case _ => | |
153 | 153 | 0 | |
154 | 154 | } | |
155 | 155 | let PrizeAmount = match getInteger(this, FundBoxStakedToken) { | |
156 | 156 | case a: Int => | |
157 | 157 | a | |
158 | 158 | case _ => | |
159 | 159 | 0 | |
160 | 160 | } | |
161 | 161 | let MaxGovernTokenDepositerKey = "MaxGovernTokenDepositerKey" | |
162 | 162 | let PrizeWinner = getStringValue(this, MaxGovernTokenDepositerKey) | |
163 | 163 | if ((PrizeAmount == 0)) | |
164 | 164 | then throw("No prize to Claim") | |
165 | 165 | else if ((toBase58String(i.caller.bytes) != PrizeWinner)) | |
166 | 166 | then throw("You are not the winner hence cannot claim the reward ") | |
167 | 167 | else if ((1 > UserStakedTokenAmount)) | |
168 | 168 | then throw(("You have to Stake StakedToken to claim reward | |
169 | 169 | Your Balance of Staked Tokens is: " + toString(UserStakedTokenAmount))) | |
170 | 170 | else if ((UserGovernTokenAmount > 100)) | |
171 | - | then ScriptResult(WriteSet([DataEntry(PrizeWinner, PrizeAmount), DataEntry(FundBoxStakedToken, 0), DataEntry(UserGovernTokenKey, | |
171 | + | then ScriptResult(WriteSet([DataEntry(PrizeWinner, PrizeAmount), DataEntry(FundBoxStakedToken, 0), DataEntry(UserGovernTokenKey, 0)]), TransferSet([ScriptTransfer(i.caller, PrizeAmount, StakedToken), ScriptTransfer(i.caller, 100, GovernToken)])) | |
172 | 172 | else throw(("You have to deposit 100 GovernToken to claim Reward | |
173 | 173 | Your Balance is: " + toString(UserGovernTokenAmount))) | |
174 | 174 | } | |
175 | 175 | ||
176 | 176 |
github/deemru/w8io/026f985 36.13 ms ◑