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