tx · 7VMnpbHgt83GgSzb2vujHRM6bBd57xcXoUcEztYkxNBZ

3MudiTkeXkCmSPyxKpTUKekkixFAtE34VS4:  -0.01880000 Waves

2020.10.20 17:34 [1229010] smart account 3MudiTkeXkCmSPyxKpTUKekkixFAtE34VS4 > SELF 0.00000000 Waves

{ "type": 13, "id": "7VMnpbHgt83GgSzb2vujHRM6bBd57xcXoUcEztYkxNBZ", "fee": 1880000, "feeAssetId": null, "timestamp": 1603204482245, "version": 2, "chainId": 84, "sender": "3MudiTkeXkCmSPyxKpTUKekkixFAtE34VS4", "senderPublicKey": "FUtTeqR8bGLSzbtwYwyqKTZQm3qNBgha29jtvAcH5ZwL", "proofs": [ "3pWvdUNn1PKk8s15a2VJ1Dq8FR934VDBVfSpYHdQ2Atc36U355aj2vxJmYAQiy8fCCuogFXcB5MLnEiWkrNYuqi8" ], "script": "base64:AAIDAAAAAAAAAA8IARIAEgASABIDCgEBEgAAAAAAAAAABQAAAAFpAQAAAAhwYXlZaWVsZAAAAAAEAAAAC0dvdmVyblRva2VuAQAAACC8BnLNTH75zY/85pKTg3cOi9DRRgrZqRPS5vvLPGg8zQQAAAAKY3VycmVudEtleQkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAA1jdXJyZW50QW1vdW50BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAACmN1cnJlbnRLZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAMJAABmAAAAAgUAAAANY3VycmVudEFtb3VudAAAAAAAAAAAAAQAAAARR292ZXJuVG9rZW5BbW91bnQJAAPrAAAAAgUAAAAEdGhpcwUAAAALR292ZXJuVG9rZW4DCQAAZgAAAAIAAAAAAAAAAAEFAAAAEUdvdmVyblRva2VuQW1vdW50CQAAAgAAAAECAAAAIU5vIGVub3VnaCBHb3Zlcm5Ub2tlbiBJbiBDb250cmF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RUb2tlbkFtb3VudAkAAAIAAAABCQABLAAAAAICAAAAUllvdSBoYXZlIHRvIFN0YWtlIFN0YWtlZFRva2VuIHRvIGNsYWltIHJld2FyZCAKIFlvdXIgQmFsYW5jZSBvZiBTdGFrZWQgVG9rZW5zIGlzOiAJAAGkAAAAAQUAAAAVVXNlclN0YWtlZFRva2VuQW1vdW50AwkAAGYAAAACBQAAABVVc2VyR292ZXJuVG9rZW5BbW91bnQAAAAAAAAAAGQJAQAAAAxTY3JpcHRSZXN1bHQAAAACCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAAt3aW5uZXJQcml6ZQUAAAALUHJpemVBbW91bnQJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAAEkZ1bmRCb3hTdGFrZWRUb2tlbgAAAAAAAAAAAAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAASVXNlckdvdmVyblRva2VuS2V5AAAAAAAAAABkBQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAAKd2luQWRkcmVzcwUAAAALUHJpemVBbW91bnQFAAAAC1N0YWtlZFRva2VuCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgAAAAAAAAAAZAUAAAALR292ZXJuVG9rZW4FAAAAA25pbAkAAAIAAAABCQABLAAAAAICAAAAR1lvdSBoYXZlIHRvIGRlcG9zaXQgMTAwIEdvdmVyblRva2VuIHRvIGNsYWltIFJld2FyZCAKIFlvdXIgQmFsYW5jZSBpczogCQABpAAAAAEFAAAAFVVzZXJHb3Zlcm5Ub2tlbkFtb3VudAAAAAB4OGKt", "height": 1229010, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CDugFANo6VEY7Cqy1SYdJDjABWzaMkQFNmMs68R1Dw7E Next: none Diff:
OldNewDifferences
6969 0
7070 }
7171 let CurrrentGovernTokenDeposit = (currentAmount + pmt.amount)
72- let GovernTokeKey = "GovernTokenMaxDeposit"
73- let MaxGovernTokenDeposit = match getInteger(this, GovernTokeKey) {
72+ let GovernTokenKey = "GovernTokenMaxDeposit"
73+ let MaxGovernTokenDeposit = match getInteger(this, GovernTokenKey) {
7474 case a: Int =>
7575 a
7676 case _ =>
7777 0
7878 }
7979 if ((CurrrentGovernTokenDeposit > MaxGovernTokenDeposit))
80- then WriteSet([DataEntry(currentKey, CurrrentGovernTokenDeposit), DataEntry(GovernTokeKey, MaxGovernTokenDeposit)])
80+ then throw((((" Your Balance of GovernToken is " + toString(CurrrentGovernTokenDeposit)) + " But Max GovernToken is: ") + toString(MaxGovernTokenDeposit)))
8181 else throw((((" Your Balance of GovernToken is " + toString(CurrrentGovernTokenDeposit)) + " But Max GovernToken is: ") + toString(MaxGovernTokenDeposit)))
8282 }
8383 else throw("Can deposit only Govern Token")
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44
55
66 @Callable(i)
77 func payYield () = {
88 let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ'
99 let currentKey = toBase58String(i.caller.bytes)
1010 let currentAmount = match getInteger(this, currentKey) {
1111 case a: Int =>
1212 a
1313 case _ =>
1414 0
1515 }
1616 if ((currentAmount > 0))
1717 then {
1818 let GovernTokenAmount = assetBalance(this, GovernToken)
1919 if ((1 > GovernTokenAmount))
2020 then throw("No enough GovernToken In Contract")
2121 else ScriptResult(WriteSet([DataEntry(currentKey, 10)]), TransferSet([ScriptTransfer(i.caller, 1, GovernToken)]))
2222 }
2323 else throw("You need to deposit Collateral Token to receive Govern Token")
2424 }
2525
2626
2727
2828 @Callable(i)
2929 func Stake () = {
3030 let CollateralToken = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN'
3131 let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ'
3232 let pmt = extract(i.payment)
3333 if (if (isDefined(pmt.assetId))
3434 then (extract(pmt.assetId) == CollateralToken)
3535 else false)
3636 then {
3737 let currentKey = ((toBase58String(i.caller.bytes) + "_") + toBase58String(CollateralToken))
3838 let currentAmount = match getInteger(this, currentKey) {
3939 case a: Int =>
4040 a
4141 case _ =>
4242 0
4343 }
4444 let newAmount = (currentAmount + pmt.amount)
4545 let GovernTokenAmount = assetBalance(this, GovernToken)
4646 if ((1 > GovernTokenAmount))
4747 then throw("No enough GovernToken In Contract")
4848 else ScriptResult(WriteSet([DataEntry(currentKey, 10), DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, 10, GovernToken)]))
4949 }
5050 else throw("Can deposit only StakeToken")
5151 }
5252
5353
5454
5555 @Callable(i)
5656 func DepositGovernToken () = {
5757 let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ'
5858 let GovernTokenMaxDeposit = toBase58String(GovernToken)
5959 let pmt = extract(i.payment)
6060 if (if (isDefined(pmt.assetId))
6161 then (extract(pmt.assetId) == GovernToken)
6262 else false)
6363 then {
6464 let currentKey = toBase58String(i.caller.bytes)
6565 let currentAmount = match getInteger(this, currentKey) {
6666 case a: Int =>
6767 a
6868 case _ =>
6969 0
7070 }
7171 let CurrrentGovernTokenDeposit = (currentAmount + pmt.amount)
72- let GovernTokeKey = "GovernTokenMaxDeposit"
73- let MaxGovernTokenDeposit = match getInteger(this, GovernTokeKey) {
72+ let GovernTokenKey = "GovernTokenMaxDeposit"
73+ let MaxGovernTokenDeposit = match getInteger(this, GovernTokenKey) {
7474 case a: Int =>
7575 a
7676 case _ =>
7777 0
7878 }
7979 if ((CurrrentGovernTokenDeposit > MaxGovernTokenDeposit))
80- then WriteSet([DataEntry(currentKey, CurrrentGovernTokenDeposit), DataEntry(GovernTokeKey, MaxGovernTokenDeposit)])
80+ then throw((((" Your Balance of GovernToken is " + toString(CurrrentGovernTokenDeposit)) + " But Max GovernToken is: ") + toString(MaxGovernTokenDeposit)))
8181 else throw((((" Your Balance of GovernToken is " + toString(CurrrentGovernTokenDeposit)) + " But Max GovernToken is: ") + toString(MaxGovernTokenDeposit)))
8282 }
8383 else throw("Can deposit only Govern Token")
8484 }
8585
8686
8787
8888 @Callable(i)
8989 func WithdrawStakedFunds (amount) = {
9090 let CollateralToken = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN'
9191 let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ'
9292 let currentKey = toBase58String(i.caller.bytes)
9393 let currentAmount = match getInteger(this, currentKey) {
9494 case a: Int =>
9595 a
9696 case _ =>
9797 0
9898 }
9999 let newAmount = (currentAmount - amount)
100100 if ((0 > amount))
101101 then throw("Can't withdraw negative amount")
102102 else if ((0 > newAmount))
103103 then throw("User cannot withdraw more than deposited funds")
104104 else {
105105 let GovernTokenAmount = assetBalance(this, GovernToken)
106106 if ((1 > GovernTokenAmount))
107107 then throw("No enough GovernToken In Contract")
108108 else ScriptResult(WriteSet([DataEntry(currentKey, 1), DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, 1, GovernToken), ScriptTransfer(i.caller, amount, CollateralToken)]))
109109 }
110110 }
111111
112112
113113
114114 @Callable(i)
115115 func ClaimPrize () = {
116116 let StakedToken = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN'
117117 let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ'
118118 let FundBoxAddress58 = base58'3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD'
119119 let winnerPrize = (("3N1QzUHdfyXmKVFAn9TPHG7iuW4uK53pfXA" + "_") + toBase58String(StakedToken))
120120 let winAddress = Address(base58'3N1QzUHdfyXmKVFAn9TPHG7iuW4uK53pfXA')
121121 let FundBoxAddress = Address(base58'3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD')
122122 let FundBox = "3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD"
123123 let UserGovernTokenKey = ((toBase58String(i.caller.bytes) + "_") + toBase58String(GovernToken))
124124 let UserStakedToken = ((toBase58String(i.caller.bytes) + "_") + toBase58String(StakedToken))
125125 let FundBoxStakedToken = ((toBase58String(FundBoxAddress58) + "_") + toBase58String(StakedToken))
126126 let UserGovernTokenAmount = match getInteger(this, UserGovernTokenKey) {
127127 case a: Int =>
128128 a
129129 case _ =>
130130 0
131131 }
132132 let UserStakedTokenAmount = match getInteger(this, UserStakedToken) {
133133 case a: Int =>
134134 a
135135 case _ =>
136136 0
137137 }
138138 let PrizeAmount = match getInteger(this, FundBoxStakedToken) {
139139 case a: Int =>
140140 a
141141 case _ =>
142142 0
143143 }
144144 if ((PrizeAmount == 0))
145145 then throw("No prize to Claim")
146146 else if ((UserStakedToken != winnerPrize))
147147 then throw("You are not the winner hence cannot claim the reward ")
148148 else if ((1 > UserStakedTokenAmount))
149149 then throw(("You have to Stake StakedToken to claim reward
150150 Your Balance of Staked Tokens is: " + toString(UserStakedTokenAmount)))
151151 else if ((UserGovernTokenAmount > 100))
152152 then ScriptResult(WriteSet([DataEntry(winnerPrize, PrizeAmount), DataEntry(FundBoxStakedToken, 0), DataEntry(UserGovernTokenKey, 100)]), TransferSet([ScriptTransfer(winAddress, PrizeAmount, StakedToken), ScriptTransfer(i.caller, 100, GovernToken)]))
153153 else throw(("You have to deposit 100 GovernToken to claim Reward
154154 Your Balance is: " + toString(UserGovernTokenAmount)))
155155 }
156156
157157

github/deemru/w8io/169f3d6 
31.10 ms