tx · 8Wxg6tRb6jMU2RhmSXWkiY1dqNNETSAf5zq7pnxjjTvY 3Mza5Ao6wJgpw1JG3jxRY1xigD44zgfhdK6: -0.04000000 Waves 2021.11.08 18:31 [1782220] smart account 3Mza5Ao6wJgpw1JG3jxRY1xigD44zgfhdK6 > SELF 0.00000000 Waves
{ "type": 13, "id": "8Wxg6tRb6jMU2RhmSXWkiY1dqNNETSAf5zq7pnxjjTvY", "fee": 4000000, "feeAssetId": null, "timestamp": 1636385554850, "version": 2, "chainId": 84, "sender": "3Mza5Ao6wJgpw1JG3jxRY1xigD44zgfhdK6", "senderPublicKey": "Gud7Z17wiZEMZiHRbn48k2D9H13jmLEDZZ8b7NCfjRJL", "proofs": [ "cPG7gMBXuXMbSS3Z4Km81XDzAMefxN9jQ6B3Ltx9PM2D5pwUT71XiedL1RL91aSFDS9RchBn6YwM7gZudkCsAsG" ], "script": "base64:AAIFAAAAAAAAAA8IAhIAEgMKAQESBAoCAQgAAAADAAAAAAZPUkFDTEUCAAAAIzNNczN2RmtyVGFYdllOdzlWbmE4dmdUbUh6RWhXQ0JrQm1UAQAAABBnZXRPcmFjbGVBZGRyZXNzAAAAAAkBAAAAB0FkZHJlc3MAAAABCQACWQAAAAEFAAAABk9SQUNMRQEAAAATZ2V0U3RhdHVzRnJvbU9yYWNsZQAAAAEAAAAHYWRkcmVzcwkABB0AAAACCQEAAAAQZ2V0T3JhY2xlQWRkcmVzcwAAAAAJAAEsAAAAAgUAAAAHYWRkcmVzcwIAAAAHX3N0YXR1cwAAAAMAAAABaQEAAAAHZGVwb3NpdAAAAAAEAAAAA3BtdAMJAAAAAAAAAgkAAZAAAAABCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAQkAAZEAAAACCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAAkAAAIAAAABAgAAABxBdHRhY2hlZCBwYXltZW50IGlzIHJlcXVpcmVkBAAAAApjdXJyZW50S2V5CQACWAAAAAEICAUAAAABaQAAAAZjYWx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"height": 1782220, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 7arHd68G7GnsRKRycEtxA1NdAwJQKPMhBgUoWec7iviH Next: 9PpRchgBQHbkNuvTNEE8ZTzYnFoUhR8kDC27mNun4qNV Diff:
Old | New | Differences | |
---|---|---|---|
6 | 6 | func getOracleAddress () = Address(fromBase58String(ORACLE)) | |
7 | 7 | ||
8 | 8 | ||
9 | - | func getStatusFromOracle (address) = getString(getOracleAddress(), (address + "status")) | |
9 | + | func getStatusFromOracle (address) = getString(getOracleAddress(), (address + "_status")) | |
10 | 10 | ||
11 | 11 | ||
12 | 12 | @Callable(i) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let ORACLE = "3Ms3vFkrTaXvYNw9Vna8vgTmHzEhWCBkBmT" | |
5 | 5 | ||
6 | 6 | func getOracleAddress () = Address(fromBase58String(ORACLE)) | |
7 | 7 | ||
8 | 8 | ||
9 | - | func getStatusFromOracle (address) = getString(getOracleAddress(), (address + "status")) | |
9 | + | func getStatusFromOracle (address) = getString(getOracleAddress(), (address + "_status")) | |
10 | 10 | ||
11 | 11 | ||
12 | 12 | @Callable(i) | |
13 | 13 | func deposit () = { | |
14 | 14 | let pmt = if ((size(i.payments) == 1)) | |
15 | 15 | then i.payments[0] | |
16 | 16 | else throw("Attached payment is required") | |
17 | 17 | let currentKey = toBase58String(i.caller.bytes) | |
18 | 18 | if (isDefined(pmt.assetId)) | |
19 | 19 | then throw("works with waves only") | |
20 | 20 | else if ((getStatusFromOracle(currentKey) != "verified")) | |
21 | 21 | then throw("No Access") | |
22 | 22 | else { | |
23 | 23 | let currentAmount = match getInteger(this, currentKey) { | |
24 | 24 | case a: Int => | |
25 | 25 | a | |
26 | 26 | case _ => | |
27 | 27 | 0 | |
28 | 28 | } | |
29 | 29 | let newAmount = (currentAmount + pmt.amount) | |
30 | 30 | $Tuple2([IntegerEntry(currentKey, newAmount)], unit) | |
31 | 31 | } | |
32 | 32 | } | |
33 | 33 | ||
34 | 34 | ||
35 | 35 | ||
36 | 36 | @Callable(i) | |
37 | 37 | func withdraw (amount) = { | |
38 | 38 | let currentKey = toBase58String(i.caller.bytes) | |
39 | 39 | let currentAmount = match getInteger(this, currentKey) { | |
40 | 40 | case a: Int => | |
41 | 41 | a | |
42 | 42 | case _ => | |
43 | 43 | 0 | |
44 | 44 | } | |
45 | 45 | let newAmount = (currentAmount - amount) | |
46 | 46 | if ((0 >= amount)) | |
47 | 47 | then throw("Amount must be greater than 0") | |
48 | 48 | else if ((0 > newAmount)) | |
49 | 49 | then throw("Not enough balance") | |
50 | 50 | else $Tuple2([IntegerEntry(currentKey, newAmount), ScriptTransfer(i.caller, amount, unit)], unit) | |
51 | 51 | } | |
52 | 52 | ||
53 | 53 | ||
54 | 54 | ||
55 | 55 | @Callable(i) | |
56 | 56 | func transfer (amount,recipient) = { | |
57 | 57 | let currentKey = toBase58String(i.caller.bytes) | |
58 | 58 | let currentAmount = match getInteger(this, currentKey) { | |
59 | 59 | case a: Int => | |
60 | 60 | a | |
61 | 61 | case _ => | |
62 | 62 | 0 | |
63 | 63 | } | |
64 | 64 | let newAmount = (currentAmount - amount) | |
65 | 65 | if ((getStatusFromOracle(currentKey) != "verified")) | |
66 | 66 | then throw("No Access") | |
67 | 67 | else if ((0 >= amount)) | |
68 | 68 | then throw("Amount must be greater than 0") | |
69 | 69 | else if ((0 > newAmount)) | |
70 | 70 | then throw("Not enough balance") | |
71 | 71 | else { | |
72 | 72 | let recKey = toBase58String(Address(fromBase58String(recipient)).bytes) | |
73 | 73 | let recAmount = match getInteger(this, recKey) { | |
74 | 74 | case a: Int => | |
75 | 75 | a | |
76 | 76 | case _ => | |
77 | 77 | 0 | |
78 | 78 | } | |
79 | 79 | $Tuple2([IntegerEntry(currentKey, newAmount), IntegerEntry(recKey, (recAmount + amount))], unit) | |
80 | 80 | } | |
81 | 81 | } | |
82 | 82 | ||
83 | 83 | ||
84 | 84 | @Verifier(tx) | |
85 | 85 | func verify () = { | |
86 | 86 | let smartPK = base58'Gud7Z17wiZEMZiHRbn48k2D9H13jmLEDZZ8b7NCfjRJL' | |
87 | 87 | let secondPK = base58'CwvKLDcXt3Wd2MEyEemVKawiD7gaCV68wh2GcnJRHFqB' | |
88 | 88 | let smart = sigVerify(tx.bodyBytes, tx.proofs[0], smartPK) | |
89 | 89 | let second = sigVerify(tx.bodyBytes, tx.proofs[0], secondPK) | |
90 | 90 | match tx { | |
91 | 91 | case t: SetScriptTransaction => | |
92 | 92 | true | |
93 | 93 | case t: DataTransaction => | |
94 | 94 | true | |
95 | 95 | case t: InvokeScriptTransaction => | |
96 | 96 | true | |
97 | 97 | case t: TransferTransaction => | |
98 | 98 | if (smart) | |
99 | 99 | then true | |
100 | 100 | else second | |
101 | 101 | case _ => | |
102 | 102 | false | |
103 | 103 | } | |
104 | 104 | } | |
105 | 105 |
github/deemru/w8io/169f3d6 48.91 ms ◑