tx · Dwh3iY7zNGuaDFTXmdT5r91BHG8vTQoB56YikSKV1kX3

3MwZKQS7pg5abWc8ZGCEEXMWq8JuRwxsgPk:  -0.01000000 Waves

2019.09.20 17:24 [684761] smart account 3MwZKQS7pg5abWc8ZGCEEXMWq8JuRwxsgPk > SELF 0.00000000 Waves

{ "type": 13, "id": "Dwh3iY7zNGuaDFTXmdT5r91BHG8vTQoB56YikSKV1kX3", "fee": 1000000, "feeAssetId": null, "timestamp": 1568989474335, "version": 1, "sender": "3MwZKQS7pg5abWc8ZGCEEXMWq8JuRwxsgPk", "senderPublicKey": "9zvty9QXsUDqcNEgnh5BU4uN4oCNNaNtPpeQa78Ngxui", "proofs": [ "5wDNCGcsiQLuscpsYm3Ff3is5bQBWjv4Vp9r9BWfc2jsmeghoRkCrxTP1aaMGwr5jYk5kLYJfsiV2f1Ccr3mjYuR" ], "script": "base64:AAIDAAAAAAAAAAAAAAAAAAAAAwAAAAFpAQAAAARpbml0AAAABAAAAARuYW1lAAAABXBob3RvAAAABXByaWNlAAAAB3Rva2VuSWQJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAICAAAABG5hbWUFAAAABG5hbWUJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAICAAAABXBob3RvBQAAAAVwaG90bwkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgIAAAAFcHJpY2UFAAAABXByaWNlCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACAgAAAAV0b2tlbgUAAAAHdG9rZW5JZAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgIAAAAFb3duZXIJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwUAAAADbmlsAAAAAWkBAAAACGJ1eVRva2VuAAAAAAQAAAADcG10CQEAAAAHZXh0cmFjdAAAAAEIBQAAAAFpAAAAB3BheW1lbnQEAAAAD3JlY2VpdmVkUGF5bWVudAQAAAAHJG1hdGNo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bXQAAAAHYXNzZXRJZAkAAAAAAAACCQACWAAAAAEJAQAAAAdleHRyYWN0AAAAAQgFAAAADGV4dHJhY3RlZFBtdAAAAAdhc3NldElkBQAAAAd0b2tlbklkBwkAAAAAAAACCAUAAAAMZXh0cmFjdGVkUG10AAAABmFtb3VudAAAAAAAAAAAAQcJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAICAAAABnJlbnRlcgkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBQAAAANuaWwJAAACAAAAAQIAAAAncGF5bWVudCBlcnJvciwgeW91IG5lZWQgdG8gc2VuZCAxIHRva2VuCQAAAgAAAAECAAAAE25vIHBheW1lbnQgYXR0YWNoZWQAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABjoPdfY=", "chainId": 84, "height": 684761, "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
OldNewDifferences
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/169f3d6 
21.81 ms