tx · AwyeGhAnjwWEQSCm4p4Gw7pyY8cDc3XMXjq5WL8dGQcQ 3N72SETEKtTuaA3YNVYWgVEmXKrRrZYXHGo: -0.01000000 Waves 2022.11.16 16:04 [2319709] smart account 3N72SETEKtTuaA3YNVYWgVEmXKrRrZYXHGo > SELF 0.00000000 Waves
{ "type": 13, "id": "AwyeGhAnjwWEQSCm4p4Gw7pyY8cDc3XMXjq5WL8dGQcQ", "fee": 1000000, "feeAssetId": null, "timestamp": 1668603627353, "version": 2, "chainId": 84, "sender": "3N72SETEKtTuaA3YNVYWgVEmXKrRrZYXHGo", "senderPublicKey": "Kwu4LYBMntApXv8t7csxV23Kvc3tvak26wMKK56tA4V", "proofs": [ "2ZzXBeagaB8FBwBJr2caZEDKsFN3oHhvL1iqt48usQSWNa8KyiYMcGjGZV88xVhvykbnXZuqmTobKL62WVWjARsp" ], "script": "base64:BgIJCAISBQoDCAgBAAEBaQEGYnV5bmZ0Awdhc3NldElkBW5mdGlkDmFtb3VudEZvck93bmVyBAxvd25lckFkZHJlc3MIBQFpBmNhbGxlcgQFQWxpY2UJAQdBZGRyZXNzAQEaAVTHo8yFhBTYoCd/FEOkQ7UGFdEF3EX4ZyAJAMwIAgkBDEludGVnZXJFbnRyeQICDmFtb3VudEZvck93bmVyBQ5hbW91bnRGb3JPd25lcgkAzAgCCQELU3RyaW5nRW50cnkCAgdhc3NldGlkBQdhc3NldElkCQDMCAIJAQtTdHJpbmdFbnRyeQICBW5mdGlkBQVuZnRpZAkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDBQVBbGljZQUOYW1vdW50Rm9yT3duZXIFBHVuaXQFA25pbAB1HRnY", "height": 2319709, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FwyuTxCZkfQhSQsY4NBzVjtYMNv3TDStTam7PUP5Sqnp Next: GBHk4J5vx7ssRWeq413B7qWtU9roSorWQadmsVRM1jhM Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let separator = "_" | |
5 | - | ||
6 | - | let kBuy = "buy" | |
7 | - | ||
8 | - | let kSell = "sell" | |
9 | - | ||
10 | - | let kPrice = "price" | |
11 | - | ||
12 | - | func isNft (assetId) = match assetInfo(assetId) { | |
13 | - | case token: Asset => | |
14 | - | if (if ((token.decimals == 0)) | |
15 | - | then (token.quantity == 1) | |
16 | - | else false) | |
17 | - | then (token.reissuable == false) | |
18 | - | else false | |
19 | - | case _ => | |
20 | - | false | |
21 | - | } | |
22 | 4 | ||
23 | 5 | ||
24 | 6 | @Callable(i) | |
25 | - | func issueNft (name,meta,price) = { | |
26 | - | let newToken = Issue(name, meta, 1, 0, false) | |
27 | - | let issueId = calculateAssetId(newToken) | |
28 | - | [newToken, StringEntry(((kPrice + separator) + toBase58String(issueId)), toString(price))] | |
29 | - | } | |
30 | - | ||
31 | - | ||
32 | - | ||
33 | - | @Callable(i) | |
34 | - | func buyNFT (nftID) = { | |
35 | - | let assetId = fromBase58String(nftID) | |
36 | - | let amount = value(i.payments[0].amount) | |
37 | - | let price = valueOrErrorMessage(getString(((kPrice + separator) + nftID)), "There is no price for this nft") | |
38 | - | if ((i.payments[0].assetId != unit)) | |
39 | - | then throw("pay in waves") | |
40 | - | else if ((parseIntValue(price) > amount)) | |
41 | - | then throw("Invalid payment") | |
42 | - | else [ScriptTransfer(i.caller, 1, assetId), StringEntry(((toString(i.caller) + separator) + kBuy), ((nftID + separator) + toString(amount)))] | |
43 | - | } | |
44 | - | ||
45 | - | ||
46 | - | ||
47 | - | @Callable(i) | |
48 | - | func sellNFT () = { | |
49 | - | let $t011731258 = $Tuple2(value(i.payments[0].assetId), value(i.payments[0].amount)) | |
50 | - | let token0 = $t011731258._1 | |
51 | - | let amount0 = $t011731258._2 | |
52 | - | let price = getStringValue(((kPrice + separator) + valueOrErrorMessage(toBase58String(token0), "There is no price for this nft"))) | |
53 | - | if (!(isNft(token0))) | |
54 | - | then throw("Token is not NFT") | |
55 | - | else [ScriptTransfer(i.caller, parseIntValue(price), unit), StringEntry(((toString(i.caller) + separator) + kSell), ((toBase58String(token0) + separator) + toString(amount0)))] | |
7 | + | func buynft (assetId,nftid,amountForOwner) = { | |
8 | + | let ownerAddress = i.caller | |
9 | + | let Alice = Address(base58'3N87gU3S3GtPPo5S7dzRehArERGGJh1jwFD') | |
10 | + | [IntegerEntry("amountForOwner", amountForOwner), StringEntry("assetid", assetId), StringEntry("nftid", nftid), ScriptTransfer(Alice, amountForOwner, unit)] | |
56 | 11 | } | |
57 | 12 | ||
58 | 13 |
github/deemru/w8io/026f985 32.41 ms ◑