tx · 34HCPReY4fe1jZfNqGrWtZ94qY5EZKWpvqhfwt3TdPc1 3Mz47rK3tkRBGKFDhQ6ruMxtnFRiVYy3qfx: -0.01000000 Waves 2019.09.20 17:36 [684774] smart account 3Mz47rK3tkRBGKFDhQ6ruMxtnFRiVYy3qfx > SELF 0.00000000 Waves
{ "type": 13, "id": "34HCPReY4fe1jZfNqGrWtZ94qY5EZKWpvqhfwt3TdPc1", "fee": 1000000, "feeAssetId": null, "timestamp": 1568990238821, "version": 1, "sender": "3Mz47rK3tkRBGKFDhQ6ruMxtnFRiVYy3qfx", "senderPublicKey": "6YinHe3hYkNvxQefnzaiwoDz5qiBG6Aa41eeA9yo7D1y", "proofs": [ "38Ufipak4beV7S2sL4pS7xKRFurDo6PHEMhcpp4SMC4CSDxnrk9P7XePdf3AjmzA8Uz7Ntgzv3mC6hMEt8kTR6BM" ], "script": "base64:AAIDAAAAAAAAAAAAAAAAAAAAAwAAAAFpAQAAAARpbml0AAAABAAAAARuYW1lAAAABXBob3RvAAAABXByaWNlAAAAB3Rva2VuSWQJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAICAAAABG5hbWUFAAAABG5hbWUJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAICAAAABXBob3RvBQAAAAVwaG90bwkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgIAAAAFcHJpY2UFAAAABXByaWNlCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACAgAAAAV0b2tlbgUAAAAHdG9rZW5JZAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgIAAAAFb3duZXIJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwUAAAADbmlsAAAAAWkBAAAACGJ1eVRva2VuAAAAAAQAAAADcG10CQEAAAAHZXh0cmFjdAAAAAEIBQAAAAFpAAAAB3BheW1lbnQEAAAAD3JlY2VpdmVkUGF5bWVudAQAAAAHJG1hdGNo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bXQAAAAHYXNzZXRJZAkAAAAAAAACCQACWAAAAAEJAQAAAAdleHRyYWN0AAAAAQgFAAAADGV4dHJhY3RlZFBtdAAAAAdhc3NldElkBQAAAAd0b2tlbklkBwkAAAAAAAACCAUAAAAMZXh0cmFjdGVkUG10AAAABmFtb3VudAAAAAAAAAAAAQcJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAICAAAABnJlbnRlcgkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBQAAAANuaWwJAAACAAAAAQIAAAAncGF5bWVudCBlcnJvciwgeW91IG5lZWQgdG8gc2VuZCAxIHRva2VuCQAAAgAAAAECAAAAE25vIHBheW1lbnQgYXR0YWNoZWQAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABjoPdfY=", "chainId": 84, "height": 684774, "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | ||
5 | + | ||
6 | + | @Callable(a) | |
7 | + | func init (b,c,d,e) = WriteSet([DataEntry("name", b), DataEntry("photo", c), DataEntry("price", d), DataEntry("token", e), DataEntry("owner", toBase58String(a.caller.bytes))]) | |
8 | + | ||
9 | + | ||
10 | + | ||
11 | + | @Callable(a) | |
12 | + | func buyToken () = { | |
13 | + | let f = extract(a.payment) | |
14 | + | let g = { | |
15 | + | let h = a.payment | |
16 | + | if ($isInstanceOf(h, "AttachedPayment")) | |
17 | + | then { | |
18 | + | let i = h | |
19 | + | i.amount | |
20 | + | } | |
21 | + | else 0 | |
22 | + | } | |
23 | + | let d = getIntegerValue(this, "price") | |
24 | + | let e = getStringValue(this, "token") | |
25 | + | if (isDefined(f.assetId)) | |
26 | + | then throw("waves only accepted") | |
27 | + | else if ((g >= d)) | |
28 | + | then TransferSet([ScriptTransfer(a.caller, 1, fromBase58String(e)), ScriptTransfer(a.caller, (g - d), unit)]) | |
29 | + | else throw("not enough waves to buy the token") | |
30 | + | } | |
31 | + | ||
32 | + | ||
33 | + | ||
34 | + | @Callable(a) | |
35 | + | func activateAccess () = { | |
36 | + | let f = a.payment | |
37 | + | if (isDefined(f)) | |
38 | + | then { | |
39 | + | let j = extract(f) | |
40 | + | let e = getStringValue(this, "token") | |
41 | + | if (if (if (isDefined(j.assetId)) | |
42 | + | then (toBase58String(extract(j.assetId)) == e) | |
43 | + | else false) | |
44 | + | then (j.amount == 1) | |
45 | + | else false) | |
46 | + | then WriteSet([DataEntry("renter", toBase58String(a.caller.bytes))]) | |
47 | + | else throw("payment error, you need to send 1 token") | |
48 | + | } | |
49 | + | else throw("no payment attached") | |
50 | + | } | |
51 | + | ||
52 | + | ||
53 | + | @Verifier(k) | |
54 | + | func l () = true | |
55 | + |
github/deemru/w8io/169f3d6 13.56 ms ◑