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