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/AAAAACCAUAAAABaQAAAAZjYWxsZXIFAAAAEWFjY2VwdGFibGVBc3NldElkBAAAAAckbWF0Y2gwCAUAAAABcAAAAA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AAAEFAAAABmhlaWdodAUAAAANcGF5bWVudEFtb3VudAUAAAADbmlsCQAAAgAAAAECAAAAE2VudGVyIHZhbGlkIGFkZHJlc3MJAAACAAAAAQIAAAALYXR0YWNoIEVOTk8JAAACAAAAAQIAAAARd2FpdCBmb3IgY29vbGRvd24AAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tlea1UGjw=",
"height": 2379837,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: DPi1H9WvGdHk8XjhXGB43wwAesXH6RKgq84TZ9weMahu
Next: CNnbaimdT4AePDA97PmA2i8LNkKKdgDfmHndjiAUVnfs
Diff:
Old | New | | Differences |
---|
6 | 6 | | let gateway = Address(base58'3N12oUKe89XdJsvWgx6ncAJTF6Bk8rP3sfP') |
---|
7 | 7 | | |
---|
8 | 8 | | let ENNO = base58'HXJsuwkQmik6jwh7tC3cc6wq45A9Th2pDENH6HHR5vxt' |
---|
9 | | - | |
---|
10 | | - | let nextKey = "_next_" |
---|
11 | | - | |
---|
12 | | - | let nextPeriod = 1440 |
---|
13 | | - | |
---|
14 | | - | let sendAmountKey = "_send_" |
---|
15 | 9 | | |
---|
16 | 10 | | func isPaymentOk (i) = { |
---|
17 | 11 | | let acceptableAssetId = ENNO |
---|
|
35 | 29 | | @Callable(i) |
---|
36 | 30 | | func send (address) = { |
---|
37 | 31 | | 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 { |
---|
48 | 40 | | let p = i.payments[0] |
---|
49 | 41 | | 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)] |
---|
51 | 43 | | } |
---|
| 44 | + | else throw("enter valid address") |
---|
| 45 | + | else throw("attach ENNO") |
---|
| 46 | + | else throw("wait for cooldown") |
---|
52 | 47 | | } |
---|
53 | 48 | | |
---|
54 | 49 | | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 5 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let admPub = base58'Aqi2u6UsFt6ePp65gz14SdCvKwP4t3CqiDejGBk7mWuj' |
---|
5 | 5 | | |
---|
6 | 6 | | let gateway = Address(base58'3N12oUKe89XdJsvWgx6ncAJTF6Bk8rP3sfP') |
---|
7 | 7 | | |
---|
8 | 8 | | let ENNO = base58'HXJsuwkQmik6jwh7tC3cc6wq45A9Th2pDENH6HHR5vxt' |
---|
9 | | - | |
---|
10 | | - | let nextKey = "_next_" |
---|
11 | | - | |
---|
12 | | - | let nextPeriod = 1440 |
---|
13 | | - | |
---|
14 | | - | let sendAmountKey = "_send_" |
---|
15 | 9 | | |
---|
16 | 10 | | func isPaymentOk (i) = { |
---|
17 | 11 | | let acceptableAssetId = ENNO |
---|
18 | 12 | | if ((size(i.payments) == 0)) |
---|
19 | 13 | | then throw("Payment not attached") |
---|
20 | 14 | | else { |
---|
21 | 15 | | let p = i.payments[0] |
---|
22 | 16 | | let walletBalance = assetBalance(i.caller, acceptableAssetId) |
---|
23 | 17 | | match p.assetId { |
---|
24 | 18 | | case assetId: ByteVector => |
---|
25 | 19 | | if ((assetId == acceptableAssetId)) |
---|
26 | 20 | | then (p.amount > 0) |
---|
27 | 21 | | else false |
---|
28 | 22 | | case _ => |
---|
29 | 23 | | throw("Wrong payment") |
---|
30 | 24 | | } |
---|
31 | 25 | | } |
---|
32 | 26 | | } |
---|
33 | 27 | | |
---|
34 | 28 | | |
---|
35 | 29 | | @Callable(i) |
---|
36 | 30 | | func send (address) = { |
---|
37 | 31 | | 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 { |
---|
48 | 40 | | let p = i.payments[0] |
---|
49 | 41 | | 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)] |
---|
51 | 43 | | } |
---|
| 44 | + | else throw("enter valid address") |
---|
| 45 | + | else throw("attach ENNO") |
---|
| 46 | + | else throw("wait for cooldown") |
---|
52 | 47 | | } |
---|
53 | 48 | | |
---|
54 | 49 | | |
---|
55 | 50 | | @Verifier(tx) |
---|
56 | 51 | | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) |
---|
57 | 52 | | |
---|