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