tx · 9zFfuwXYhxftvMUKMfMpShTHHE1YwBazWcSgFtv5Ee8H
3MpUDmnN27gMSxHDEFQLW75epUMECTHDn6E: -0.01400000 Waves
2020.11.26 11:00 [1282115] smart account 3MpUDmnN27gMSxHDEFQLW75epUMECTHDn6E > SELF 0.00000000 Waves
{
"type": 13,
"id": "9zFfuwXYhxftvMUKMfMpShTHHE1YwBazWcSgFtv5Ee8H",
"fee": 1400000,
"feeAssetId": null,
"timestamp": 1606377656350,
"version": 2,
"chainId": 84,
"sender": "3MpUDmnN27gMSxHDEFQLW75epUMECTHDn6E",
"senderPublicKey": "FJk5n9i5ysYBtjvPcos6iKm98yzpxms3gECZgg6Y8Bt1",
"proofs": [
"ybFi4Hcrr4Vn8wRNT1YBJEes8KLnhdm1Qb4xpUCBaxp4oUN9r979PdRcd8QNYJUvYFn6kLCZAWSYBc5NqGMY32D"
],
"script": "base64:AAIEAAAAAAAAAAcIAhIDCgEIAAAABQAAAAAFZGVsYXkAAAAAAAAAAAoAAAAADGFtb3VudFRvR2l2ZQAAAAACVAvkAAAAAAAHYXNzZXRJZAEAAAAg6KVqvMp3QvJwYTI1Sk9Fg7m5HuWZZxfDcerZC6EEresBAAAAD2dldEludGVnZXJCeUtleQAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhCQAAZQAAAAIFAAAABmhlaWdodAUAAAAFZGVsYXkBAAAACGFzU3RyaW5nAAAAAQAAAAJidgQAAAAHJG1hdGNoMAUAAAACYnYDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAADYnYwBQAAAAckbWF0Y2gwBQAAAANidjAJAAACAAAAAQIAAAAXQWRkcmVzcyBTdHJpbmcgZXhwZWN0ZWQAAAABAAAAAWkBAAAAB2dldFNpZ24AAAABAAAABGFkZHIEAAAADmxhc3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dHgAAAAPc2VuZGVyUHVibGljS2V5B2rXRSI=",
"height": 1282115,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: B4aZPSHXihFqetkCTxWkNp8BxGJzmQJKqnEjE92os9ZL
Next: 6FcsZQTwQxxmmLX1AjGG4oRoGKfntFqzZktEM9ijGqJb
Diff:
Old | New | | Differences |
---|
15 | 15 | | } |
---|
16 | 16 | | |
---|
17 | 17 | | |
---|
| 18 | + | func asString (bv) = match bv { |
---|
| 19 | + | case bv0: String => |
---|
| 20 | + | bv0 |
---|
| 21 | + | case _ => |
---|
| 22 | + | throw("Address String expected") |
---|
| 23 | + | } |
---|
| 24 | + | |
---|
| 25 | + | |
---|
18 | 26 | | @Callable(i) |
---|
19 | 27 | | func getSign (addr) = { |
---|
20 | 28 | | let lastCallHeight = getIntegerByKey(addr) |
---|
|
28 | 36 | | @Verifier(tx) |
---|
29 | 37 | | func verify () = match tx { |
---|
30 | 38 | | case inv: InvokeScriptTransaction => |
---|
31 | | - | true |
---|
| 39 | + | let lastCallHeight = getIntegerByKey(asString(inv.args[0])) |
---|
| 40 | + | let canGet = ((height - lastCallHeight) >= delay) |
---|
| 41 | + | if (canGet) |
---|
| 42 | + | then (inv.function == "getSign") |
---|
| 43 | + | else false |
---|
32 | 44 | | case sst: SetScriptTransaction => |
---|
33 | 45 | | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) |
---|
34 | 46 | | case _ => |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 4 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let delay = 10 |
---|
5 | 5 | | |
---|
6 | 6 | | let amountToGive = 10000000000 |
---|
7 | 7 | | |
---|
8 | 8 | | let assetId = base58'Gf9t8FA4H3ssoZPCwrg3KwUFCci8zuUFP9ssRsUY3s6a' |
---|
9 | 9 | | |
---|
10 | 10 | | func getIntegerByKey (key) = match getInteger(this, key) { |
---|
11 | 11 | | case a: Int => |
---|
12 | 12 | | a |
---|
13 | 13 | | case _ => |
---|
14 | 14 | | (height - delay) |
---|
15 | 15 | | } |
---|
16 | 16 | | |
---|
17 | 17 | | |
---|
| 18 | + | func asString (bv) = match bv { |
---|
| 19 | + | case bv0: String => |
---|
| 20 | + | bv0 |
---|
| 21 | + | case _ => |
---|
| 22 | + | throw("Address String expected") |
---|
| 23 | + | } |
---|
| 24 | + | |
---|
| 25 | + | |
---|
18 | 26 | | @Callable(i) |
---|
19 | 27 | | func getSign (addr) = { |
---|
20 | 28 | | let lastCallHeight = getIntegerByKey(addr) |
---|
21 | 29 | | let canGet = ((height - lastCallHeight) >= delay) |
---|
22 | 30 | | if (canGet) |
---|
23 | 31 | | then [IntegerEntry(addr, height), ScriptTransfer(Address(fromBase58String(addr)), amountToGive, assetId)] |
---|
24 | 32 | | else throw("You cannot get SIGN Token again yet") |
---|
25 | 33 | | } |
---|
26 | 34 | | |
---|
27 | 35 | | |
---|
28 | 36 | | @Verifier(tx) |
---|
29 | 37 | | func verify () = match tx { |
---|
30 | 38 | | case inv: InvokeScriptTransaction => |
---|
31 | | - | true |
---|
| 39 | + | let lastCallHeight = getIntegerByKey(asString(inv.args[0])) |
---|
| 40 | + | let canGet = ((height - lastCallHeight) >= delay) |
---|
| 41 | + | if (canGet) |
---|
| 42 | + | then (inv.function == "getSign") |
---|
| 43 | + | else false |
---|
32 | 44 | | case sst: SetScriptTransaction => |
---|
33 | 45 | | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) |
---|
34 | 46 | | case _ => |
---|
35 | 47 | | false |
---|
36 | 48 | | } |
---|
37 | 49 | | |
---|