tx · HZsWzGA8qkqebh1MkFS6q1JCd2ZbhiYitxxTMkgdEKQe

3Mrk1Lpprkmc68ZpGLKzGi6bChA2JsQtsWy:  -0.01000000 Waves

2022.12.28 10:46 [2379837] smart account 3Mrk1Lpprkmc68ZpGLKzGi6bChA2JsQtsWy > SELF 0.00000000 Waves

{ "type": 13, "id": "HZsWzGA8qkqebh1MkFS6q1JCd2ZbhiYitxxTMkgdEKQe", "fee": 1000000, "feeAssetId": null, "timestamp": 1672213587644, "version": 2, "chainId": 84, "sender": "3Mrk1Lpprkmc68ZpGLKzGi6bChA2JsQtsWy", "senderPublicKey": "FqQH9eNJSxfrYrhaZ5tfjFyUKdViGSVGnESwPqpwDQGz", "proofs": [ "BSpE6AXj1bnmrZXmhW1mkvxePPJbV36tCYNd9Ktzt4L3RN1wjBc7hDswtzCfMvmK1NEcyXGuXahjTBBxVU7Movs" ], "script": "base64:AAIFAAAAAAAAAAcIAhIDCgEIAAAABAAAAAAGYWRtUHViAQAAACCSM3T/ncM6OSW7t5MIo6BoPvkjQ8aifQCkP8tVwO8YJgAAAAAHZ2F0ZXdheQkBAAAAB0FkZHJlc3MAAAABAQAAABoBVHnur5oRfizEyRQme70fRz4o30Oc3NsESgAAAAAERU5OTwEAAAAg9X6hLSUj8vDDdWwKn9+MJZEpOFonVhnZN5VgGw+Pz70BAAAAC2lzUGF5bWVudE9rAAAAAQAAAAFpBAAAABFhY2NlcHRhYmxlQXNzZXRJZAUAAAAERU5OTwMJAAAAAAAAAgkAAZAAAAABCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAAkAAAIAAAABAgAAABRQYXltZW50IG5vdCBhdHRhY2hlZAQAAAABcAkAAZEAAAACCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAAQAAAANd2FsbGV0QmFsYW5jZQkAA/AAAAACCAUAAAABaQAAAAZjYWxsZXIFAAAAEWFjY2VwdGFibGVBc3NldElkBAAAAAckbWF0Y2gwCAUAAAABcAAAAAdhc3NldElkA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mhlaWdodAUAAAANcGF5bWVudEFtb3VudAUAAAADbmlsCQAAAgAAAAECAAAAE2VudGVyIHZhbGlkIGFkZHJlc3MJAAACAAAAAQIAAAALYXR0YWNoIEVOTk8JAAACAAAAAQIAAAARd2FpdCBmb3IgY29vbGRvd24AAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tlea1UGjw=", "height": 2379837, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DPi1H9WvGdHk8XjhXGB43wwAesXH6RKgq84TZ9weMahu Next: CNnbaimdT4AePDA97PmA2i8LNkKKdgDfmHndjiAUVnfs Diff:
OldNewDifferences
66 let gateway = Address(base58'3N12oUKe89XdJsvWgx6ncAJTF6Bk8rP3sfP')
77
88 let ENNO = base58'HXJsuwkQmik6jwh7tC3cc6wq45A9Th2pDENH6HHR5vxt'
9-
10-let nextKey = "_next_"
11-
12-let nextPeriod = 1440
13-
14-let sendAmountKey = "_send_"
159
1610 func isPaymentOk (i) = {
1711 let acceptableAssetId = ENNO
3529 @Callable(i)
3630 func send (address) = {
3731 let currentKey = toBase58String(i.caller.bytes)
38- let nextAvailable = valueOrElse(getInteger(this, (nextKey + currentKey)), height)
39- let next = (nextAvailable + nextPeriod)
40- let diff = (next - height)
41- if ((address == ""))
42- then throw("add address")
43- else if ((1440 >= diff))
44- then throw("you can not")
45- else if (!(isPaymentOk(i)))
46- then throw("attach payment")
47- else {
32+ let lastBlockHeight = valueOrElse(getInteger(this, ("lastBlock_" + currentKey)), 0)
33+ let diff = (height - lastBlockHeight)
34+ if (if ((diff >= 1440))
35+ then true
36+ else (diff == height))
37+ then if (isPaymentOk(i))
38+ then if ((address != ""))
39+ then {
4840 let p = i.payments[0]
4941 let paymentAmount = p.amount
50-[Burn(ENNO, paymentAmount), IntegerEntry((nextKey + currentKey), next), IntegerEntry((sendAmountKey + currentKey), paymentAmount)]
42+[Burn(ENNO, paymentAmount), IntegerEntry(("lastBlock_" + currentKey), height), IntegerEntry(((("amount_" + currentKey) + "_") + toString(height)), paymentAmount)]
5143 }
44+ else throw("enter valid address")
45+ else throw("attach ENNO")
46+ else throw("wait for cooldown")
5247 }
5348
5449
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let admPub = base58'Aqi2u6UsFt6ePp65gz14SdCvKwP4t3CqiDejGBk7mWuj'
55
66 let gateway = Address(base58'3N12oUKe89XdJsvWgx6ncAJTF6Bk8rP3sfP')
77
88 let ENNO = base58'HXJsuwkQmik6jwh7tC3cc6wq45A9Th2pDENH6HHR5vxt'
9-
10-let nextKey = "_next_"
11-
12-let nextPeriod = 1440
13-
14-let sendAmountKey = "_send_"
159
1610 func isPaymentOk (i) = {
1711 let acceptableAssetId = ENNO
1812 if ((size(i.payments) == 0))
1913 then throw("Payment not attached")
2014 else {
2115 let p = i.payments[0]
2216 let walletBalance = assetBalance(i.caller, acceptableAssetId)
2317 match p.assetId {
2418 case assetId: ByteVector =>
2519 if ((assetId == acceptableAssetId))
2620 then (p.amount > 0)
2721 else false
2822 case _ =>
2923 throw("Wrong payment")
3024 }
3125 }
3226 }
3327
3428
3529 @Callable(i)
3630 func send (address) = {
3731 let currentKey = toBase58String(i.caller.bytes)
38- let nextAvailable = valueOrElse(getInteger(this, (nextKey + currentKey)), height)
39- let next = (nextAvailable + nextPeriod)
40- let diff = (next - height)
41- if ((address == ""))
42- then throw("add address")
43- else if ((1440 >= diff))
44- then throw("you can not")
45- else if (!(isPaymentOk(i)))
46- then throw("attach payment")
47- else {
32+ let lastBlockHeight = valueOrElse(getInteger(this, ("lastBlock_" + currentKey)), 0)
33+ let diff = (height - lastBlockHeight)
34+ if (if ((diff >= 1440))
35+ then true
36+ else (diff == height))
37+ then if (isPaymentOk(i))
38+ then if ((address != ""))
39+ then {
4840 let p = i.payments[0]
4941 let paymentAmount = p.amount
50-[Burn(ENNO, paymentAmount), IntegerEntry((nextKey + currentKey), next), IntegerEntry((sendAmountKey + currentKey), paymentAmount)]
42+[Burn(ENNO, paymentAmount), IntegerEntry(("lastBlock_" + currentKey), height), IntegerEntry(((("amount_" + currentKey) + "_") + toString(height)), paymentAmount)]
5143 }
44+ else throw("enter valid address")
45+ else throw("attach ENNO")
46+ else throw("wait for cooldown")
5247 }
5348
5449
5550 @Verifier(tx)
5651 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
5752

github/deemru/w8io/169f3d6 
44.45 ms