tx · GUwUBq2f1UWYheHhcuFGKZMR3LU1sNSwJYCae9kNm4tQ 3Mz29fiz3zgY9JDbiHKANvHsFgQutdfu4Ua: -0.01400000 Waves 2021.03.15 16:55 [1438922] smart account 3Mz29fiz3zgY9JDbiHKANvHsFgQutdfu4Ua > SELF 0.00000000 Waves
{ "type": 13, "id": "GUwUBq2f1UWYheHhcuFGKZMR3LU1sNSwJYCae9kNm4tQ", "fee": 1400000, "feeAssetId": null, "timestamp": 1615816533412, "version": 2, "chainId": 84, "sender": "3Mz29fiz3zgY9JDbiHKANvHsFgQutdfu4Ua", "senderPublicKey": "CTyHhnVTxf16Z4CmGGneAK8WB5g2QyT4MB8kUn8vPPcu", "proofs": [ "3vqMyR59rirCF9wd2MEV4beoG5vYhjBqwPUa8HhtCVixPJcmGZN73cUqwo3jehj98YYr7arvH8KvLn8FLTsPTueb" ], "script": "base64:AAIEAAAAAAAAAAYIAhIAEgAAAAACAQAAAAxpc1dhdmVzQXNzZXQAAAABAAAAB2Fzc2V0SWQEAAAAByRtYXRjaDAFAAAAB2Fzc2V0SWQDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAACkJ5dGVWZWN0b3IEAAAABWFzc2V0BQAAAAckbWF0Y2gwBwMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAEVW5pdAQAAAAFd2F2ZXMFAAAAByRtYXRjaDAGCQAAAgAAAAECAAAAC01hdGNoIGVycm9yAQAAABBnZXRUcmVhc3VyeVZhbHVlAAAAAQAAAAdhc3NldElkBAAAAAx0cmVhc3VyeU5hbWUEAAAAByRtYXRjaDAFAAAAB2Fzc2V0SWQDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAACkJ5dGVWZWN0b3IEAAAABWFzc2V0BQAAAAckbWF0Y2gwCQABLAAAAAICAAAACVRyZWFzdXJ5LQkAAlgAAAABBQAAAAVhc3NldAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAANzdHIFAAAAByRtYXRjaDAJAA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2gwAgAAAANJbnQEAAAAA3ZhbAUAAAAHJG1hdGNoMAUAAAADdmFsBAAAAARudWxsBQAAAAckbWF0Y2gwCQAAAgAAAAECAAAAJURhdGEgbWlzc2luZzogJ2dvdmVybm9yQ3JlYXRpb25QcmljZScDCQEAAAACIT0AAAACCAkAAZEAAAACCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAAAAAAZhbW91bnQFAAAAFWdvdmVybm9yQ3JlYXRpb25QcmljZQkAAAIAAAABAgAAABdOb3QgYSB2YWxpZCBhbW91bnQgc2VudAQAAAALZ292Q29udHJhY3QJAARCAAAABQIAAAAQR292ZXJub3JDb250cmFjdAkAAaQAAAABBQAAAAZoZWlnaHQAAAAAAAAAAAEAAAAAAAAAAAAHBAAAAA1nb3ZDb250cmFjdElkCQAEOAAAAAEFAAAAC2dvdkNvbnRyYWN0CQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAICAAAADlRyZWFzdXJ5LVdBVkVTCQABpAAAAAEJAABkAAAAAgkBAAAAEGdldFRyZWFzdXJ5VmFsdWUAAAABAgAAAAVXQVZFUwgJAAGRAAAAAggFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAAAAAAGYW1vdW50CQAETAAAAAIFAAAAC2dvdkNvbnRyYWN0CQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcggFAAAAC2dvdkNvbnRyYWN0AAAACHF1YW50aXR5BQAAAA1nb3ZDb250cmFjdElkBQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleca7iqY=", "height": 1438922, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 7ekduY5P1SXuB5rnKSKY8XV92dgcHZVUQ3ReUoEDppJ3 Next: 5dfTQBUf4mjFaVjbqJe1kzyjKGdqG6DYFe69sUanuYvm Diff:
Old | New | Differences | |
---|---|---|---|
11 | 11 | } | |
12 | 12 | ||
13 | 13 | ||
14 | - | func | |
14 | + | func getTreasuryValue (assetId) = { | |
15 | 15 | let treasuryName = match assetId { | |
16 | 16 | case asset: ByteVector => | |
17 | 17 | ("Treasury-" + toBase58String(asset)) | |
18 | - | case waves: Unit => | |
19 | - | "Treasury-WAVES" | |
18 | + | case str: String => | |
19 | + | ("Treasury-" + str) | |
20 | + | case _: Unit => | |
21 | + | throw("Unknown treasury") | |
20 | 22 | case _ => | |
21 | 23 | throw("Match error") | |
22 | 24 | } | |
55 | 57 | else { | |
56 | 58 | let govContract = Issue("GovernorContract", toString(height), 1, 0, false) | |
57 | 59 | let govContractId = calculateAssetId(govContract) | |
58 | - | [StringEntry("Treasury-WAVES", toString(( | |
60 | + | [StringEntry("Treasury-WAVES", toString((getTreasuryValue("WAVES") + i.payments[0].amount))), govContract, ScriptTransfer(i.caller, govContract.quantity, govContractId)] | |
59 | 61 | } | |
60 | 62 | } | |
61 | 63 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func isWavesAsset (assetId) = match assetId { | |
5 | 5 | case asset: ByteVector => | |
6 | 6 | false | |
7 | 7 | case waves: Unit => | |
8 | 8 | true | |
9 | 9 | case _ => | |
10 | 10 | throw("Match error") | |
11 | 11 | } | |
12 | 12 | ||
13 | 13 | ||
14 | - | func | |
14 | + | func getTreasuryValue (assetId) = { | |
15 | 15 | let treasuryName = match assetId { | |
16 | 16 | case asset: ByteVector => | |
17 | 17 | ("Treasury-" + toBase58String(asset)) | |
18 | - | case waves: Unit => | |
19 | - | "Treasury-WAVES" | |
18 | + | case str: String => | |
19 | + | ("Treasury-" + str) | |
20 | + | case _: Unit => | |
21 | + | throw("Unknown treasury") | |
20 | 22 | case _ => | |
21 | 23 | throw("Match error") | |
22 | 24 | } | |
23 | 25 | match getInteger(this, treasuryName) { | |
24 | 26 | case val: Int => | |
25 | 27 | val | |
26 | 28 | case null => | |
27 | 29 | 0 | |
28 | 30 | } | |
29 | 31 | } | |
30 | 32 | ||
31 | 33 | ||
32 | 34 | @Callable(i) | |
33 | 35 | func init () = if ((this != i.caller)) | |
34 | 36 | then throw("Access denied") | |
35 | 37 | else [IntegerEntry("governorCreationPrice", 1)] | |
36 | 38 | ||
37 | 39 | ||
38 | 40 | ||
39 | 41 | @Callable(i) | |
40 | 42 | func createGovernor () = if ((size(i.payments) != 1)) | |
41 | 43 | then throw("No payment attached") | |
42 | 44 | else if ((this == i.caller)) | |
43 | 45 | then throw("dApp self sending is denied") | |
44 | 46 | else if ((isWavesAsset(i.payments[0].assetId) == false)) | |
45 | 47 | then throw("Payment should be in WAVES") | |
46 | 48 | else { | |
47 | 49 | let governorCreationPrice = match getInteger(this, "governorCreationPrice") { | |
48 | 50 | case val: Int => | |
49 | 51 | val | |
50 | 52 | case null => | |
51 | 53 | throw("Data missing: 'governorCreationPrice'") | |
52 | 54 | } | |
53 | 55 | if ((i.payments[0].amount != governorCreationPrice)) | |
54 | 56 | then throw("Not a valid amount sent") | |
55 | 57 | else { | |
56 | 58 | let govContract = Issue("GovernorContract", toString(height), 1, 0, false) | |
57 | 59 | let govContractId = calculateAssetId(govContract) | |
58 | - | [StringEntry("Treasury-WAVES", toString(( | |
60 | + | [StringEntry("Treasury-WAVES", toString((getTreasuryValue("WAVES") + i.payments[0].amount))), govContract, ScriptTransfer(i.caller, govContract.quantity, govContractId)] | |
59 | 61 | } | |
60 | 62 | } | |
61 | 63 | ||
62 | 64 | ||
63 | 65 | @Verifier(tx) | |
64 | 66 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
65 | 67 |
github/deemru/w8io/169f3d6 45.19 ms ◑