tx · DP7XDoi3iVizBjTK9zXwq2TWKSKxNxhVJjrRj3YnE3NR 3N2xV35dmGG8EYfhNfdKBPBq2xoSKHkmYxf: -0.01000000 Waves 2022.05.18 15:33 [2057108] smart account 3N2xV35dmGG8EYfhNfdKBPBq2xoSKHkmYxf > SELF 0.00000000 Waves
{ "type": 13, "id": "DP7XDoi3iVizBjTK9zXwq2TWKSKxNxhVJjrRj3YnE3NR", "fee": 1000000, "feeAssetId": null, "timestamp": 1652877288300, "version": 2, "chainId": 84, "sender": "3N2xV35dmGG8EYfhNfdKBPBq2xoSKHkmYxf", "senderPublicKey": "9F6gZRAntXCZwkaxqm21ELyF2oCxcX1947Aazo7nMLYG", "proofs": [ "4Zf9E2RorGBKWBfuxHuunFS9ymp7QdoxdvbrbfF1SehnGbavGFtgGMGpbPQLMJfNVtm7WUtBnWYYhFer7pc6b18j" ], "script": "base64:AAIFAAAAAAAAABMIAhIDCgEIEgASAwoBARIDCgEBAAAABQAAAAANUEFZTUVOVF9BU1NFVAEAAAAgLTcTgdMkN12f4W9209EPk+8sLPTdia1cSlbofMkBchsAAAAADFJFV0FSRF9BU1NFVAEAAAAgrZ1IFoWReWfvw0p6hpnR3VDpBUk85P5AREeM4YPEwvQAAAAAC1JFV0FSRF9QT09MCQEAAAAHQWRkcmVzcwAAAAEBAAAAGgFU7X9voqvlbe3yLTFcZGa96NUkfO3kvsCHAAAAAAhDT05UUkFDVAkBAAAAB0FkZHJlc3MAAAABAQAAABoBVNTCmVqQvvGYzTJ/MbdqgO4Y1YJeAdXS1AEAAAALaXNQYXltZW50T2sAAAABAAAAAWkEAAAAEWFjY2VwdGFibGVBc3NldElkBQAAAA1QQVlNRU5UX0FTU0VUAwkAAAAAAAACCQABkAAAAAEIBQAAAAFpAAAACHBheW1lbnRzAAAAAAAAAAAACQAAAgAAAAECAAAAFFBheW1lbnQgbm90IGF0dGFjaGVkBAAAAAFwCQABkQAAAAIIBQAAAAFpAAAACHBheW1lbnRzAAAAAAAAAAAAB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dW50IG9yIGFzc2V0AAAAAWkBAAAADndpdGhkcmF3UGl4ZWxzAAAAAQAAAA9yZXF1ZXN0ZWRBbW91bnQEAAAABmFtb3VudAkBAAAAC3ZhbHVlT3JFbHNlAAAAAgUAAAAPcmVxdWVzdGVkQW1vdW50AAAAAAAAAAAAAwkAAGYAAAACBQAAAAZhbW91bnQAAAAAAAAAAAAJAAACAAAAAQIAAAABYQkAAAIAAAABAgAAABNub3RoaW5nIHRvIHdpdGhkcmF3AAAAAWkBAAAABWNsYWltAAAAAQAAAAtjbGFpbUFtb3VudAQAAAAKY3VycmVudEtleQkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAAZ3YWxsZXQJAAEsAAAAAgUAAAAKY3VycmVudEtleQIAAAAGX3NoYXJlBAAAAAxjbGFpbV9hbW91bnQJAQAAAAt2YWx1ZU9yRWxzZQAAAAIFAAAAC2NsYWltQW1vdW50AAAAAAAAAAAABAAAAAhnZXRTaGFyZQkBAAAAE3ZhbHVlT3JFcnJvck1lc3NhZ2UAAAACCQAEGgAAAAIFAAAABHRoaXMFAAAABndhbGxldAIAAAAQbm90aGluZyB0byBjbGFpbQQAAAAMUE9PTF9CQUxBTkNFCQEAAAATdmFsdWVPckVycm9yTWVzc2FnZQAAAAIJAAPwAAAAAgUAAAALUkVXQVJEX1BPT0wFAAAADFJFV0FSRF9BU1NFVAIAAAAVcmV3YXJkIHBvb2wgaXMgZW1wdHkhAwMJAABnAAAAAgUAAAAMUE9PTF9CQUxBTkNFBQAAAAxjbGFpbV9hbW91bnQJAABnAAAAAgUAAAAIZ2V0U2hhcmUFAAAADGNsYWltX2Ftb3VudAcJAAACAAAAAQIAAAADc2llCQAAAgAAAAEJAAGkAAAAAQUAAAAMUE9PTF9CQUxBTkNFAAAAAHizpE0=", "height": 2057108, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9iYuQW1xYtFsjRunKaDntvaDy8MjF9nNL1dSbPesxa27 Next: none Diff:
Old | New | Differences | |
---|---|---|---|
42 | 42 | let currentKey = toBase58String(i.caller.bytes) | |
43 | 43 | if (isPaymentOk(i)) | |
44 | 44 | then { | |
45 | - | let wallet = (currentKey + "_ | |
45 | + | let wallet = (currentKey + "_total") | |
46 | 46 | let getShare = valueOrElse(getInteger(this, wallet), 0) | |
47 | 47 | let total = (getShare + i.payments[0].amount) | |
48 | 48 | [IntegerEntry(wallet, total)] |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let PAYMENT_ASSET = base58'43W4FcqA1rEpSmUGHoGiXvpSLfhadws9LS5j3SJsKxxS' | |
5 | 5 | ||
6 | 6 | let REWARD_ASSET = base58'CgidgEMbCKXXErgJXVyZCFRaK8SBNA73Jg8mNXALtVKh' | |
7 | 7 | ||
8 | 8 | let REWARD_POOL = Address(base58'3NBZraoFBG4i6YVuAtcAwTEDwsfEcLh9bSv') | |
9 | 9 | ||
10 | 10 | let CONTRACT = Address(base58'3N9K49ZpyQLL9gJjVdxQhu37f8YZdAzakR1') | |
11 | 11 | ||
12 | 12 | func isPaymentOk (i) = { | |
13 | 13 | let acceptableAssetId = PAYMENT_ASSET | |
14 | 14 | if ((size(i.payments) == 0)) | |
15 | 15 | then throw("Payment not attached") | |
16 | 16 | else { | |
17 | 17 | let p = i.payments[0] | |
18 | 18 | match p.assetId { | |
19 | 19 | case assetId: ByteVector => | |
20 | 20 | if ((assetId == acceptableAssetId)) | |
21 | 21 | then (p.amount == 100000) | |
22 | 22 | else false | |
23 | 23 | case _ => | |
24 | 24 | throw("Wrong payment asset or min amount 0.0001") | |
25 | 25 | } | |
26 | 26 | } | |
27 | 27 | } | |
28 | 28 | ||
29 | 29 | ||
30 | 30 | @Callable(i) | |
31 | 31 | func rewardPool (data) = { | |
32 | 32 | let currentKey = i.caller | |
33 | 33 | if ((currentKey == CONTRACT)) | |
34 | 34 | then $Tuple2([StringEntry("reward_pool", data)], height) | |
35 | 35 | else throw("you are not allowed") | |
36 | 36 | } | |
37 | 37 | ||
38 | 38 | ||
39 | 39 | ||
40 | 40 | @Callable(i) | |
41 | 41 | func stakePixels () = { | |
42 | 42 | let currentKey = toBase58String(i.caller.bytes) | |
43 | 43 | if (isPaymentOk(i)) | |
44 | 44 | then { | |
45 | - | let wallet = (currentKey + "_ | |
45 | + | let wallet = (currentKey + "_total") | |
46 | 46 | let getShare = valueOrElse(getInteger(this, wallet), 0) | |
47 | 47 | let total = (getShare + i.payments[0].amount) | |
48 | 48 | [IntegerEntry(wallet, total)] | |
49 | 49 | } | |
50 | 50 | else throw("Wrong payment amount or asset") | |
51 | 51 | } | |
52 | 52 | ||
53 | 53 | ||
54 | 54 | ||
55 | 55 | @Callable(i) | |
56 | 56 | func withdrawPixels (requestedAmount) = { | |
57 | 57 | let amount = valueOrElse(requestedAmount, 0) | |
58 | 58 | if ((amount > 0)) | |
59 | 59 | then throw("a") | |
60 | 60 | else throw("nothing to withdraw") | |
61 | 61 | } | |
62 | 62 | ||
63 | 63 | ||
64 | 64 | ||
65 | 65 | @Callable(i) | |
66 | 66 | func claim (claimAmount) = { | |
67 | 67 | let currentKey = toBase58String(i.caller.bytes) | |
68 | 68 | let wallet = (currentKey + "_share") | |
69 | 69 | let claim_amount = valueOrElse(claimAmount, 0) | |
70 | 70 | let getShare = valueOrErrorMessage(getInteger(this, wallet), "nothing to claim") | |
71 | 71 | let POOL_BALANCE = valueOrErrorMessage(assetBalance(REWARD_POOL, REWARD_ASSET), "reward pool is empty!") | |
72 | 72 | if (if ((POOL_BALANCE >= claim_amount)) | |
73 | 73 | then (getShare >= claim_amount) | |
74 | 74 | else false) | |
75 | 75 | then throw("sie") | |
76 | 76 | else throw(toString(POOL_BALANCE)) | |
77 | 77 | } | |
78 | 78 | ||
79 | 79 |
github/deemru/w8io/026f985 25.53 ms ◑