tx · CQUjTXGdGLE3Q5CoX5saT2BnohQ8pDPLjEr6dPS3C1JP 3Mt4pmCGGRuWGuNy3pyyRij45rySapd44Mw: -0.01000000 Waves 2022.05.05 19:26 [2038634] smart account 3Mt4pmCGGRuWGuNy3pyyRij45rySapd44Mw > SELF 0.00000000 Waves
{ "type": 13, "id": "CQUjTXGdGLE3Q5CoX5saT2BnohQ8pDPLjEr6dPS3C1JP", "fee": 1000000, "feeAssetId": null, "timestamp": 1651768028737, "version": 2, "chainId": 84, "sender": "3Mt4pmCGGRuWGuNy3pyyRij45rySapd44Mw", "senderPublicKey": "88pVWRX5DjU6wHFa5a8qeFQ3fuykBy1BXq7Z8pjdxhsc", "proofs": [ "5eCUwUaY8zdERX3B5g1i4HJEe6soESAucb1Ex4kGv4eAifa57Xj2abDx6wjQ2VDQnHU3533BhepffqYeNvQnYikz" ], "script": "base64:AAIDAAAAAAAAAW0IARIAEgMKAQEaBgoBYRIBaRoQCgFiEgtTdGFrZWRUb2tlbhoICgFjEgNwbXQaFwoBZBISVXNlclN0YWtlZFRva2VuS2V5GhcKAWUSElVzZXJHb3Zlcm5Ub2tlbktleRoXCgFmEhJVc2VyTGFzdFN0YWtlQmxvY2saHQoBZxIYY3VycmVudEFtb3VudFN0YWtlZFRva2VuGgwKAWgSByRtYXRjaDAaBgoBaRIBYRoZCgFqEhRuZXdBbW91bnRTdGFrZWRUb2tlbhofCgFrEhpDb250cmFjdFdhbGxldFN0YWtlQmFsYW5jZRoLCgFsEgZhbW91bnQaEAoBbRILR292ZXJuVG9rZW4aEAoBbhILQWN0dWFsRGVsYXkaHAoBbxIXVXNlckxhc3RTdGFrZUJsb2NrVmFsdWUaDwoBcBIKY3VycmVudEtleRoSCgFxEg1jdXJyZW50QW1vdW50Gg4KAXISCW5ld0Ftb3VudAAAAAAAAAACAAAAAWEBAAAABVN0YWtlAAAAAAQAAAABYgEAAAAgyfO3KK1nQRdNMgY1dCxkhGzviOKkmyfHFOqpH9CNn1QEAAAAAWM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kNhbm5vdCB1bnN0YWtlIGJlZm9yZSB0aGUgbWluaW11bSBwZXJpb2Q6IAkAAaQAAAABBQAAAAFuAAAAAAuE/M0=", "height": 2038634, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: HqT9QEtSzMynCex3KKRjUCjRbvkXzWdk7oVzNHZRhLB Next: AqxJ4u6KLXSx265bKFU6AJBpH8Ab8ZiEFZpxQeRL86UL Full:
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | ||
5 | 5 | ||
6 | 6 | @Callable(i) | |
7 | - | func StoreMydAppData (MyStrdAppData,MyIntdAppData) = [StringEntry("MyStrData", MyStrdAppData), IntegerEntry("MyIntData", MyIntdAppData)] | |
7 | + | func Stake () = { | |
8 | + | let StakedToken = base58'EbLVSrAi6vS3AkLwBinzZCvAXP2yYiFJEzj1MBVHcwZ5' | |
9 | + | let pmt = extract(i.payment) | |
10 | + | if (if ((pmt.amount > 0)) | |
11 | + | then (pmt.assetId == StakedToken) | |
12 | + | else false) | |
13 | + | then { | |
14 | + | let UserStakedTokenKey = (toBase58String(i.caller.bytes) + "_Stake") | |
15 | + | let UserGovernTokenKey = (toBase58String(i.caller.bytes) + "_Earnings") | |
16 | + | let UserLastStakeBlock = (toBase58String(i.caller.bytes) + "_UserLastStakeBlock") | |
17 | + | let currentAmountStakedToken = match getInteger(this, UserStakedTokenKey) { | |
18 | + | case a: Int => | |
19 | + | a | |
20 | + | case _ => | |
21 | + | 0 | |
22 | + | } | |
23 | + | let newAmountStakedToken = (currentAmountStakedToken + pmt.amount) | |
24 | + | let ContractWalletStakeBalance = assetBalance(this, StakedToken) | |
25 | + | WriteSet([DataEntry(UserStakedTokenKey, newAmountStakedToken), DataEntry(UserLastStakeBlock, height)]) | |
26 | + | } | |
27 | + | else throw("Can deposit only StakeToken") | |
28 | + | } | |
29 | + | ||
30 | + | ||
31 | + | ||
32 | + | @Callable(i) | |
33 | + | func WithdrawStakedFunds (amount) = { | |
34 | + | let StakedToken = base58'EbLVSrAi6vS3AkLwBinzZCvAXP2yYiFJEzj1MBVHcwZ5' | |
35 | + | let GovernToken = base58'DHZVHe6JzD61zTwH4ZnHnmo3w7oKGABXwgBt4S8KkzUP' | |
36 | + | let UserLastStakeBlock = (toBase58String(i.caller.bytes) + "_UserLastStakeBlock") | |
37 | + | let UserStakedTokenKey = (toBase58String(i.caller.bytes) + "_Staking") | |
38 | + | let ActualDelay = (1440 * 7) | |
39 | + | let UserLastStakeBlockValue = match getInteger(this, UserLastStakeBlock) { | |
40 | + | case a: Int => | |
41 | + | a | |
42 | + | case _ => | |
43 | + | 0 | |
44 | + | } | |
45 | + | let currentKey = toBase58String(i.caller.bytes) | |
46 | + | let currentAmount = match getInteger(this, UserStakedTokenKey) { | |
47 | + | case a: Int => | |
48 | + | a | |
49 | + | case _ => | |
50 | + | 0 | |
51 | + | } | |
52 | + | let newAmount = (currentAmount - amount) | |
53 | + | if ((0 > amount)) | |
54 | + | then throw("Can't withdraw negative amount") | |
55 | + | else if ((0 > newAmount)) | |
56 | + | then throw(("User cannot withdraw more than deposited funds, Your deposit is: " + toString((currentAmount / 100000000)))) | |
57 | + | else if (((UserLastStakeBlockValue + ActualDelay) > height)) | |
58 | + | then ScriptResult(WriteSet([DataEntry(UserStakedTokenKey, newAmount), DataEntry(UserLastStakeBlock, 0)]), TransferSet([ScriptTransfer(i.caller, amount, StakedToken)])) | |
59 | + | else throw(("Cannot unstake before the minimum period: " + toString(ActualDelay))) | |
60 | + | } | |
8 | 61 | ||
9 | 62 |
github/deemru/w8io/026f985 57.14 ms ◑