tx · HP8QZfFYaQwrf1N4jixeeADCPMRYKwRe5ZFK7ben4mG5
3N3P5euNnTjmGsZHxXceWDyFZM7CN9YPjhp: -0.01400000 Waves
2021.04.17 19:49 [1486710] smart account 3N3P5euNnTjmGsZHxXceWDyFZM7CN9YPjhp > SELF 0.00000000 Waves
{
"type": 13,
"id": "HP8QZfFYaQwrf1N4jixeeADCPMRYKwRe5ZFK7ben4mG5",
"fee": 1400000,
"feeAssetId": null,
"timestamp": 1618678199951,
"version": 2,
"chainId": 84,
"sender": "3N3P5euNnTjmGsZHxXceWDyFZM7CN9YPjhp",
"senderPublicKey": "ECgJ5aXMvEomM6yWA4tsqXdM3az7ddLr4cLr3yNJwJUb",
"proofs": [
"4iG879qNS6rFx4gsDWH81sbievYdzKZzvhaAR8wQ6pNkewxrnTUJhN4iMTpMEjfMCim2YYuxS8EHxHQrTFC5jPdQ"
],
"script": "base64:AAIEAAAAAAAAABIIAhIFCgMIAQESBwoFCAEBAQgAAAABAAAAAAZwYXI3SWQBAAAAIJedbhD+DwLKhAB/H26DYx4Zv6xpfO57kM3OSOXSB0EjAAAAAgAAAAFpAQAAAA5zcG9uc29yRGVwb3NpdAAAAAMAAAALY29tcGVOdW1iZXIAAAARY29tcGVFbmRUaW1lc3RhbXAAAAAJdGltZXN0YW1wBAAAAANwbXQJAAGRAAAAAggFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAADCQAAZgAAAAIFAAAACXRpbWVzdGFtcAUAAAARY29tcGVFbmRUaW1lc3RhbXAJAAACAAAAAQIAAAAXQ29tcGV0aXRpb24gaXMgZmluaXNoZWQDCQAAAAAAAAIIBQAAAANwbXQAAAAHYXNzZXRJZAUAAAAGcGFyN0lkCQAAAgAAAAECAAAAIENhbiBob2RsIFBBUjcgb25seSBhdCB0aGUgbW9tZW50BAAAAAljdXJyZW50SWQJAAJYAAAAAQkBAAAABXZhbHVlAAAAAQgFAAAAA3BtdAAAAAdhc3NldElkBAAAAApjdXJyZW50S2V5CQAC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AAGYW1vdW50AwkAAGYAAAACBQAAAAl0aW1lc3RhbXAFAAAAE2NvbXBlU3RhcnRUaW1lc3RhbXAJAAACAAAAAQIAAAAfQ29tcGV0aXRpb24gaGFzIGFscmVhZHkgc3RhcnRlZAMJAABmAAAAAgAAAAAAAAAAAAUAAAAGYW1vdW50CQAAAgAAAAECAAAAHkNhbid0IHdpdGhkcmF3IG5lZ2F0aXZlIGFtb3VudAMJAABmAAAAAgAAAAAAAAAAAAUAAAAJbmV3QW1vdW50CQAAAgAAAAECAAAAEk5vdCBlbm91Z2ggYmFsYW5jZQkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAICAAAACHNwb25zb3JfBQAAAApjdXJyZW50S2V5AgAAAAFfBQAAAAdhc3NldElkAgAAAAFfBQAAAAtjb21wZU51bWJlcgUAAAAJbmV3QW1vdW50CQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgUAAAALY29tcGVOdW1iZXICAAAAAV8FAAAAB2Fzc2V0SWQFAAAACW5ld0Ftb3VudAUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXkIWhlU",
"height": 1486710,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: FoYhckbmVawhzQvsWRNpSaTBRuKZMY1XG4q2Shx1uwXk
Next: 4svxSQUQ9GaFPnQXgqdgYnJSK2eWvjBqv8AskFqTXQqu
Diff:
Old | New | | Differences |
---|
11 | 11 | | else if ((pmt.assetId == par7Id)) |
---|
12 | 12 | | then throw("Can hodl PAR7 only at the moment") |
---|
13 | 13 | | else { |
---|
| 14 | + | let currentId = toBase58String(value(pmt.assetId)) |
---|
14 | 15 | | let currentKey = toBase58String(i.caller.bytes) |
---|
15 | 16 | | let currentAmount = match getInteger(this, currentKey) { |
---|
16 | 17 | | case a: Int => |
---|
|
19 | 20 | | 0 |
---|
20 | 21 | | } |
---|
21 | 22 | | let newAmount = (currentAmount + pmt.amount) |
---|
22 | | - | [IntegerEntry(((("sponsor_" + currentKey) + "_") + compeNumber), newAmount), IntegerEntry(compeNumber, newAmount)] |
---|
| 23 | + | [IntegerEntry(((((("sponsor_" + currentKey) + "_") + currentId) + "_") + compeNumber), newAmount), IntegerEntry(((compeNumber + "_") + currentId), newAmount)] |
---|
23 | 24 | | } |
---|
24 | 25 | | } |
---|
25 | 26 | | |
---|
26 | 27 | | |
---|
27 | 28 | | |
---|
28 | 29 | | @Callable(i) |
---|
29 | | - | func sponsorWithDraw (compeNumber,compeStartTimestamp,timestamp,amount) = { |
---|
| 30 | + | func sponsorWithDraw (compeNumber,compeStartTimestamp,timestamp,amount,assetId) = { |
---|
30 | 31 | | let currentKey = toBase58String(i.caller.bytes) |
---|
31 | 32 | | let currentAmount = match getInteger(this, ((currentKey + "_") + compeNumber)) { |
---|
32 | 33 | | case a: Int => |
---|
|
41 | 42 | | then throw("Can't withdraw negative amount") |
---|
42 | 43 | | else if ((0 > newAmount)) |
---|
43 | 44 | | then throw("Not enough balance") |
---|
44 | | - | else [IntegerEntry(((("sponsor_" + currentKey) + "_") + compeNumber), newAmount), IntegerEntry(compeNumber, newAmount)] |
---|
| 45 | + | else [IntegerEntry(((((("sponsor_" + currentKey) + "_") + assetId) + "_") + compeNumber), newAmount), IntegerEntry(((compeNumber + "_") + assetId), newAmount)] |
---|
45 | 46 | | } |
---|
46 | 47 | | |
---|
47 | 48 | | |
---|
Full:
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 | 6 | | @Callable(i) |
---|
7 | 7 | | func sponsorDeposit (compeNumber,compeEndTimestamp,timestamp) = { |
---|
8 | 8 | | let pmt = i.payments[0] |
---|
9 | 9 | | if ((timestamp > compeEndTimestamp)) |
---|
10 | 10 | | then throw("Competition is finished") |
---|
11 | 11 | | else if ((pmt.assetId == par7Id)) |
---|
12 | 12 | | then throw("Can hodl PAR7 only at the moment") |
---|
13 | 13 | | else { |
---|
| 14 | + | let currentId = toBase58String(value(pmt.assetId)) |
---|
14 | 15 | | let currentKey = toBase58String(i.caller.bytes) |
---|
15 | 16 | | let currentAmount = match getInteger(this, currentKey) { |
---|
16 | 17 | | case a: Int => |
---|
17 | 18 | | a |
---|
18 | 19 | | case _ => |
---|
19 | 20 | | 0 |
---|
20 | 21 | | } |
---|
21 | 22 | | let newAmount = (currentAmount + pmt.amount) |
---|
22 | | - | [IntegerEntry(((("sponsor_" + currentKey) + "_") + compeNumber), newAmount), IntegerEntry(compeNumber, newAmount)] |
---|
| 23 | + | [IntegerEntry(((((("sponsor_" + currentKey) + "_") + currentId) + "_") + compeNumber), newAmount), IntegerEntry(((compeNumber + "_") + currentId), newAmount)] |
---|
23 | 24 | | } |
---|
24 | 25 | | } |
---|
25 | 26 | | |
---|
26 | 27 | | |
---|
27 | 28 | | |
---|
28 | 29 | | @Callable(i) |
---|
29 | | - | func sponsorWithDraw (compeNumber,compeStartTimestamp,timestamp,amount) = { |
---|
| 30 | + | func sponsorWithDraw (compeNumber,compeStartTimestamp,timestamp,amount,assetId) = { |
---|
30 | 31 | | let currentKey = toBase58String(i.caller.bytes) |
---|
31 | 32 | | let currentAmount = match getInteger(this, ((currentKey + "_") + compeNumber)) { |
---|
32 | 33 | | case a: Int => |
---|
33 | 34 | | a |
---|
34 | 35 | | case _ => |
---|
35 | 36 | | 0 |
---|
36 | 37 | | } |
---|
37 | 38 | | let newAmount = (currentAmount - amount) |
---|
38 | 39 | | if ((timestamp > compeStartTimestamp)) |
---|
39 | 40 | | then throw("Competition has already started") |
---|
40 | 41 | | else if ((0 > amount)) |
---|
41 | 42 | | then throw("Can't withdraw negative amount") |
---|
42 | 43 | | else if ((0 > newAmount)) |
---|
43 | 44 | | then throw("Not enough balance") |
---|
44 | | - | else [IntegerEntry(((("sponsor_" + currentKey) + "_") + compeNumber), newAmount), IntegerEntry(compeNumber, newAmount)] |
---|
| 45 | + | else [IntegerEntry(((((("sponsor_" + currentKey) + "_") + assetId) + "_") + compeNumber), newAmount), IntegerEntry(((compeNumber + "_") + assetId), newAmount)] |
---|
45 | 46 | | } |
---|
46 | 47 | | |
---|
47 | 48 | | |
---|
48 | 49 | | @Verifier(tx) |
---|
49 | 50 | | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) |
---|
50 | 51 | | |
---|