tx · E9cyAdHsMKQzv9ojMtdKfpUgXZqrHxtZAKMisuqyjer1 3N587jNfLsncV4eEFuEqAhQx9sQ6fvcQtQJ: -0.01000000 Waves 2019.09.20 17:31 [684770] smart account 3N587jNfLsncV4eEFuEqAhQx9sQ6fvcQtQJ > SELF 0.00000000 Waves
{ "type": 13, "id": "E9cyAdHsMKQzv9ojMtdKfpUgXZqrHxtZAKMisuqyjer1", "fee": 1000000, "feeAssetId": null, "timestamp": 1568989972593, "version": 1, "sender": "3N587jNfLsncV4eEFuEqAhQx9sQ6fvcQtQJ", "senderPublicKey": "7ESBxNPUhAM5fD7mrh3CNBdDL8LShFSPsv59GyYacYWg", "proofs": [ "AVtDzN2giNiVbr5FuSrVoBSEBB6oEogM5wirakZo9EsaiUtUvvzTRbQmqxEzK9NJAXbZgy85h699rLNm3JPg8eC" ], "script": "base64:AAIDAAAAAAAAAAAAAAAAAAAAAwAAAAFpAQAAAARpbml0AAAABAAAAARuYW1lAAAABXBob3RvAAAABXByaWNlAAAAB3Rva2VuSWQJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAICAAAABG5hbWUFAAAABG5hbWUJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAICAAAABXBob3RvBQAAAAVwaG90bwkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgIAAAAFcHJpY2UFAAAABXByaWNlCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACAgAAAAV0b2tlbgUAAAAHdG9rZW5JZAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgIAAAAFb3duZXIJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwUAAAADbmlsAAAAAWkBAAAACGJ1eVRva2VuAAAAAAQAAAADcG10CQEAAAAHZXh0cmFjdAAAAAEIBQAAAAFpAAAAB3BheW1lbnQEAAAAD3JlY2VpdmVkUGF5bWVudAQAAAAHJG1hdGNoMAgFAAAAAWkAA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XRJZAkAAAAAAAACCQACWAAAAAEJAQAAAAdleHRyYWN0AAAAAQgFAAAADGV4dHJhY3RlZFBtdAAAAAdhc3NldElkBQAAAAd0b2tlbklkBwkAAAAAAAACCAUAAAAMZXh0cmFjdGVkUG10AAAABmFtb3VudAAAAAAAAAAAAQcJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAICAAAABnJlbnRlcgkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBQAAAANuaWwJAAACAAAAAQIAAAAncGF5bWVudCBlcnJvciwgeW91IG5lZWQgdG8gc2VuZCAxIHRva2VuCQAAAgAAAAECAAAAE25vIHBheW1lbnQgYXR0YWNoZWQAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABjoPdfY=", "chainId": 84, "height": 684770, "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(i) | |
7 | + | func init (name,photo,price,tokenId) = WriteSet([DataEntry("name", name), DataEntry("photo", photo), DataEntry("price", price), DataEntry("token", tokenId), DataEntry("owner", toBase58String(i.caller.bytes))]) | |
8 | + | ||
9 | + | ||
10 | + | ||
11 | + | @Callable(i) | |
12 | + | func buyToken () = { | |
13 | + | let pmt = extract(i.payment) | |
14 | + | let receivedPayment = match i.payment { | |
15 | + | case p: AttachedPayment => | |
16 | + | p.amount | |
17 | + | case _ => | |
18 | + | 0 | |
19 | + | } | |
20 | + | let price = getIntegerValue(this, "price") | |
21 | + | let tokenId = getStringValue(this, "token") | |
22 | + | if (isDefined(pmt.assetId)) | |
23 | + | then throw("waves only accepted") | |
24 | + | else if ((receivedPayment >= price)) | |
25 | + | then TransferSet([ScriptTransfer(i.caller, 1, fromBase58String(tokenId)), ScriptTransfer(i.caller, (receivedPayment - price), unit)]) | |
26 | + | else throw("not enough waves to buy the token") | |
27 | + | } | |
28 | + | ||
29 | + | ||
30 | + | ||
31 | + | @Callable(i) | |
32 | + | func activateAccess () = { | |
33 | + | let pmt = i.payment | |
34 | + | if (isDefined(pmt)) | |
35 | + | then { | |
36 | + | let extractedPmt = extract(pmt) | |
37 | + | let tokenId = getStringValue(this, "token") | |
38 | + | if (if (if (isDefined(extractedPmt.assetId)) | |
39 | + | then (toBase58String(extract(extractedPmt.assetId)) == tokenId) | |
40 | + | else false) | |
41 | + | then (extractedPmt.amount == 1) | |
42 | + | else false) | |
43 | + | then WriteSet([DataEntry("renter", toBase58String(i.caller.bytes))]) | |
44 | + | else throw("payment error, you need to send 1 token") | |
45 | + | } | |
46 | + | else throw("no payment attached") | |
47 | + | } | |
48 | + | ||
49 | + | ||
50 | + | @Verifier(tx) | |
51 | + | func verify () = true | |
52 | + |
github/deemru/w8io/026f985 14.38 ms ◑