tx · 8GasfyfQ9dWSyYpp4VVgYuLEhZ9p4hbUQrE6fyqZFmmX

3MyLnBsVm9pw43K9eba5UExxb3efeai91KP:  -0.01000000 Waves

2022.12.22 13:51 [2371403] smart account 3MyLnBsVm9pw43K9eba5UExxb3efeai91KP > SELF 0.00000000 Waves

{ "type": 13, "id": "8GasfyfQ9dWSyYpp4VVgYuLEhZ9p4hbUQrE6fyqZFmmX", "fee": 1000000, "feeAssetId": null, "timestamp": 1671706321684, "version": 2, "chainId": 84, "sender": "3MyLnBsVm9pw43K9eba5UExxb3efeai91KP", "senderPublicKey": "E5xdZLn3yHKAn29pTyubhr9R1mkRGg9WKAcpPrCYFYHx", "proofs": [ "29LsUnM2G2oSBvhn1GosEzyLjdV6JDntqMu95ASWbPmtvovjZTkVPfRoQsS7o2AQ9dCzMrj5ZjbaF6mcyHDU7jsd" ], "script": "base64:AAIFAAAAAAAAAB8IAhIAEgASCQoHCAgIAQEIARIDCgEBEgASABIDCgEIAAAADwAAAAAGYWRtUHViAQAAACDCbSeYCFZIOpb4r9LWa8L402jDi6OfxQF86gIW2LZmcwAAAAAMcGF5bWVudEFzc2V0AQAAACAhOUTpKXxfz4r4M5I49SS+rwv2+rnVA49FLcaoUr/6uQAAAAAIZXZlbnRLZXkCAAAAB19ldmVudF8AAAAAEGdsb2JhbEV2ZW50SWRLZXkCAAAACV9ldmVudElkXwAAAAANc3RhcnRCbG9ja0tleQIAAAAMX3N0YXJ0QmxvY2tfAAAAAAtlbmRCbG9ja0tleQIAAAAKX2VuZEJsb2NrXwAAAAAIaW1hZ2VLZXkCAAAAB19pbWFnZV8AAAAACG93bmVyS2V5AgAAAAdfb3duZXJfAAAAAAZ1cmxLZXkCAAAABV91cmxfAAAAAApoYXJkQ2FwS2V5AgAAAAlfaGFyZENhcF8AAAAACHRpdGxlS2V5AgAAAAdfdGl0bGVfAAAAABNzaGFyZUhvbGRlckNvdW50S2V5AgAAABJfc2hhcmVIb2xkZXJDb3VudF8AAAAAD3Rvd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ubmEgcmVmdW5kAAAAAWkBAAAABmRlbGV0ZQAAAAEAAAADa2V5AwkAAAAAAAACCAUAAAABaQAAAA9jYWxsZXJQdWJsaWNLZXkFAAAABmFkbVB1YgkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABBQAAAANrZXkFAAAAA25pbAkAAAIAAAABAgAAAB95b3UgYXJlIG5vdCBhbGxvd2VkIHRvIGRvIHRoaXMhAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXk5BR18", "height": 2371403, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: EKaxq2QYUnvq8VV9p7j7mdtTaY4gfqmHNSXyZ6BDtWmC Next: AApqRyrQSF48dUxEgMy55suavF82ipXJAGmNo3ngKDxp Diff:
OldNewDifferences
2222 let hardCapKey = "_hardCap_"
2323
2424 let titleKey = "_title_"
25+
26+let shareHolderCountKey = "_shareHolderCount_"
27+
28+let totalPaymentKey = "_totalPayment_"
29+
30+let walletPaymentKey = "_walletPayment_"
2531
2632 func isPaymentOk (i) = {
2733 let acceptableAssetId = paymentAsset
6369
6470
6571 @Callable(i)
66-func funding () = throw("funding")
72+func funding (eventId) = {
73+ let startBlock = valueOrErrorMessage(getInteger(this, (startBlockKey + toString(eventId))), "err")
74+ let endBlock = valueOrErrorMessage(getInteger(this, (endBlockKey + toString(eventId))), "err")
75+ let hardCap = valueOrErrorMessage(getInteger(this, (hardCapKey + toString(eventId))), "err")
76+ let currentKey = toBase58String(i.caller.bytes)
77+ let totalPayment = valueOrElse(getInteger(this, (totalPaymentKey + toString(eventId))), 0)
78+ let walletPayment = valueOrElse(getInteger(this, ((walletPaymentKey + currentKey) + toString(eventId))), 0)
79+ let shareHolderCount = valueOrElse(getInteger(this, shareHolderCountKey), 0)
80+ if ((height > startBlock))
81+ then throw("crowdfunding not started")
82+ else if ((endBlock >= height))
83+ then throw("crowdfunding is over")
84+ else if ((totalPayment >= hardCap))
85+ then throw("crowdfunding is reached to hard cap. thank you for participating!")
86+ else if (!(isPaymentOk(i)))
87+ then throw("you have to attach payment greater than zero")
88+ else {
89+ let p = i.payments[0]
90+ let paymentAmount = p.amount
91+[IntegerEntry((shareHolderCountKey + toString(eventId)), (shareHolderCount + 1)), IntegerEntry((totalPaymentKey + toString(eventId)), (totalPayment + paymentAmount)), IntegerEntry(((walletPaymentKey + currentKey) + toString(eventId)), (walletPayment + paymentAmount))]
92+ }
93+ }
6794
6895
6996
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let admPub = base58'E5xdZLn3yHKAn29pTyubhr9R1mkRGg9WKAcpPrCYFYHx'
55
66 let paymentAsset = base58'3Eh6z6z6ouFpWxGKrPaPnZwmDnDjgYHV6tqCmZf2G7tk'
77
88 let eventKey = "_event_"
99
1010 let globalEventIdKey = "_eventId_"
1111
1212 let startBlockKey = "_startBlock_"
1313
1414 let endBlockKey = "_endBlock_"
1515
1616 let imageKey = "_image_"
1717
1818 let ownerKey = "_owner_"
1919
2020 let urlKey = "_url_"
2121
2222 let hardCapKey = "_hardCap_"
2323
2424 let titleKey = "_title_"
25+
26+let shareHolderCountKey = "_shareHolderCount_"
27+
28+let totalPaymentKey = "_totalPayment_"
29+
30+let walletPaymentKey = "_walletPayment_"
2531
2632 func isPaymentOk (i) = {
2733 let acceptableAssetId = paymentAsset
2834 if ((size(i.payments) == 0))
2935 then throw("Payment not attached")
3036 else {
3137 let p = i.payments[0]
3238 match p.assetId {
3339 case assetId: ByteVector =>
3440 if ((assetId == acceptableAssetId))
3541 then (p.amount > 0)
3642 else false
3743 case _ =>
3844 throw("Wrong payment asset")
3945 }
4046 }
4147 }
4248
4349
4450 @Callable(i)
4551 func shutdown () = throw("shutdown")
4652
4753
4854
4955 @Callable(i)
5056 func settings () = throw("settings")
5157
5258
5359
5460 @Callable(i)
5561 func create (title,image,owner,startBlock,endBlock,url,hardCap) = {
5662 let eventId = valueOrElse(getInteger(this, globalEventIdKey), 0)
5763 let increaseEventId = (eventId + 1)
5864 if ((i.callerPublicKey == admPub))
5965 then [StringEntry((imageKey + toString(increaseEventId)), image), StringEntry((ownerKey + toString(increaseEventId)), owner), StringEntry((titleKey + toString(increaseEventId)), title), IntegerEntry((startBlockKey + toString(increaseEventId)), startBlock), IntegerEntry((endBlockKey + toString(increaseEventId)), endBlock), StringEntry((urlKey + toString(increaseEventId)), url), IntegerEntry((hardCapKey + toString(increaseEventId)), hardCap), IntegerEntry(globalEventIdKey, increaseEventId)]
6066 else throw("you are not allowed")
6167 }
6268
6369
6470
6571 @Callable(i)
66-func funding () = throw("funding")
72+func funding (eventId) = {
73+ let startBlock = valueOrErrorMessage(getInteger(this, (startBlockKey + toString(eventId))), "err")
74+ let endBlock = valueOrErrorMessage(getInteger(this, (endBlockKey + toString(eventId))), "err")
75+ let hardCap = valueOrErrorMessage(getInteger(this, (hardCapKey + toString(eventId))), "err")
76+ let currentKey = toBase58String(i.caller.bytes)
77+ let totalPayment = valueOrElse(getInteger(this, (totalPaymentKey + toString(eventId))), 0)
78+ let walletPayment = valueOrElse(getInteger(this, ((walletPaymentKey + currentKey) + toString(eventId))), 0)
79+ let shareHolderCount = valueOrElse(getInteger(this, shareHolderCountKey), 0)
80+ if ((height > startBlock))
81+ then throw("crowdfunding not started")
82+ else if ((endBlock >= height))
83+ then throw("crowdfunding is over")
84+ else if ((totalPayment >= hardCap))
85+ then throw("crowdfunding is reached to hard cap. thank you for participating!")
86+ else if (!(isPaymentOk(i)))
87+ then throw("you have to attach payment greater than zero")
88+ else {
89+ let p = i.payments[0]
90+ let paymentAmount = p.amount
91+[IntegerEntry((shareHolderCountKey + toString(eventId)), (shareHolderCount + 1)), IntegerEntry((totalPaymentKey + toString(eventId)), (totalPayment + paymentAmount)), IntegerEntry(((walletPaymentKey + currentKey) + toString(eventId)), (walletPayment + paymentAmount))]
92+ }
93+ }
6794
6895
6996
7097 @Callable(i)
7198 func claim () = throw("event owner will claim the money")
7299
73100
74101
75102 @Callable(i)
76103 func refund () = throw("if not success payers gonna refund")
77104
78105
79106
80107 @Callable(i)
81108 func delete (key) = if ((i.callerPublicKey == admPub))
82109 then [DeleteEntry(key)]
83110 else throw("you are not allowed to do this!")
84111
85112
86113 @Verifier(tx)
87114 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
88115

github/deemru/w8io/026f985 
25.31 ms