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