tx · CfvePCJxRBZt8WiXiTx83E6vBFyQSoMj8yigJa2JaWY2

3MwMNZ5PmZeVN8sDprmFuYbjJVeJVxMa46f:  -0.00800000 Waves

2022.06.24 00:44 [2109602] smart account 3MwMNZ5PmZeVN8sDprmFuYbjJVeJVxMa46f > SELF 0.00000000 Waves

{ "type": 13, "id": "CfvePCJxRBZt8WiXiTx83E6vBFyQSoMj8yigJa2JaWY2", "fee": 800000, "feeAssetId": null, "timestamp": 1656020660640, "version": 2, "chainId": 84, "sender": "3MwMNZ5PmZeVN8sDprmFuYbjJVeJVxMa46f", "senderPublicKey": "CpLxySPGoDGRVBSTXHBZr9PxDduQz4JU6GK9jSAdpXse", "proofs": [ "679vj5m6eFyj3sAK2mBFz5LYX9go956LwdAsG9rrXfT1f4HyX3XfYr298kywewStRFed4BQBg92ThDpETiN9ppfM" ], "script": "base64:AAIFAAAAAAAAABQIAhIDCgEBEgQKAgEEEgMKAQQSAAAAAA0AAAAABG5hbWUCAAAACVpldGEgVEVBTQAAAAALc3Rha2VkUG93ZXIAAAAAAAAAAAoBAAAABmdldFN0cgAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFiBQAAAAckbWF0Y2gwBQAAAAFiAgAAAAABAAAABWNoZWNrAAAAAQAAAANwYmsEAAAABnBia19zdAkAAlgAAAABBQAAAANwYmsEAAAABnBvaW50cwkBAAAAEUBleHRyTmF0aXZlKDEwNTgpAAAAAQIAAAAGcG9pbnRzCQEAAAAIY29udGFpbnMAAAACBQAAAAZwb2ludHMFAAAABnBia19zdAAAAAAMc2hhcmVUb2tlbklkCQEAAAAGZ2V0U3RyAAAAAQIAAAAOU0hBUkVfQVNTRVRfSUQBAAAAD2dldFNoYXJlQXNzZXRJZAAAAAAJAAJZAAAAAQUAAAAMc2hhcmVUb2tlbklkAAAAAAhidWxsQmFuawEAAAAa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AAAAAAAAAAAJAAACAAAAAQIAAAAZUGxlYXNlIGRvbid0IGFkZCBwYXltZW50cwkBAAAAEmNsYWltU3Rha2luZ1Jlc3VsdAAAAAEIBQAAAAFpAAAABmNhbGxlcgAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5pTt5VA==", "height": 2109602, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4sq28Gh7mdP28SfANGYjTM57sqpPoYc8YV6iC7v5hU2R Next: AcK5HJWswsTpWYHMq5d46Cig46RDbqmbFnH4UBdGB4UH Diff:
OldNewDifferences
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let name = "Zeta TEAM"
5+
6+let stakedPower = 10
57
68 func getStr (key) = match getString(this, key) {
79 case b: String =>
2022
2123 let shareTokenId = getStr("SHARE_ASSET_ID")
2224
25+func getShareAssetId () = fromBase58String(shareTokenId)
26+
27+
28+let bullBank = base58'3N3k8kYqD1uZA9G5LxEPirYd2Ftpswpn9mC'
29+
30+func getEggId () = base58'EUNzgdPinhbvxEwRDxakAU7EB9QHupsUXYB8TTXdjnSS'
31+
32+
33+func tryGetInteger (key) = match getInteger(this, key) {
34+ case b: Int =>
35+ b
36+ case _ =>
37+ 0
38+}
39+
40+
41+func keyStakedAmount (address) = (toString(address) + "_farm_staked")
42+
43+
44+func keyLastCheckInterest (address) = (toString(address) + "_lastCheck_interest")
45+
46+
47+func keyEggClaimed (address) = (toString(address) + "_claimed")
48+
49+
50+func claimStakingResult (address) = {
51+ let currentInterest = height
52+ let lastCheckInterest = tryGetInteger(keyLastCheckInterest(address))
53+ let stakedAmount = tryGetInteger(keyStakedAmount(address))
54+ let reward = if ((lastCheckInterest > 0))
55+ then (((currentInterest - lastCheckInterest) * stakedAmount) * stakedPower)
56+ else 0
57+ let transfer = if ((reward > 0))
58+ then [ScriptTransfer(address, reward, getEggId())]
59+ else nil
60+ (transfer ++ [IntegerEntry(keyLastCheckInterest(address), currentInterest), IntegerEntry(keyEggClaimed(address), (tryGetInteger(keyEggClaimed(address)) + reward))])
61+ }
62+
63+
2364 @Callable(i)
2465 func issueToken (amount) = if (check(i.callerPublicKey))
2566 then if ((shareTokenId != ""))
3172 else throw("Private Farm. Access prohibited!")
3273
3374
75+
76+@Callable(i)
77+func withdrawFarmTokens (amount,compound) = if ((size(i.payments) > 0))
78+ then throw("Please don't add payments")
79+ else if (compound)
80+ then throw("No compound, please!")
81+ else {
82+ let addressStr = toString(i.caller)
83+ let stakedAmount = tryGetInteger(keyStakedAmount(i.caller))
84+ let wdAmount = if ((amount == -1))
85+ then stakedAmount
86+ else amount
87+ if ((wdAmount > stakedAmount))
88+ then throw("you don't have tokens available")
89+ else (claimStakingResult(i.caller) ++ [IntegerEntry(keyStakedAmount(i.caller), (stakedAmount - wdAmount)), ScriptTransfer(i.caller, wdAmount, getShareAssetId())])
90+ }
91+
92+
93+
94+@Callable(i)
95+func stakeFarmTokens (compound) = {
96+ let shareTokenIdBytes = getShareAssetId()
97+ if ((size(i.payments) > 1))
98+ then throw("To many payments added")
99+ else if ((i.payments[0].assetId != shareTokenIdBytes))
100+ then throw("Wrong assetId")
101+ else if (compound)
102+ then throw("No compound, please!")
103+ else {
104+ let amount = i.payments[0].amount
105+ let addressStr = toString(i.caller)
106+ if ((i.payments[0].assetId != shareTokenIdBytes))
107+ then throw("wrong asset attached")
108+ else (claimStakingResult(i.caller) ++ [IntegerEntry(keyStakedAmount(i.caller), (tryGetInteger(keyStakedAmount(i.caller)) + amount))])
109+ }
110+ }
111+
112+
113+
114+@Callable(i)
115+func claimReward () = if ((size(i.payments) > 0))
116+ then throw("Please don't add payments")
117+ else claimStakingResult(i.caller)
118+
119+
34120 @Verifier(tx)
35121 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
36122
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let name = "Zeta TEAM"
5+
6+let stakedPower = 10
57
68 func getStr (key) = match getString(this, key) {
79 case b: String =>
810 b
911 case _ =>
1012 ""
1113 }
1214
1315
1416 func check (pbk) = {
1517 let pbk_st = toBase58String(pbk)
1618 let points = getStringValue("points")
1719 contains(points, pbk_st)
1820 }
1921
2022
2123 let shareTokenId = getStr("SHARE_ASSET_ID")
2224
25+func getShareAssetId () = fromBase58String(shareTokenId)
26+
27+
28+let bullBank = base58'3N3k8kYqD1uZA9G5LxEPirYd2Ftpswpn9mC'
29+
30+func getEggId () = base58'EUNzgdPinhbvxEwRDxakAU7EB9QHupsUXYB8TTXdjnSS'
31+
32+
33+func tryGetInteger (key) = match getInteger(this, key) {
34+ case b: Int =>
35+ b
36+ case _ =>
37+ 0
38+}
39+
40+
41+func keyStakedAmount (address) = (toString(address) + "_farm_staked")
42+
43+
44+func keyLastCheckInterest (address) = (toString(address) + "_lastCheck_interest")
45+
46+
47+func keyEggClaimed (address) = (toString(address) + "_claimed")
48+
49+
50+func claimStakingResult (address) = {
51+ let currentInterest = height
52+ let lastCheckInterest = tryGetInteger(keyLastCheckInterest(address))
53+ let stakedAmount = tryGetInteger(keyStakedAmount(address))
54+ let reward = if ((lastCheckInterest > 0))
55+ then (((currentInterest - lastCheckInterest) * stakedAmount) * stakedPower)
56+ else 0
57+ let transfer = if ((reward > 0))
58+ then [ScriptTransfer(address, reward, getEggId())]
59+ else nil
60+ (transfer ++ [IntegerEntry(keyLastCheckInterest(address), currentInterest), IntegerEntry(keyEggClaimed(address), (tryGetInteger(keyEggClaimed(address)) + reward))])
61+ }
62+
63+
2364 @Callable(i)
2465 func issueToken (amount) = if (check(i.callerPublicKey))
2566 then if ((shareTokenId != ""))
2667 then [Reissue(fromBase58String(shareTokenId), amount, true)]
2768 else {
2869 let shareToken = Issue(name, (("Team token for the " + name) + " collective farm"), amount, 8, true)
2970 [shareToken, StringEntry("SHARE_ASSET_ID", toBase58String(calculateAssetId(shareToken)))]
3071 }
3172 else throw("Private Farm. Access prohibited!")
3273
3374
75+
76+@Callable(i)
77+func withdrawFarmTokens (amount,compound) = if ((size(i.payments) > 0))
78+ then throw("Please don't add payments")
79+ else if (compound)
80+ then throw("No compound, please!")
81+ else {
82+ let addressStr = toString(i.caller)
83+ let stakedAmount = tryGetInteger(keyStakedAmount(i.caller))
84+ let wdAmount = if ((amount == -1))
85+ then stakedAmount
86+ else amount
87+ if ((wdAmount > stakedAmount))
88+ then throw("you don't have tokens available")
89+ else (claimStakingResult(i.caller) ++ [IntegerEntry(keyStakedAmount(i.caller), (stakedAmount - wdAmount)), ScriptTransfer(i.caller, wdAmount, getShareAssetId())])
90+ }
91+
92+
93+
94+@Callable(i)
95+func stakeFarmTokens (compound) = {
96+ let shareTokenIdBytes = getShareAssetId()
97+ if ((size(i.payments) > 1))
98+ then throw("To many payments added")
99+ else if ((i.payments[0].assetId != shareTokenIdBytes))
100+ then throw("Wrong assetId")
101+ else if (compound)
102+ then throw("No compound, please!")
103+ else {
104+ let amount = i.payments[0].amount
105+ let addressStr = toString(i.caller)
106+ if ((i.payments[0].assetId != shareTokenIdBytes))
107+ then throw("wrong asset attached")
108+ else (claimStakingResult(i.caller) ++ [IntegerEntry(keyStakedAmount(i.caller), (tryGetInteger(keyStakedAmount(i.caller)) + amount))])
109+ }
110+ }
111+
112+
113+
114+@Callable(i)
115+func claimReward () = if ((size(i.payments) > 0))
116+ then throw("Please don't add payments")
117+ else claimStakingResult(i.caller)
118+
119+
34120 @Verifier(tx)
35121 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
36122

github/deemru/w8io/169f3d6 
38.22 ms