tx · J3DDTYATXwajRGiZ44Zs1DRJEcau2PiYZjGXRZovYc4N 3N8mE3Vv1LpKFDxNRtdzBzmMKbwtycbB2KZ: -0.01000000 Waves 2022.02.22 07:38 [1934395] smart account 3N8mE3Vv1LpKFDxNRtdzBzmMKbwtycbB2KZ > SELF 0.00000000 Waves
{ "type": 13, "id": "J3DDTYATXwajRGiZ44Zs1DRJEcau2PiYZjGXRZovYc4N", "fee": 1000000, "feeAssetId": null, "timestamp": 1645504707359, "version": 2, "chainId": 84, "sender": "3N8mE3Vv1LpKFDxNRtdzBzmMKbwtycbB2KZ", "senderPublicKey": "9q7vTvr7sh15ChGajicBoCF1zuKAofLQPeBWFNdNsuA9", "proofs": [ "54FubM94staxKMNtG6D8CEHPANdnASVcarMHdz88PZQLssUCNjsFBC1pUMY6fzTphV7yDsNwpffJoiQR98X1U3Vh" ], "script": "base64:AAIFAAAAAAAAAAgIAhIECgIICAAAAAAAAAABAAAAAWkBAAAAC2lzc3VlTmV3TmZ0AAAAAgAAAARuYW1lAAAACG1ldGFkYXRhBAAAAA1jYWxsZXJBZGRyZXNzCQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAABWFzc2V0CQAEQgAAAAUFAAAABG5hbWUFAAAACG1ldGFkYXRhAAAAAAAAAAABAAAAAAAAAAAABwQAAAAHYXNzZXRJZAkABDgAAAABBQAAAAVhc3NldAQAAAAKYXNzZXRJZFN0cgkAAlgAAAABBQAAAAdhc3NldElkCQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAIJAAEsAAAAAgUAAAAKYXNzZXRJZFN0cgIAAAAIX2Fzc2V0SWQFAAAACmFzc2V0SWRTdHIJAARMAAAAAgUAAAAFYXNzZXQJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwkBAAAABXZhbHVlAAAAAQkABCYAAAABBQAAAA1jYWxsZXJBZGRyZXNzAAAAAAAAAAABBQAAAAdhc3NldElkBQAAAANuaWwAAAAAx3FkDQ==", "height": 1934395, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 6VjkvsKvQQPGPFG7saPbjVQ49tddd5iwb7v3Wi4RZbfG Next: 24ZXGzyRpSjbxEaGAJawByLZqcATcbipoYVKPQ9VHCFd Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let answersCount = 20 | |
5 | - | ||
6 | - | let answers = ["It is certain.", "It is decidedly so.", "Without a doubt.", "Yes - definitely.", "You may rely on it.", "As I see it, yes.", "Most likely.", "Outlook good.", "Yes.", "Signs point to yes.", "Reply hazy, try again.", "Ask again later.", "Better not tell you now.", "Cannot predict now.", "Concentrate and ask again.", "Don't count on it.", "My reply is no.", "My sources say no.", "Outlook not so good.", "Very doubtful."] | |
7 | - | ||
8 | - | func getAnswer (question,previousAnswer) = { | |
9 | - | let hash = sha256(toBytes((question + previousAnswer))) | |
10 | - | let index = toInt(hash) | |
11 | - | answers[(index % answersCount)] | |
12 | - | } | |
13 | - | ||
14 | - | ||
15 | - | func getPreviousAnswer (address) = match getString(this, (address + "_a")) { | |
16 | - | case a: String => | |
17 | - | a | |
18 | - | case _ => | |
19 | - | address | |
20 | - | } | |
21 | 4 | ||
22 | 5 | ||
23 | 6 | @Callable(i) | |
24 | - | func | |
7 | + | func issueNewNft (name,metadata) = { | |
25 | 8 | let callerAddress = toBase58String(i.caller.bytes) | |
26 | - | let answer = getAnswer(question, getPreviousAnswer(callerAddress)) | |
27 | - | let asset = Issue("NFT 1", "NFT 1 Description", 1, 0, false) | |
9 | + | let asset = Issue(name, metadata, 1, 0, false) | |
28 | 10 | let assetId = calculateAssetId(asset) | |
29 | - | [StringEntry((callerAddress + "_q"), question), StringEntry((callerAddress + "_a"), answer), asset, ScriptTransfer(value(addressFromString(callerAddress)), 1, assetId)] | |
11 | + | let assetIdStr = toBase58String(assetId) | |
12 | + | [StringEntry((assetIdStr + "_assetId"), assetIdStr), asset, ScriptTransfer(value(addressFromString(callerAddress)), 1, assetId)] | |
30 | 13 | } | |
31 | 14 | ||
32 | 15 |
github/deemru/w8io/169f3d6 27.79 ms ◑