tx · D6q5mBJvdjQN97fdRpVX1mKrCfxaGTDD4ti47Nym3HWX 3N3P5euNnTjmGsZHxXceWDyFZM7CN9YPjhp: -0.01400000 Waves 2021.05.13 09:54 [1523570] smart account 3N3P5euNnTjmGsZHxXceWDyFZM7CN9YPjhp > SELF 0.00000000 Waves
{ "type": 13, "id": "D6q5mBJvdjQN97fdRpVX1mKrCfxaGTDD4ti47Nym3HWX", "fee": 1400000, "feeAssetId": null, "timestamp": 1620888863795, "version": 2, "chainId": 84, "sender": "3N3P5euNnTjmGsZHxXceWDyFZM7CN9YPjhp", "senderPublicKey": "ECgJ5aXMvEomM6yWA4tsqXdM3az7ddLr4cLr3yNJwJUb", "proofs": [ "2uh943Qp9YD4FvM9PHh988jT8krU8MQH2EoEi3bML2p8fEGHfyk24xxQBxUusRgkgExLUyRUfuJCk1wyAZhdHTf4" ], "script": "base64:AAIEAAAAAAAAACwIAhIDCgEIEgYKBAgBAQgSCAoGCAEBAQgIEhEKDwgICAgBCAEIAQgBCAEIAQAAAAEBAAAAB2N1cnJlbnQAAAABAAAAAWkEAAAAA3BtdAkAAZEAAAACCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAAMJAQAAAAlpc0RlZmluZWQAAAABCAUAAAADcG10AAAAB2Fzc2V0SWQJAAJYAAAAAQkBAAAABXZhbHVlAAAAAQgFAAAAA3BtdAAAAAdhc3NldElkAgAAAAVXQVZFUwAAAAQAAAABaQEAAAAVcmFua2luZ1Nwb25zb3JEZXBvc2l0AAAAAQAAAA5tb250aFRpbWVzdGFtcAQAAAADcG10CQABkQAAAAIIBQAAAAFpAAAACHBheW1lbnRzAAAAAAAAAAAABAAAAAljdXJyZW50SWQJAQAAAAdjdXJyZW50AAAAAQUAAAABaQQAAAAKY3VycmVudEtleQkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAA1jdXJyZW50QW1vdW50BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMJAAE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FRyYW5zZmVyAAAAAwUAAAALbmV0MWFkZHJlc3MFAAAACm5ldDFhbW91bnQFAAAADmN1cnJlbnRBc3NldElkCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAAC25ldDJhZGRyZXNzBQAAAApuZXQyYW1vdW50BQAAAA5jdXJyZW50QXNzZXRJZAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAAAtuZXQzYWRkcmVzcwUAAAAKbmV0M2Ftb3VudAUAAAAOY3VycmVudEFzc2V0SWQJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAAMYm9vYnlhZGRyZXNzBQAAAAtib29ieWFtb3VudAUAAAAOY3VycmVudEFzc2V0SWQJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAAPbmVhcnBpbjFhZGRyZXNzBQAAAA5uZWFycGluMWFtb3VudAUAAAAOY3VycmVudEFzc2V0SWQJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAAPbmVhcnBpbjJhZGRyZXNzBQAAAA5uZWFycGluMmFtb3VudAUAAAAOY3VycmVudEFzc2V0SWQFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5xAWRlA==", "height": 1523570, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CyLkH4c3jbnyVwRGhZmoFtvGkAtbY8EKYas28YQBoXhC Next: F3vaB8tUCLLPYUdKX7ScVBfXFVMLb9TJ1VGzGiQXyHZW Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let par7Id = base58'BCqo4hvDBB2dzmidJQKkVtQtkgEQVVwMy1jjV4R4tNB4' | |
5 | - | ||
6 | 4 | func current (i) = { | |
7 | 5 | let pmt = i.payments[0] | |
8 | 6 | if (isDefined(pmt.assetId)) | |
9 | 7 | then toBase58String(value(pmt.assetId)) | |
10 | 8 | else "WAVES" | |
11 | 9 | } | |
10 | + | ||
11 | + | ||
12 | + | @Callable(i) | |
13 | + | func rankingSponsorDeposit (monthTimestamp) = { | |
14 | + | let pmt = i.payments[0] | |
15 | + | let currentId = current(i) | |
16 | + | let currentKey = toBase58String(i.caller.bytes) | |
17 | + | let currentAmount = match getInteger(this, ((((("ranking_sponsor_" + currentKey) + "_") + currentId) + "_") + monthTimestamp)) { | |
18 | + | case a: Int => | |
19 | + | a | |
20 | + | case _ => | |
21 | + | 0 | |
22 | + | } | |
23 | + | let newAmount = (currentAmount + pmt.amount) | |
24 | + | let rankingCurrentAmount = match getInteger(this, ((("ranking_sponsor" + currentId) + "_") + monthTimestamp)) { | |
25 | + | case a: Int => | |
26 | + | a | |
27 | + | case _ => | |
28 | + | 0 | |
29 | + | } | |
30 | + | let rankingNewAmount = (rankingCurrentAmount + pmt.amount) | |
31 | + | [IntegerEntry(((((("ranking_sponsor_" + currentKey) + "_") + currentId) + "_") + monthTimestamp), newAmount), IntegerEntry(((("ranking_sponsor_" + currentId) + "_") + monthTimestamp), rankingNewAmount)] | |
32 | + | } | |
33 | + | ||
12 | 34 | ||
13 | 35 | ||
14 | 36 | @Callable(i) | |
85 | 107 | let net2amount = (compeCurrentAmount * (net2percent / 100)) | |
86 | 108 | let net3address = addressFromStringValue(net3) | |
87 | 109 | let net3amount = (compeCurrentAmount * (net3percent / 100)) | |
88 | - | let boobyaddress = addressFromStringValue( | |
89 | - | let boobyamount = (compeCurrentAmount * ( | |
110 | + | let boobyaddress = addressFromStringValue(booby) | |
111 | + | let boobyamount = (compeCurrentAmount * (boobypercent / 100)) | |
90 | 112 | let nearpin1address = addressFromStringValue(nearpin1) | |
91 | 113 | let nearpin1amount = (compeCurrentAmount * (nearpin1percent / 100)) | |
92 | 114 | let nearpin2address = addressFromStringValue(nearpin2) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let par7Id = base58'BCqo4hvDBB2dzmidJQKkVtQtkgEQVVwMy1jjV4R4tNB4' | |
5 | - | ||
6 | 4 | func current (i) = { | |
7 | 5 | let pmt = i.payments[0] | |
8 | 6 | if (isDefined(pmt.assetId)) | |
9 | 7 | then toBase58String(value(pmt.assetId)) | |
10 | 8 | else "WAVES" | |
11 | 9 | } | |
10 | + | ||
11 | + | ||
12 | + | @Callable(i) | |
13 | + | func rankingSponsorDeposit (monthTimestamp) = { | |
14 | + | let pmt = i.payments[0] | |
15 | + | let currentId = current(i) | |
16 | + | let currentKey = toBase58String(i.caller.bytes) | |
17 | + | let currentAmount = match getInteger(this, ((((("ranking_sponsor_" + currentKey) + "_") + currentId) + "_") + monthTimestamp)) { | |
18 | + | case a: Int => | |
19 | + | a | |
20 | + | case _ => | |
21 | + | 0 | |
22 | + | } | |
23 | + | let newAmount = (currentAmount + pmt.amount) | |
24 | + | let rankingCurrentAmount = match getInteger(this, ((("ranking_sponsor" + currentId) + "_") + monthTimestamp)) { | |
25 | + | case a: Int => | |
26 | + | a | |
27 | + | case _ => | |
28 | + | 0 | |
29 | + | } | |
30 | + | let rankingNewAmount = (rankingCurrentAmount + pmt.amount) | |
31 | + | [IntegerEntry(((((("ranking_sponsor_" + currentKey) + "_") + currentId) + "_") + monthTimestamp), newAmount), IntegerEntry(((("ranking_sponsor_" + currentId) + "_") + monthTimestamp), rankingNewAmount)] | |
32 | + | } | |
33 | + | ||
12 | 34 | ||
13 | 35 | ||
14 | 36 | @Callable(i) | |
15 | 37 | func sponsorDeposit (compeNumber,compeEndTimestamp,timestamp,compeAddress) = { | |
16 | 38 | let pmt = i.payments[0] | |
17 | 39 | let currentId = current(i) | |
18 | 40 | if ((timestamp > compeEndTimestamp)) | |
19 | 41 | then throw("Competition is finished") | |
20 | 42 | else { | |
21 | 43 | let currentKey = toBase58String(i.caller.bytes) | |
22 | 44 | let currentAmount = match getInteger(this, ((((("sponsor_" + currentKey) + "_") + currentId) + "_") + compeNumber)) { | |
23 | 45 | case a: Int => | |
24 | 46 | a | |
25 | 47 | case _ => | |
26 | 48 | 0 | |
27 | 49 | } | |
28 | 50 | let newAmount = (currentAmount + pmt.amount) | |
29 | 51 | let compeCurrentAmount = match getInteger(this, ((((compeNumber + "_") + compeAddress) + "_") + currentId)) { | |
30 | 52 | case a: Int => | |
31 | 53 | a | |
32 | 54 | case _ => | |
33 | 55 | 0 | |
34 | 56 | } | |
35 | 57 | let compeNewAmount = (compeCurrentAmount + pmt.amount) | |
36 | 58 | [IntegerEntry(((((("sponsor_" + currentKey) + "_") + currentId) + "_") + compeNumber), newAmount), IntegerEntry(((((compeNumber + "_") + compeAddress) + "_") + currentId), compeNewAmount)] | |
37 | 59 | } | |
38 | 60 | } | |
39 | 61 | ||
40 | 62 | ||
41 | 63 | ||
42 | 64 | @Callable(i) | |
43 | 65 | func sponsorWithdraw (compeNumber,compeEndTimestamp,timestamp,amount,assetId,compeAddress) = { | |
44 | 66 | let currentKey = toBase58String(i.caller.bytes) | |
45 | 67 | let currentAssetId = fromBase58String(assetId) | |
46 | 68 | let currentAmount = match getInteger(this, ((((("sponsor_" + currentKey) + "_") + assetId) + "_") + compeNumber)) { | |
47 | 69 | case a: Int => | |
48 | 70 | a | |
49 | 71 | case _ => | |
50 | 72 | 0 | |
51 | 73 | } | |
52 | 74 | let newAmount = (currentAmount - amount) | |
53 | 75 | let compeCurrentAmount = match getInteger(this, ((((compeNumber + "_") + compeAddress) + "_") + assetId)) { | |
54 | 76 | case a: Int => | |
55 | 77 | a | |
56 | 78 | case _ => | |
57 | 79 | 0 | |
58 | 80 | } | |
59 | 81 | let compeNewAmount = (compeCurrentAmount - amount) | |
60 | 82 | if ((timestamp > compeEndTimestamp)) | |
61 | 83 | then throw("Competition is finished") | |
62 | 84 | else if ((0 > amount)) | |
63 | 85 | then throw("Can't withdraw negative amount") | |
64 | 86 | else if ((0 > newAmount)) | |
65 | 87 | then throw("Not enough balance") | |
66 | 88 | else if ((0 > compeNewAmount)) | |
67 | 89 | then throw("Can't withdraw negative bounty amount") | |
68 | 90 | else [IntegerEntry(((((("sponsor_" + currentKey) + "_") + assetId) + "_") + compeNumber), newAmount), IntegerEntry(((((compeNumber + "_") + compeAddress) + "_") + assetId), compeNewAmount), ScriptTransfer(i.caller, amount, currentAssetId)] | |
69 | 91 | } | |
70 | 92 | ||
71 | 93 | ||
72 | 94 | ||
73 | 95 | @Callable(i) | |
74 | 96 | func sponsorDistribution (compeNumber,assetId,compeAddress,net1,net1percent,net2,net2percent,net3,net3percent,booby,boobypercent,nearpin1,nearpin1percent,nearpin2,nearpin2percent) = { | |
75 | 97 | let currentAssetId = fromBase58String(assetId) | |
76 | 98 | let compeCurrentAmount = match getInteger(this, ((((compeNumber + "_") + compeAddress) + "_") + assetId)) { | |
77 | 99 | case a: Int => | |
78 | 100 | a | |
79 | 101 | case _ => | |
80 | 102 | 0 | |
81 | 103 | } | |
82 | 104 | let net1address = addressFromStringValue(net1) | |
83 | 105 | let net1amount = (compeCurrentAmount * (net1percent / 100)) | |
84 | 106 | let net2address = addressFromStringValue(net2) | |
85 | 107 | let net2amount = (compeCurrentAmount * (net2percent / 100)) | |
86 | 108 | let net3address = addressFromStringValue(net3) | |
87 | 109 | let net3amount = (compeCurrentAmount * (net3percent / 100)) | |
88 | - | let boobyaddress = addressFromStringValue( | |
89 | - | let boobyamount = (compeCurrentAmount * ( | |
110 | + | let boobyaddress = addressFromStringValue(booby) | |
111 | + | let boobyamount = (compeCurrentAmount * (boobypercent / 100)) | |
90 | 112 | let nearpin1address = addressFromStringValue(nearpin1) | |
91 | 113 | let nearpin1amount = (compeCurrentAmount * (nearpin1percent / 100)) | |
92 | 114 | let nearpin2address = addressFromStringValue(nearpin2) | |
93 | 115 | let nearpin2amount = (compeCurrentAmount * (nearpin2percent / 100)) | |
94 | 116 | if ((compeCurrentAmount == 0)) | |
95 | 117 | then throw("Can't distribution negative amount") | |
96 | 118 | else [IntegerEntry(((((compeNumber + "_") + compeAddress) + "_") + assetId), 0), ScriptTransfer(net1address, net1amount, currentAssetId), ScriptTransfer(net2address, net2amount, currentAssetId), ScriptTransfer(net3address, net3amount, currentAssetId), ScriptTransfer(boobyaddress, boobyamount, currentAssetId), ScriptTransfer(nearpin1address, nearpin1amount, currentAssetId), ScriptTransfer(nearpin2address, nearpin2amount, currentAssetId)] | |
97 | 119 | } | |
98 | 120 | ||
99 | 121 | ||
100 | 122 | @Verifier(tx) | |
101 | 123 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
102 | 124 |
github/deemru/w8io/169f3d6 29.68 ms ◑