tx · 5WSAe6remAcfzuRoWjzLDsA2uv7hAVGAArGAWxpiP5uF 3N3Aq1GcHD8bZMGyVgyvaTHrBM7EySFtJ1H: -0.00600000 Waves 2022.06.19 00:40 [2102369] smart account 3N3Aq1GcHD8bZMGyVgyvaTHrBM7EySFtJ1H > SELF 0.00000000 Waves
{ "type": 13, "id": "5WSAe6remAcfzuRoWjzLDsA2uv7hAVGAArGAWxpiP5uF", "fee": 600000, "feeAssetId": null, "timestamp": 1655588487628, "version": 2, "chainId": 84, "sender": "3N3Aq1GcHD8bZMGyVgyvaTHrBM7EySFtJ1H", "senderPublicKey": "69Rez9g3wdeHPiCsmjaaaK1GBhFjL79pxMPX9Fpk8S5e", "proofs": [ "4wcyqZS8yjXkMGBspNjhZYZc1hQfgxbES7r3mxmrHvz92aGe5CjQNhojSNaZdagJd6xf5NFUoBW9Psaem1V2yb7S" ], "script": "base64:AAIFAAAAAAAAABAIAhIFCgMIAQESAwoBCBIAAAAAEwAAAAADU0VQAgAAAAJfXwAAAAAFTVVMVDYAAAAAAAAPQkAAAAAABU1VTFQ4AAAAAAAF9eEAAAAAAApBTk9URUlEU1RSAgAAAAVXQVZFUwAAAAAHQU5PVEVJRAkAAlkAAAABBQAAAApBTk9URUlEU1RSAQAAAAxnZXRJbnRPckZhaWwAAAABAAAAA2tleQkBAAAAE3ZhbHVlT3JFcnJvck1lc3NhZ2UAAAACCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQkAASwAAAACCQABLAAAAAICAAAAD01hbmRhdG9yeSB0aGlzLgUAAAADa2V5AgAAAA8gaXMgbm90IGRlZmluZWQBAAAADGdldFN0ck9yRWxzZQAAAAIAAAADa2V5AAAACmRlZmF1bHRWYWwJAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5BQAAAApkZWZhdWx0VmFsAQAAAA9nZXRTdHJpbmdPckZhaWwAAAABAAAAA2tleQkBAAAAE3ZhbHVlT3JFcnJvck1lc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YWN0aW9uSWQFAAAACG1pbmVkQW10BQAAAA1iZW5pZmljYXJ5QW10BQAAAAtwcm90b2NvbEFtdAkABEwAAAACCQEAAAARUmV3YXJkVG90YWxzRW50cnkAAAAEBQAAAAxtaW5lckFkZHJlc3MFAAAACG1pbmVkQW10BQAAAA1iZW5pZmljYXJ5QW10BQAAAAtwcm90b2NvbEFtdAUAAAADbmlsAAAAAWkBAAAABHRlc3QAAAAAAwkBAAAAAiE9AAAAAggFAAAAAWkAAAAGY2FsbGVyBQAAAAR0aGlzCQAAAgAAAAECAAAAEnBlcm1pc3Npb25zIGRlbmllZAkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACAgAAAAR0ZXN0CQACWAAAAAEFAAAAB0FOT1RFSUQFAAAAA25pbAAAAACisz5b", "height": 2102369, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Ca66V8aVK3o9qTWKb4BsjRmGNCGXXZnE1f525qrGkseY Next: F2VufkHQWqGBKNYGF7n2R6JYNdzHefrDv6S8mN1L6RRh Diff:
Old | New | Differences | |
---|---|---|---|
117 | 117 | @Callable(i) | |
118 | 118 | func test () = if ((i.caller != this)) | |
119 | 119 | then throw("permissions denied") | |
120 | - | else [StringEntry("test", toBase58String( | |
120 | + | else [StringEntry("test", toBase58String(ANOTEID))] | |
121 | 121 | ||
122 | 122 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SEP = "__" | |
5 | 5 | ||
6 | 6 | let MULT6 = 1000000 | |
7 | 7 | ||
8 | 8 | let MULT8 = 100000000 | |
9 | 9 | ||
10 | 10 | let ANOTEIDSTR = "WAVES" | |
11 | 11 | ||
12 | 12 | let ANOTEID = fromBase58String(ANOTEIDSTR) | |
13 | 13 | ||
14 | 14 | func getIntOrFail (key) = valueOrErrorMessage(getInteger(this, key), (("Mandatory this." + key) + " is not defined")) | |
15 | 15 | ||
16 | 16 | ||
17 | 17 | func getStrOrElse (key,defaultVal) = valueOrElse(getString(this, key), defaultVal) | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), (("Mandatory this." + key) + " is not defined")) | |
21 | 21 | ||
22 | 22 | ||
23 | 23 | func getAddressOrFail (key) = valueOrErrorMessage(addressFromString(getStringOrFail(key)), (("Fail to convert this." + key) + " value into Address")) | |
24 | 24 | ||
25 | 25 | ||
26 | 26 | func validateAddressOrFail (addressStr) = { | |
27 | 27 | let address = valueOrErrorMessage(addressFromString(addressStr), ("fail to convert into address " + addressStr)) | |
28 | 28 | if ((0 > wavesBalance(address).available)) | |
29 | 29 | then throw() | |
30 | 30 | else addressStr | |
31 | 31 | } | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func keyNodeRewardsTotals (address) = ("%s%s__totals__" + address) | |
35 | 35 | ||
36 | 36 | ||
37 | 37 | func keyAnoteAddressStr () = "%s%s__cfg__anoteAddress" | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func keyProtocolPartX6 () = "%s%s__cfg__protocolPartX6" | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | func keyBenificaryPartX6 () = "%s%s__cfg__benificaryPartX6" | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func keyRewardHistory (nodeAddress,txId) = makeString(["%s%s%s", "history", toString(nodeAddress), toBase58String(txId)], SEP) | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | func dataRewardHistory (anoteAmountTotal,beneficiaryAmt,protocolAmt) = makeString(["%d%d%d%d%d%d%d", toString(lastBlock.height), toString(lastBlock.timestamp), toString(anoteAmountTotal), toString(beneficiaryAmt), toString(protocolAmt)], SEP) | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func RewardHistoryEntry (nodeAddress,txId,minedAmt,beneficiaryAmt,protocolAmt) = StringEntry(keyRewardHistory(nodeAddress, txId), dataRewardHistory(minedAmt, beneficiaryAmt, protocolAmt)) | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | func dataRewardTotals (minedAmt,beneficiaryAmt,protocolAmt) = makeString(["%d%d%d%d%d", toString(minedAmt), toString(beneficiaryAmt), toString(protocolAmt)], SEP) | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | func RewardTotalsEntry (miner,minedAmt,beneficiaryAmt,protocolAmt) = { | |
59 | 59 | let nodeRewardsTotalsKEY = keyNodeRewardsTotals(toString(miner)) | |
60 | 60 | let nodeRewardsArray = split(getStrOrElse(nodeRewardsTotalsKEY, dataRewardTotals(0, 0, 0)), SEP) | |
61 | 61 | let newMinedAmt = (parseIntValue(nodeRewardsArray[1]) + minedAmt) | |
62 | 62 | let newBeneficiaryAmt = (parseIntValue(nodeRewardsArray[2]) + beneficiaryAmt) | |
63 | 63 | let newProtocolAmt = (parseIntValue(nodeRewardsArray[3]) + protocolAmt) | |
64 | 64 | StringEntry(nodeRewardsTotalsKEY, dataRewardTotals(newMinedAmt, newBeneficiaryAmt, newProtocolAmt)) | |
65 | 65 | } | |
66 | 66 | ||
67 | 67 | ||
68 | 68 | @Callable(i) | |
69 | 69 | func constructor (anoteAddressStr,protocolPartX6,benificaryPartX6) = if ((i.caller != this)) | |
70 | 70 | then throw("permissions denied") | |
71 | 71 | else if ((0 > protocolPartX6)) | |
72 | 72 | then throw("protocolPartX6 less then zero") | |
73 | 73 | else if ((0 > benificaryPartX6)) | |
74 | 74 | then throw("benificaryPartX6 less then zero") | |
75 | 75 | else if (((protocolPartX6 + benificaryPartX6) != MULT6)) | |
76 | 76 | then throw("parts sum must be 1") | |
77 | 77 | else [StringEntry(keyAnoteAddressStr(), validateAddressOrFail(anoteAddressStr)), IntegerEntry(keyProtocolPartX6(), protocolPartX6), IntegerEntry(keyBenificaryPartX6(), benificaryPartX6)] | |
78 | 78 | ||
79 | 79 | ||
80 | 80 | ||
81 | 81 | @Callable(i) | |
82 | 82 | func distributeMinerReward (benificaryAddressStr) = if ((size(i.payments) != 1)) | |
83 | 83 | then throw("exact 1 payment must be attached") | |
84 | 84 | else if ((i.caller != i.originCaller)) | |
85 | 85 | then throw("dapp to dapp calls are not allowed") | |
86 | 86 | else { | |
87 | 87 | let pmt = i.payments[0] | |
88 | 88 | let minedAmt = pmt.amount | |
89 | 89 | let pmtAssetId = valueOrElse(pmt.assetId, ANOTEID) | |
90 | 90 | let feeAmt = i.fee | |
91 | 91 | let feeAssetId = valueOrElse(i.feeAssetId, ANOTEID) | |
92 | 92 | if ((pmtAssetId != ANOTEID)) | |
93 | 93 | then throw("only Waves can be used in payment") | |
94 | 94 | else if ((feeAssetId != ANOTEID)) | |
95 | 95 | then throw("only Waves can be used in fees") | |
96 | 96 | else if ((feeAmt != ((5 * MULT8) / 1000))) | |
97 | 97 | then throw("fee amount couldn't exceed 0.005") | |
98 | 98 | else { | |
99 | 99 | let anoteAddress = getAddressOrFail(keyAnoteAddressStr()) | |
100 | 100 | let minerAddress = i.caller | |
101 | 101 | let benificaryAddress = addressFromStringValue(benificaryAddressStr) | |
102 | 102 | let protocolPart = getIntOrFail(keyProtocolPartX6()) | |
103 | 103 | let benificaryPart = getIntOrFail(keyBenificaryPartX6()) | |
104 | 104 | let availableBalance = (wavesBalance(minerAddress).available - feeAmt) | |
105 | 105 | if ((availableBalance != 0)) | |
106 | 106 | then throw((("all " + toString(availableBalance)) + " Wavelets from the Node balance must be attached into the payment")) | |
107 | 107 | else { | |
108 | 108 | let benificaryAmt = fraction(minedAmt, benificaryPart, MULT6, DOWN) | |
109 | 109 | let protocolAmt = (minedAmt - benificaryAmt) | |
110 | 110 | [ScriptTransfer(benificaryAddress, benificaryAmt, unit), ScriptTransfer(anoteAddress, protocolAmt, unit), RewardHistoryEntry(minerAddress, i.transactionId, minedAmt, benificaryAmt, protocolAmt), RewardTotalsEntry(minerAddress, minedAmt, benificaryAmt, protocolAmt)] | |
111 | 111 | } | |
112 | 112 | } | |
113 | 113 | } | |
114 | 114 | ||
115 | 115 | ||
116 | 116 | ||
117 | 117 | @Callable(i) | |
118 | 118 | func test () = if ((i.caller != this)) | |
119 | 119 | then throw("permissions denied") | |
120 | - | else [StringEntry("test", toBase58String( | |
120 | + | else [StringEntry("test", toBase58String(ANOTEID))] | |
121 | 121 | ||
122 | 122 |
github/deemru/w8io/026f985 26.92 ms ◑