tx · EpWK9gSKBCjMfADnL4EAqYSFxevRw9RpghkHoa53Uw7p 3N4TEQzMSjr8dNSXeexyKmteC6coHneTydX: -0.01000000 Waves 2021.06.19 13:06 [1577115] smart account 3N4TEQzMSjr8dNSXeexyKmteC6coHneTydX > SELF 0.00000000 Waves
{ "type": 13, "id": "EpWK9gSKBCjMfADnL4EAqYSFxevRw9RpghkHoa53Uw7p", "fee": 1000000, "feeAssetId": null, "timestamp": 1624097143627, "version": 2, "chainId": 84, "sender": "3N4TEQzMSjr8dNSXeexyKmteC6coHneTydX", "senderPublicKey": "BLYPM7pr6zCdxj9zzANneoGVcDEwBnQApCEnR3BkNm68", "proofs": [ "5WRdBC3mmFi8mugiTMwbc1n943LFCrxFuAJsqdaknLX1FvrzwNH6AtEJF6HJTpEpMJWbujvtnkVgE3BzvgzLf6wH" ], "script": "base64:AAIDAAAAAAAAAAgIARIECgIIAQAAAAEAAAAADHNpYmFudG9rZW5JZAEAAAAgBjAVgasucYp7anAMTsgXN8zhLrtOCz7ntWZs3x9Kud8AAAABAAAAAWkBAAAABHZvdGUAAAACAAAABnZvdGVJZAAAAAR2b3RlBAAAAANwbXQJAQAAAAdleHRyYWN0AAAAAQgFAAAAAWkAAAAHcGF5bWVudAQAAAAFdm90ZXIJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwMJAAAAAAAAAggFAAAAA3BtdAAAAAZhbW91bnQAAAAAAAAAAAAJAAACAAAAAQIAAAApWW91IGNhbm5vdCB2b3RlIHdpdGhvdXQgcGF5aW5nIHZvdGluZyBmZWUDCQEAAAACIT0AAAACCAUAAAADcG10AAAAB2Fzc2V0SWQFAAAADHNpYmFudG9rZW5JZAkAAAIAAAABAgAAACdZb3UgY2FuIG9ubHkgdm90ZSB3aXRoIFNpYmFuIHZvdGUgdG9rZW4JAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAABnZvdGVJZAUAAAAEdm90ZQUAAAADbmlsAAAAAPW0cyM=", "height": 1577115, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: EgZwzervRPnptApDxHdxPVDtYEL29KDhzVzZAFXuxPdQ Next: De2gqFFLSc4XsrpYtG5NZ315XApq3XQRzmcczwCQfkPF Full:
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | ||
4 | + | let sibantokenId = base58'R9yNZwP1VkUksacNjtLqua6CePGGX9dYwBEj2TyjYkv' | |
5 | 5 | ||
6 | 6 | @Callable(i) | |
7 | - | func deposit () = { | |
8 | - | let pmt = if ((size(i.payments) == 1)) | |
9 | - | then i.payments[0] | |
10 | - | else throw("Attached payment is required") | |
11 | - | if (isDefined(pmt.assetId)) | |
12 | - | then throw("works with waves only") | |
13 | - | else { | |
14 | - | let currentKey = toBase58String(i.caller.bytes) | |
15 | - | let currentAmount = match getInteger(this, currentKey) { | |
16 | - | case a: Int => | |
17 | - | a | |
18 | - | case _ => | |
19 | - | 0 | |
20 | - | } | |
21 | - | let newAmount = (currentAmount + pmt.amount) | |
22 | - | $Tuple2([IntegerEntry(currentKey, newAmount)], unit) | |
23 | - | } | |
24 | - | } | |
25 | - | ||
26 | - | ||
27 | - | ||
28 | - | @Callable(i) | |
29 | - | func withdraw (amount) = { | |
30 | - | let currentKey = toBase58String(i.caller.bytes) | |
31 | - | let currentAmount = match getInteger(this, currentKey) { | |
32 | - | case a: Int => | |
33 | - | a | |
34 | - | case _ => | |
35 | - | 0 | |
36 | - | } | |
37 | - | let newAmount = (currentAmount - amount) | |
38 | - | if ((0 > amount)) | |
39 | - | then throw("Can't withdraw negative amount") | |
40 | - | else if ((0 > newAmount)) | |
41 | - | then throw("Not enough balance") | |
42 | - | else $Tuple2([IntegerEntry(currentKey, newAmount), ScriptTransfer(i.caller, amount, unit)], unit) | |
7 | + | func vote (voteId,vote) = { | |
8 | + | let pmt = extract(i.payment) | |
9 | + | let voter = toBase58String(i.caller.bytes) | |
10 | + | if ((pmt.amount == 0)) | |
11 | + | then throw("You cannot vote without paying voting fee") | |
12 | + | else if ((pmt.assetId != sibantokenId)) | |
13 | + | then throw("You can only vote with Siban vote token") | |
14 | + | else WriteSet([DataEntry(voteId, vote)]) | |
43 | 15 | } | |
44 | 16 | ||
45 | 17 |
github/deemru/w8io/026f985 24.83 ms ◑