tx · Dnn5CU6jLKdfN55Pzt96MkTsqFGK9HVCNKpU9dhPPsRE 3N3P5euNnTjmGsZHxXceWDyFZM7CN9YPjhp: -0.01400000 Waves 2021.04.18 02:24 [1487121] smart account 3N3P5euNnTjmGsZHxXceWDyFZM7CN9YPjhp > SELF 0.00000000 Waves
{ "type": 13, "id": "Dnn5CU6jLKdfN55Pzt96MkTsqFGK9HVCNKpU9dhPPsRE", "fee": 1400000, "feeAssetId": null, "timestamp": 1618701871839, "version": 2, "chainId": 84, "sender": "3N3P5euNnTjmGsZHxXceWDyFZM7CN9YPjhp", "senderPublicKey": "ECgJ5aXMvEomM6yWA4tsqXdM3az7ddLr4cLr3yNJwJUb", "proofs": [ "5cKtYtnJ1uFpVd6B3wprc3UCouXaj8Urn9JsqfF39po51vtSQpMvEGB7E55w2AP9A3n7su4WdrNJwQr3wGnS4YdU" ], "script": "base64:AAIEAAAAAAAAABMIAhIGCgQIAQEIEgcKBQgBAQEIAAAAAgAAAAAGcGFyN0lkAQAAACCXnW4Q/g8CyoQAfx9ug2MeGb+saXzue5DNzkjl0gdBIwEAAAAHY3VycmVudAAAAAEAAAABaQQAAAADcG10CQABkQAAAAIIBQAAAAFpAAAACHBheW1lbnRzAAAAAAAAAAAAAwkBAAAACWlzRGVmaW5lZAAAAAEIBQAAAANwbXQAAAAHYXNzZXRJZAkAAlgAAAABCQEAAAAFdmFsdWUAAAABCAUAAAADcG10AAAAB2Fzc2V0SWQCAAAABVdBVkVTAAAAAgAAAAFpAQAAAA5zcG9uc29yRGVwb3NpdAAAAAQAAAALY29tcGVOdW1iZXIAAAARY29tcGVFbmRUaW1lc3RhbXAAAAAJdGltZXN0YW1wAAAACWFzc2V0TmFtZQQAAAADcG10CQABkQAAAAIIBQAAAAFpAAAACHBheW1lbnRzAAAAAAAAAAAABAAAAAljdXJyZW50SWQJAQAAAAdjdXJyZW50AAAAAQUAAAABaQMJAABmAAAAAgUAAAAJdGltZXN0YW1wBQAAABFjb21wZUVuZFRpb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QUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAQAAAAJbmV3QW1vdW50CQAAZQAAAAIFAAAADWN1cnJlbnRBbW91bnQFAAAABmFtb3VudAMJAABmAAAAAgUAAAAJdGltZXN0YW1wBQAAABNjb21wZVN0YXJ0VGltZXN0YW1wCQAAAgAAAAECAAAAH0NvbXBldGl0aW9uIGhhcyBhbHJlYWR5IHN0YXJ0ZWQDCQAAZgAAAAIAAAAAAAAAAAAFAAAABmFtb3VudAkAAAIAAAABAgAAAB5DYW4ndCB3aXRoZHJhdyBuZWdhdGl2ZSBhbW91bnQDCQAAZgAAAAIAAAAAAAAAAAAFAAAACW5ld0Ftb3VudAkAAAIAAAABAgAAABJOb3QgZW5vdWdoIGJhbGFuY2UJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAAAhzcG9uc29yXwUAAAAKY3VycmVudEtleQIAAAABXwUAAAAHYXNzZXRJZAIAAAABXwUAAAALY29tcGVOdW1iZXIFAAAACW5ld0Ftb3VudAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkAASwAAAACCQABLAAAAAIFAAAAC2NvbXBlTnVtYmVyAgAAAAFfBQAAAAdhc3NldElkBQAAAAluZXdBbW91bnQFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5X7hHVg==", "height": 1487121, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4svxSQUQ9GaFPnQXgqdgYnJSK2eWvjBqv8AskFqTXQqu Next: CL7LGWjXy6v7xepRUUVf6ZTmNVGYshK2soMKcacGFQcH Diff:
Old | New | Differences | |
---|---|---|---|
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let par7Id = base58'BCqo4hvDBB2dzmidJQKkVtQtkgEQVVwMy1jjV4R4tNB4' | |
5 | 5 | ||
6 | + | func current (i) = { | |
7 | + | let pmt = i.payments[0] | |
8 | + | if (isDefined(pmt.assetId)) | |
9 | + | then toBase58String(value(pmt.assetId)) | |
10 | + | else "WAVES" | |
11 | + | } | |
12 | + | ||
13 | + | ||
6 | 14 | @Callable(i) | |
7 | - | func sponsorDeposit (compeNumber,compeEndTimestamp,timestamp) = { | |
15 | + | func sponsorDeposit (compeNumber,compeEndTimestamp,timestamp,assetName) = { | |
8 | 16 | let pmt = i.payments[0] | |
17 | + | let currentId = current(i) | |
9 | 18 | if ((timestamp > compeEndTimestamp)) | |
10 | 19 | then throw("Competition is finished") | |
11 | 20 | else { | |
12 | - | let currentId = toBase58String(value(pmt.assetId)) | |
13 | 21 | let currentKey = toBase58String(i.caller.bytes) | |
14 | 22 | let currentAmount = match getInteger(this, currentKey) { | |
15 | 23 | case a: Int => |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let par7Id = base58'BCqo4hvDBB2dzmidJQKkVtQtkgEQVVwMy1jjV4R4tNB4' | |
5 | 5 | ||
6 | + | func current (i) = { | |
7 | + | let pmt = i.payments[0] | |
8 | + | if (isDefined(pmt.assetId)) | |
9 | + | then toBase58String(value(pmt.assetId)) | |
10 | + | else "WAVES" | |
11 | + | } | |
12 | + | ||
13 | + | ||
6 | 14 | @Callable(i) | |
7 | - | func sponsorDeposit (compeNumber,compeEndTimestamp,timestamp) = { | |
15 | + | func sponsorDeposit (compeNumber,compeEndTimestamp,timestamp,assetName) = { | |
8 | 16 | let pmt = i.payments[0] | |
17 | + | let currentId = current(i) | |
9 | 18 | if ((timestamp > compeEndTimestamp)) | |
10 | 19 | then throw("Competition is finished") | |
11 | 20 | else { | |
12 | - | let currentId = toBase58String(value(pmt.assetId)) | |
13 | 21 | let currentKey = toBase58String(i.caller.bytes) | |
14 | 22 | let currentAmount = match getInteger(this, currentKey) { | |
15 | 23 | case a: Int => | |
16 | 24 | a | |
17 | 25 | case _ => | |
18 | 26 | 0 | |
19 | 27 | } | |
20 | 28 | let newAmount = (currentAmount + pmt.amount) | |
21 | 29 | [IntegerEntry(((((("sponsor_" + currentKey) + "_") + currentId) + "_") + compeNumber), newAmount), IntegerEntry(((compeNumber + "_") + currentId), newAmount)] | |
22 | 30 | } | |
23 | 31 | } | |
24 | 32 | ||
25 | 33 | ||
26 | 34 | ||
27 | 35 | @Callable(i) | |
28 | 36 | func sponsorWithDraw (compeNumber,compeStartTimestamp,timestamp,amount,assetId) = { | |
29 | 37 | let currentKey = toBase58String(i.caller.bytes) | |
30 | 38 | let currentAmount = match getInteger(this, ((currentKey + "_") + compeNumber)) { | |
31 | 39 | case a: Int => | |
32 | 40 | a | |
33 | 41 | case _ => | |
34 | 42 | 0 | |
35 | 43 | } | |
36 | 44 | let newAmount = (currentAmount - amount) | |
37 | 45 | if ((timestamp > compeStartTimestamp)) | |
38 | 46 | then throw("Competition has already started") | |
39 | 47 | else if ((0 > amount)) | |
40 | 48 | then throw("Can't withdraw negative amount") | |
41 | 49 | else if ((0 > newAmount)) | |
42 | 50 | then throw("Not enough balance") | |
43 | 51 | else [IntegerEntry(((((("sponsor_" + currentKey) + "_") + assetId) + "_") + compeNumber), newAmount), IntegerEntry(((compeNumber + "_") + assetId), newAmount)] | |
44 | 52 | } | |
45 | 53 | ||
46 | 54 | ||
47 | 55 | @Verifier(tx) | |
48 | 56 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
49 | 57 |
github/deemru/w8io/169f3d6 29.23 ms ◑