tx · 2ccnzSoF6bt7Di5ShBHK6bxh661XC27nWXZeyC1GFgdh

3MweQGUGGmQd8iV1CdEjRSvcW8asP9khepg:  -0.01000000 Waves

2022.04.27 00:28 [2025986] smart account 3MweQGUGGmQd8iV1CdEjRSvcW8asP9khepg > SELF 0.00000000 Waves

{ "type": 13, "id": "2ccnzSoF6bt7Di5ShBHK6bxh661XC27nWXZeyC1GFgdh", "fee": 1000000, "feeAssetId": null, "timestamp": 1651008506889, "version": 2, "chainId": 84, "sender": "3MweQGUGGmQd8iV1CdEjRSvcW8asP9khepg", "senderPublicKey": "5uu2gJEDT6GJGwY9ET4ZCSgVRPbH9NnWAnF9iSyc2mTH", "proofs": [ "4rtoohmDTvc6RuuE5JHY6wNURgUkEnamdUvYgNQEz6kznukoJMjUNGyZCD7wV6s37tTRMxAMgx5GbofULDrpuLCq" ], "script": "base64:AAIFAAAAAAAAABIIAhIDCgEIEgASAwoBARIAEgAAAAAIAAAAAAlvcmFjbGVLZXkCAAAACW9yYWNsZUtleQAAAAAFU2NhbGUAAAAAAAAPQkABAAAADXRyeUdldEludGVnZXIAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYgUAAAAHJG1hdGNoMAUAAAABYgAAAAAAAAAAAAEAAAAMdHJ5R2V0U3RyaW5nAAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWECAAAAAAAAAAAGb3JhY2xlCQEAAAAMdHJ5R2V0U3RyaW5nAAAAAQUAAAAJb3JhY2xlS2V5AAAAAAlvcmFjbGVGZWUJAQAAAAV2YWx1ZQAAAAEJAAQmAAAAAQUAAAAGb3JhY2xlAAAAAA1TY29uZXhBc3NldElkCQACWQAA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": 0 } View: original | compacted Prev: none Next: none Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 5 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let oracleKey = "oracleKey"
5+
6+let Scale = 1000000
7+
8+func tryGetInteger (key) = match getInteger(this, key) {
9+ case b: Int =>
10+ b
11+ case _ =>
12+ 0
13+}
14+
15+
16+func tryGetString (key) = match getString(this, key) {
17+ case a: String =>
18+ a
19+ case _ =>
20+ ""
21+}
22+
23+
24+let oracle = tryGetString(oracleKey)
25+
26+let oracleFee = value(addressFromString(oracle))
27+
28+let SconexAssetId = fromBase58String(getStringValue(oracleFee, "SconexAssetId"))
29+
30+func claimResult (address) = {
31+ let addressStr = toString(address)
32+ let currentInterest = tryGetInteger("global_lastCheck_SCONEX_interest")
33+ let lastCheckInterest = tryGetInteger((addressStr + "_lastCheck_SCONEX_interest"))
34+ let stakedAmount = tryGetInteger((addressStr + "_SCONEX_staked"))
35+ let reward = if ((lastCheckInterest > 0))
36+ then fraction((currentInterest - lastCheckInterest), stakedAmount, Scale)
37+ else 0
38+[IntegerEntry((addressStr + "_lastCheck_SCONEX_interest"), currentInterest), IntegerEntry((addressStr + "_SCONEX_claimed"), (tryGetInteger((addressStr + "_SCONEX_claimed")) + reward)), ScriptTransfer(address, reward, SconexAssetId)]
39+ }
40+
41+
42+@Callable(i)
43+func initDapp (dappKey) = if ((i.caller != this))
44+ then throw("You cannot do this action")
45+ else if ((oracle != ""))
46+ then throw("oracle already set, you can't override!")
47+ else [StringEntry(oracleKey, dappKey)]
48+
49+
50+
51+@Callable(i)
52+func stake () = {
53+ let amount = i.payments[0].amount
54+ let addressStr = toString(i.caller)
55+ let totalStakedAmount = tryGetInteger("global_staked")
56+ if ((i.payments[0].assetId != SconexAssetId))
57+ then throw("wrong asset attached")
58+ else (claimResult(i.caller) ++ [IntegerEntry("global_staked", (totalStakedAmount + amount)), IntegerEntry((addressStr + "_SCONEX_staked"), (tryGetInteger((addressStr + "_SCONEX_staked")) + amount))])
59+ }
60+
61+
62+
63+@Callable(i)
64+func unStake (amount) = {
65+ let addressStr = toString(i.caller)
66+ let stakedAmount = tryGetInteger((addressStr + "_SCONEX_staked"))
67+ if ((amount > stakedAmount))
68+ then throw("you don't have tokens available")
69+ else (claimResult(i.caller) ++ [IntegerEntry((addressStr + "_SCONEX_staked"), (stakedAmount - amount)), IntegerEntry("global_staked", (tryGetInteger("global_staked") - amount)), ScriptTransfer(i.caller, amount, SconexAssetId)])
70+ }
71+
72+
73+
74+@Callable(i)
75+func claimReward () = claimResult(i.caller)
76+
77+
78+
79+@Callable(i)
80+func topUpReward () = {
81+ let amount = fraction(i.payments[0].amount, 9, 10)
82+ let currentInterest = tryGetInteger("global_lastCheck_SCONEX_interest")
83+ let totalStakedAmount = tryGetInteger("global_staked")
84+ let interestDelta = if ((totalStakedAmount > 0))
85+ then fraction(amount, Scale, totalStakedAmount)
86+ else 0
87+ if ((i.payments[0].assetId != SconexAssetId))
88+ then throw("wrong asset attached")
89+ else [IntegerEntry("global_SCONEX_earnings", (tryGetInteger("global_SCONEX_earnings") + amount)), IntegerEntry("global_lastCheck_SCONEX_interest", (currentInterest + interestDelta))]
90+ }
91+
92+
93+@Verifier(tx)
94+func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
95+

github/deemru/w8io/169f3d6 
19.84 ms