tx · FfJR5UU5rN3rYQ2cor4osNVzCMSSDuVzwBamfq6D3Tz5

3N3y7DVmszkgFYMGoDtNnPjrNmLTf1rRUKJ:  -0.01990000 Waves

2020.10.20 17:56 [1229034] smart account 3N3y7DVmszkgFYMGoDtNnPjrNmLTf1rRUKJ > SELF 0.00000000 Waves

{ "type": 13, "id": "FfJR5UU5rN3rYQ2cor4osNVzCMSSDuVzwBamfq6D3Tz5", "fee": 1990000, "feeAssetId": null, "timestamp": 1603205797644, "version": 2, "chainId": 84, "sender": "3N3y7DVmszkgFYMGoDtNnPjrNmLTf1rRUKJ", "senderPublicKey": "EPmZCX2H4AC1hUmAFRUfWrhzXrNjf3wPaybY6jHZQphj", "proofs": [ "5J5eY2CF3RhQGRm8fc2Z6Q6duAkFNbSVNPaJFDQkiFB38qwfATj8jz2W4hqZJKKaH168hPKDKkvKaXxcx6GHYeLE" ], "script": "base64:AAIDAAAAAAAAABEIARIAEgASABIAEgMKAQESAAAAAAAAAAAGAAAAAWkBAAAAFFJlYWRNYXhHb3Zlcm5EZXBvc2l0AAAAAAQAAAAOR292ZXJuVG9rZW5LZXkCAAAAFUdvdmVyblRva2VuTWF4RGVwb3NpdAQAAAAVTWF4R292ZXJuVG9rZW5EZXBvc2l0BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAADkdvdmVyblRva2VuS2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAJAAACAAAAAQkAASwAAAACAgAAABBSZWFkaW5nLi4uLi46ICAgCQABpAAAAAEFAAAAFU1heEdvdmVyblRva2VuRGVwb3NpdAAAAAFpAQAAAAhwYXlZaWVsZAAAAAAEAAAAC0dvdmVyblRva2VuAQAAACC8BnLNTH75zY/85pKTg3cOi9DRRgrZqRPS5vvLPGg8zQQAAAAKY3VycmVudEtleQkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5d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AAADCAUAAAABaQAAAAZjYWxsZXIAAAAAAAAAAGQFAAAAC0dvdmVyblRva2VuBQAAAANuaWwJAAACAAAAAQkAASwAAAACAgAAAEdZb3UgaGF2ZSB0byBkZXBvc2l0IDEwMCBHb3Zlcm5Ub2tlbiB0byBjbGFpbSBSZXdhcmQgCiBZb3VyIEJhbGFuY2UgaXM6IAkAAaQAAAABBQAAABVVc2VyR292ZXJuVG9rZW5BbW91bnQAAAAAsB1jsQ==", "height": 1229034, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FBpXaxS99zRj7WA7zHjSMdozEzDVB2tWUA51BARXXctT Next: 3tvWeAcXNRXowQBcgH9BYi4QyhmqaVEJaY2LvapWidG7 Diff:
OldNewDifferences
9090 case _ =>
9191 0
9292 }
93- if ((CurrrentGovernTokenDeposit > MaxGovernTokenDeposit))
93+ if (if ((CurrrentGovernTokenDeposit > MaxGovernTokenDeposit))
94+ then true
95+ else (MaxGovernTokenDeposit == 0))
9496 then WriteSet([DataEntry(currentKey, CurrrentGovernTokenDeposit), DataEntry(GovernTokenKey, MaxGovernTokenDeposit)])
9597 else WriteSet([DataEntry(currentKey, CurrrentGovernTokenDeposit)])
9698 }
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 MaxGovernTokenDeposit = match getInteger(this, GovernTokenKey) {
1010 case a: Int =>
1111 a
1212 case _ =>
1313 0
1414 }
1515 throw(("Reading.....: " + toString(MaxGovernTokenDeposit)))
1616 }
1717
1818
1919
2020 @Callable(i)
2121 func payYield () = {
2222 let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ'
2323 let currentKey = toBase58String(i.caller.bytes)
2424 let currentAmount = match getInteger(this, currentKey) {
2525 case a: Int =>
2626 a
2727 case _ =>
2828 0
2929 }
3030 if ((currentAmount > 0))
3131 then {
3232 let GovernTokenAmount = assetBalance(this, GovernToken)
3333 if ((1 > GovernTokenAmount))
3434 then throw("No enough GovernToken In Contract")
3535 else ScriptResult(WriteSet([DataEntry(currentKey, 10)]), TransferSet([ScriptTransfer(i.caller, 1, GovernToken)]))
3636 }
3737 else throw("You need to deposit Collateral Token to receive Govern Token")
3838 }
3939
4040
4141
4242 @Callable(i)
4343 func Stake () = {
4444 let CollateralToken = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN'
4545 let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ'
4646 let pmt = extract(i.payment)
4747 if (if (isDefined(pmt.assetId))
4848 then (extract(pmt.assetId) == CollateralToken)
4949 else false)
5050 then {
5151 let currentKey = ((toBase58String(i.caller.bytes) + "_") + toBase58String(CollateralToken))
5252 let currentAmount = match getInteger(this, currentKey) {
5353 case a: Int =>
5454 a
5555 case _ =>
5656 0
5757 }
5858 let newAmount = (currentAmount + pmt.amount)
5959 let GovernTokenAmount = assetBalance(this, GovernToken)
6060 if ((1 > GovernTokenAmount))
6161 then throw("No enough GovernToken In Contract")
6262 else ScriptResult(WriteSet([DataEntry(currentKey, 10), DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, 10, GovernToken)]))
6363 }
6464 else throw("Can deposit only StakeToken")
6565 }
6666
6767
6868
6969 @Callable(i)
7070 func DepositGovernToken () = {
7171 let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ'
7272 let GovernTokenMaxDeposit = toBase58String(GovernToken)
7373 let pmt = extract(i.payment)
7474 if (if (isDefined(pmt.assetId))
7575 then (extract(pmt.assetId) == GovernToken)
7676 else false)
7777 then {
7878 let currentKey = toBase58String(i.caller.bytes)
7979 let currentAmount = match getInteger(this, currentKey) {
8080 case a: Int =>
8181 a
8282 case _ =>
8383 0
8484 }
8585 let CurrrentGovernTokenDeposit = (currentAmount + pmt.amount)
8686 let GovernTokenKey = "GovernTokenMaxDeposit"
8787 let MaxGovernTokenDeposit = match getInteger(this, GovernTokenKey) {
8888 case a: Int =>
8989 a
9090 case _ =>
9191 0
9292 }
93- if ((CurrrentGovernTokenDeposit > MaxGovernTokenDeposit))
93+ if (if ((CurrrentGovernTokenDeposit > MaxGovernTokenDeposit))
94+ then true
95+ else (MaxGovernTokenDeposit == 0))
9496 then WriteSet([DataEntry(currentKey, CurrrentGovernTokenDeposit), DataEntry(GovernTokenKey, MaxGovernTokenDeposit)])
9597 else WriteSet([DataEntry(currentKey, CurrrentGovernTokenDeposit)])
9698 }
9799 else throw("Can deposit only Govern Token")
98100 }
99101
100102
101103
102104 @Callable(i)
103105 func WithdrawStakedFunds (amount) = {
104106 let CollateralToken = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN'
105107 let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ'
106108 let currentKey = toBase58String(i.caller.bytes)
107109 let currentAmount = match getInteger(this, currentKey) {
108110 case a: Int =>
109111 a
110112 case _ =>
111113 0
112114 }
113115 let newAmount = (currentAmount - amount)
114116 if ((0 > amount))
115117 then throw("Can't withdraw negative amount")
116118 else if ((0 > newAmount))
117119 then throw("User cannot withdraw more than deposited funds")
118120 else {
119121 let GovernTokenAmount = assetBalance(this, GovernToken)
120122 if ((1 > GovernTokenAmount))
121123 then throw("No enough GovernToken In Contract")
122124 else ScriptResult(WriteSet([DataEntry(currentKey, 1), DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, 1, GovernToken), ScriptTransfer(i.caller, amount, CollateralToken)]))
123125 }
124126 }
125127
126128
127129
128130 @Callable(i)
129131 func ClaimPrize () = {
130132 let StakedToken = base58'5hHK64aujiyn7cNrTBwhe5yJQuxs119KTPbE9nFjLoUN'
131133 let GovernToken = base58'DeyMK8USWs9ijzAXNy2azA3soajfrXjUNiJBdSJJsvMJ'
132134 let FundBoxAddress58 = base58'3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD'
133135 let winnerPrize = (("3N1QzUHdfyXmKVFAn9TPHG7iuW4uK53pfXA" + "_") + toBase58String(StakedToken))
134136 let winAddress = Address(base58'3N1QzUHdfyXmKVFAn9TPHG7iuW4uK53pfXA')
135137 let FundBoxAddress = Address(base58'3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD')
136138 let FundBox = "3NCMrhPAVqXgtLdpi2BhFWpJkMBUAFrozbD"
137139 let UserGovernTokenKey = ((toBase58String(i.caller.bytes) + "_") + toBase58String(GovernToken))
138140 let UserStakedToken = ((toBase58String(i.caller.bytes) + "_") + toBase58String(StakedToken))
139141 let FundBoxStakedToken = ((toBase58String(FundBoxAddress58) + "_") + toBase58String(StakedToken))
140142 let UserGovernTokenAmount = match getInteger(this, UserGovernTokenKey) {
141143 case a: Int =>
142144 a
143145 case _ =>
144146 0
145147 }
146148 let UserStakedTokenAmount = match getInteger(this, UserStakedToken) {
147149 case a: Int =>
148150 a
149151 case _ =>
150152 0
151153 }
152154 let PrizeAmount = match getInteger(this, FundBoxStakedToken) {
153155 case a: Int =>
154156 a
155157 case _ =>
156158 0
157159 }
158160 if ((PrizeAmount == 0))
159161 then throw("No prize to Claim")
160162 else if ((UserStakedToken != winnerPrize))
161163 then throw("You are not the winner hence cannot claim the reward ")
162164 else if ((1 > UserStakedTokenAmount))
163165 then throw(("You have to Stake StakedToken to claim reward
164166 Your Balance of Staked Tokens is: " + toString(UserStakedTokenAmount)))
165167 else if ((UserGovernTokenAmount > 100))
166168 then ScriptResult(WriteSet([DataEntry(winnerPrize, PrizeAmount), DataEntry(FundBoxStakedToken, 0), DataEntry(UserGovernTokenKey, 100)]), TransferSet([ScriptTransfer(winAddress, PrizeAmount, StakedToken), ScriptTransfer(i.caller, 100, GovernToken)]))
167169 else throw(("You have to deposit 100 GovernToken to claim Reward
168170 Your Balance is: " + toString(UserGovernTokenAmount)))
169171 }
170172
171173

github/deemru/w8io/169f3d6 
37.84 ms