tx · 8Wcznytk6JB1VENMz98LymQHRiWrcVxJqA3ACvKTC81F 3MyLnBsVm9pw43K9eba5UExxb3efeai91KP: -0.01000000 Waves 2022.12.22 15:18 [2371492] smart account 3MyLnBsVm9pw43K9eba5UExxb3efeai91KP > SELF 0.00000000 Waves
{ "type": 13, "id": "8Wcznytk6JB1VENMz98LymQHRiWrcVxJqA3ACvKTC81F", "fee": 1000000, "feeAssetId": null, "timestamp": 1671711477707, "version": 2, "chainId": 84, "sender": "3MyLnBsVm9pw43K9eba5UExxb3efeai91KP", "senderPublicKey": "E5xdZLn3yHKAn29pTyubhr9R1mkRGg9WKAcpPrCYFYHx", "proofs": [ "aDM2b3HsSA8DFyX673YQAHKwheE44TvZbNJxS8b39vfjHz2mqwbMrkBqHTek3waqEYvxqwn5Y39aD5cDR6RHBcF" ], "script": "base64:AAIFAAAAAAAAAB8IAhIAEgASCQoHCAgIAQEIARIDCgEBEgASABIDCgEIAAAAEAAAAAAGYWRtUHViAQAAACDCbSeYCFZIOpb4r9LWa8L402jDi6OfxQF86gIW2LZmcwAAAAAMcGF5bWVudEFzc2V0AQAAACAhOUTpKXxfz4r4M5I49SS+rwv2+rnVA49FLcaoUr/6uQAAAAAIZXZlbnRLZXkCAAAAB19ldmVudF8AAAAACnBheW1lbnRLZXkCAAAACV9wYXltZW50XwAAAAAQZ2xvYmFsRXZlbnRJZEtleQIAAAAJX2V2ZW50SWRfAAAAAA1zdGFydEJsb2NrS2V5AgAAAAxfc3RhcnRCbG9ja18AAAAAC2VuZEJsb2NrS2V5AgAAAApfZW5kQmxvY2tfAAAAAAhpbWFnZUtleQIAAAAHX2ltYWdlXwAAAAAIb3duZXJLZXkCAAAAB19vd25lcl8AAAAABnVybEtleQIAAAAFX3VybF8AAAAACmhhcmRDYXBLZXkCAAAACV9oYXJkQ2FwXwAAAAAIdGl0bGVLZXkCAAAAB190aXRsZV8AAAAAE3NoYXJlSG9sZGVyQ291bnRLZXkCAAAAEl9zaGFyZUhvbGRlckN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AACnBheW1lbnRLZXkFAAAAD3RvdGFsUGF5bWVudEtleQkAAaQAAAABBQAAAAdldmVudElkCQAAZAAAAAIFAAAADHRvdGFsUGF5bWVudAUAAAANcGF5bWVudEFtb3VudAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACBQAAAApwYXltZW50S2V5BQAAABB3YWxsZXRQYXltZW50S2V5BQAAAApjdXJyZW50S2V5AgAAAAFfCQABpAAAAAEFAAAAB2V2ZW50SWQJAABkAAAAAgUAAAANd2FsbGV0UGF5bWVudAUAAAANcGF5bWVudEFtb3VudAUAAAADbmlsAAAAAWkBAAAABWNsYWltAAAAAAkAAAIAAAABAgAAACBldmVudCBvd25lciB3aWxsIGNsYWltIHRoZSBtb25leQAAAAFpAQAAAAZyZWZ1bmQAAAAACQAAAgAAAAECAAAAImlmIG5vdCBzdWNjZXNzIHBheWVycyBnb25uYSByZWZ1bmQAAAABaQEAAAAGZGVsZXRlAAAAAQAAAANrZXkDCQAAAAAAAAIIBQAAAAFpAAAAD2NhbGxlclB1YmxpY0tleQUAAAAGYWRtUHViCQAETAAAAAIJAQAAAAtEZWxldGVFbnRyeQAAAAEFAAAAA2tleQUAAAADbmlsCQAAAgAAAAECAAAAH3lvdSBhcmUgbm90IGFsbG93ZWQgdG8gZG8gdGhpcyEAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleTBi90U=", "height": 2371492, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: G42jcUpqW5tP41qEfVQdjhNA91wvSBPyrQUXV9pDQd9a Next: CZ8itX1YtgkepHrXNdaTiwCLztwv3ZPYbUueQ84sVijD Diff:
Old | New | Differences | |
---|---|---|---|
90 | 90 | else { | |
91 | 91 | let p = i.payments[0] | |
92 | 92 | let paymentAmount = p.amount | |
93 | - | [IntegerEntry(((paymentKey + shareHolderCountKey) + toString(eventId)), (shareHolderCount + 1)), IntegerEntry(((paymentKey + totalPaymentKey) + toString(eventId)), (totalPayment + paymentAmount)), IntegerEntry((((paymentKey + walletPaymentKey) + currentKey) + toString(eventId)), (walletPayment + paymentAmount))] | |
93 | + | [IntegerEntry(((paymentKey + shareHolderCountKey) + toString(eventId)), (shareHolderCount + 1)), IntegerEntry(((paymentKey + totalPaymentKey) + toString(eventId)), (totalPayment + paymentAmount)), IntegerEntry(((((paymentKey + walletPaymentKey) + currentKey) + "_") + toString(eventId)), (walletPayment + paymentAmount))] | |
94 | 94 | } | |
95 | 95 | } | |
96 | 96 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let admPub = base58'E5xdZLn3yHKAn29pTyubhr9R1mkRGg9WKAcpPrCYFYHx' | |
5 | 5 | ||
6 | 6 | let paymentAsset = base58'3Eh6z6z6ouFpWxGKrPaPnZwmDnDjgYHV6tqCmZf2G7tk' | |
7 | 7 | ||
8 | 8 | let eventKey = "_event_" | |
9 | 9 | ||
10 | 10 | let paymentKey = "_payment_" | |
11 | 11 | ||
12 | 12 | let globalEventIdKey = "_eventId_" | |
13 | 13 | ||
14 | 14 | let startBlockKey = "_startBlock_" | |
15 | 15 | ||
16 | 16 | let endBlockKey = "_endBlock_" | |
17 | 17 | ||
18 | 18 | let imageKey = "_image_" | |
19 | 19 | ||
20 | 20 | let ownerKey = "_owner_" | |
21 | 21 | ||
22 | 22 | let urlKey = "_url_" | |
23 | 23 | ||
24 | 24 | let hardCapKey = "_hardCap_" | |
25 | 25 | ||
26 | 26 | let titleKey = "_title_" | |
27 | 27 | ||
28 | 28 | let shareHolderCountKey = "_shareHolderCount_" | |
29 | 29 | ||
30 | 30 | let totalPaymentKey = "_totalPayment_" | |
31 | 31 | ||
32 | 32 | let walletPaymentKey = "_walletPayment_" | |
33 | 33 | ||
34 | 34 | func isPaymentOk (i) = { | |
35 | 35 | let acceptableAssetId = paymentAsset | |
36 | 36 | if ((size(i.payments) == 0)) | |
37 | 37 | then throw("Payment not attached") | |
38 | 38 | else { | |
39 | 39 | let p = i.payments[0] | |
40 | 40 | match p.assetId { | |
41 | 41 | case assetId: ByteVector => | |
42 | 42 | if ((assetId == acceptableAssetId)) | |
43 | 43 | then (p.amount > 0) | |
44 | 44 | else false | |
45 | 45 | case _ => | |
46 | 46 | throw("Wrong payment asset") | |
47 | 47 | } | |
48 | 48 | } | |
49 | 49 | } | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | @Callable(i) | |
53 | 53 | func shutdown () = throw("shutdown") | |
54 | 54 | ||
55 | 55 | ||
56 | 56 | ||
57 | 57 | @Callable(i) | |
58 | 58 | func settings () = throw("settings") | |
59 | 59 | ||
60 | 60 | ||
61 | 61 | ||
62 | 62 | @Callable(i) | |
63 | 63 | func create (title,image,owner,startBlock,endBlock,url,hardCap) = { | |
64 | 64 | let eventId = valueOrElse(getInteger(this, globalEventIdKey), 0) | |
65 | 65 | let increaseEventId = (eventId + 1) | |
66 | 66 | if ((i.callerPublicKey == admPub)) | |
67 | 67 | then [StringEntry(((eventKey + imageKey) + toString(increaseEventId)), image), StringEntry(((eventKey + ownerKey) + toString(increaseEventId)), owner), StringEntry(((eventKey + titleKey) + toString(increaseEventId)), title), IntegerEntry(((eventKey + startBlockKey) + toString(increaseEventId)), startBlock), IntegerEntry(((eventKey + endBlockKey) + toString(increaseEventId)), endBlock), StringEntry(((eventKey + urlKey) + toString(increaseEventId)), url), IntegerEntry(((eventKey + hardCapKey) + toString(increaseEventId)), hardCap), IntegerEntry((eventKey + globalEventIdKey), increaseEventId)] | |
68 | 68 | else throw("you are not allowed") | |
69 | 69 | } | |
70 | 70 | ||
71 | 71 | ||
72 | 72 | ||
73 | 73 | @Callable(i) | |
74 | 74 | func funding (eventId) = { | |
75 | 75 | let startBlock = valueOrErrorMessage(getInteger(this, ((eventKey + startBlockKey) + toString(eventId))), "err") | |
76 | 76 | let endBlock = valueOrErrorMessage(getInteger(this, ((eventKey + endBlockKey) + toString(eventId))), "err") | |
77 | 77 | let hardCap = valueOrErrorMessage(getInteger(this, ((eventKey + hardCapKey) + toString(eventId))), "err") | |
78 | 78 | let currentKey = toBase58String(i.caller.bytes) | |
79 | 79 | let totalPayment = valueOrElse(getInteger(this, ((paymentKey + totalPaymentKey) + toString(eventId))), 0) | |
80 | 80 | let walletPayment = valueOrElse(getInteger(this, (((paymentKey + walletPaymentKey) + currentKey) + toString(eventId))), 0) | |
81 | 81 | let shareHolderCount = valueOrElse(getInteger(this, ((paymentKey + shareHolderCountKey) + toString(eventId))), 0) | |
82 | 82 | if ((startBlock > height)) | |
83 | 83 | then throw("crowdfunding not started") | |
84 | 84 | else if ((height >= endBlock)) | |
85 | 85 | then throw("crowdfunding is over") | |
86 | 86 | else if ((totalPayment >= hardCap)) | |
87 | 87 | then throw("crowdfunding is reached to hard cap. thank you for participating!") | |
88 | 88 | else if (!(isPaymentOk(i))) | |
89 | 89 | then throw("you have to attach payment greater than zero") | |
90 | 90 | else { | |
91 | 91 | let p = i.payments[0] | |
92 | 92 | let paymentAmount = p.amount | |
93 | - | [IntegerEntry(((paymentKey + shareHolderCountKey) + toString(eventId)), (shareHolderCount + 1)), IntegerEntry(((paymentKey + totalPaymentKey) + toString(eventId)), (totalPayment + paymentAmount)), IntegerEntry((((paymentKey + walletPaymentKey) + currentKey) + toString(eventId)), (walletPayment + paymentAmount))] | |
93 | + | [IntegerEntry(((paymentKey + shareHolderCountKey) + toString(eventId)), (shareHolderCount + 1)), IntegerEntry(((paymentKey + totalPaymentKey) + toString(eventId)), (totalPayment + paymentAmount)), IntegerEntry(((((paymentKey + walletPaymentKey) + currentKey) + "_") + toString(eventId)), (walletPayment + paymentAmount))] | |
94 | 94 | } | |
95 | 95 | } | |
96 | 96 | ||
97 | 97 | ||
98 | 98 | ||
99 | 99 | @Callable(i) | |
100 | 100 | func claim () = throw("event owner will claim the money") | |
101 | 101 | ||
102 | 102 | ||
103 | 103 | ||
104 | 104 | @Callable(i) | |
105 | 105 | func refund () = throw("if not success payers gonna refund") | |
106 | 106 | ||
107 | 107 | ||
108 | 108 | ||
109 | 109 | @Callable(i) | |
110 | 110 | func delete (key) = if ((i.callerPublicKey == admPub)) | |
111 | 111 | then [DeleteEntry(key)] | |
112 | 112 | else throw("you are not allowed to do this!") | |
113 | 113 | ||
114 | 114 | ||
115 | 115 | @Verifier(tx) | |
116 | 116 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
117 | 117 |
github/deemru/w8io/026f985 27.91 ms ◑