tx · H6ETtdrTrWoX6swbVkLfTb8n5UAzwJLhgiP9tfB1CWxN 3N7KcuNZ2Pe7hakkyJhJqg63fTZdxPnSX4n: -0.10000000 Waves 2022.04.09 19:17 [2001269] smart account 3N7KcuNZ2Pe7hakkyJhJqg63fTZdxPnSX4n > SELF 0.00000000 Waves
{ "type": 13, "id": "H6ETtdrTrWoX6swbVkLfTb8n5UAzwJLhgiP9tfB1CWxN", "fee": 10000000, "feeAssetId": null, "timestamp": 1649521009516, "version": 2, "chainId": 84, "sender": "3N7KcuNZ2Pe7hakkyJhJqg63fTZdxPnSX4n", "senderPublicKey": "DohVVD3Qvdzb87xgN5f6HTwkopRNUzEXYmooZ7VqgAbP", "proofs": [ "3UxS3uSnf9XX6VkAs5bMNhCcAt5dhh2gKe4CiFTxGoDPXc2vsqmqeQLKDDkYwD65hwQgmRVfUMzeUrQmqf1c69LT" ], "script": "base64:AAIDAAAAAAAAAAcIARIDCgEIAAAABAAAAAAMYW5zd2Vyc0NvdW50AAAAAAAAAAAUAAAAAAdhbnN3ZXJzCQAETAAAAAICAAAADkl0IGlzIGNlcnRhaW4uCQAETAAAAAICAAAAE0l0IGlzIGRlY2lkZWRseSBzby4JAARMAAAAAgIAAAAQV2l0aG91dCBhIGRvdWJ0LgkABEwAAAACAgAAABFZZXMgLSBkZWZpbml0ZWx5LgkABEwAAAACAgAAABNZb3UgbWF5IHJlbHkgb24gaXQuCQAETAAAAAICAAAAEUFzIEkgc2VlIGl0LCB5ZXMuCQAETAAAAAICAAAADE1vc3QgbGlrZWx5LgkABEwAAAACAgAAAA1PdXRsb29rIGdvb2QuCQAETAAAAAICAAAABFllcy4JAARMAAAAAgIAAAATU2lnbnMgcG9pbnQgdG8geWVzLgkABEwAAAACAgAAABZSZXBseSBoYXp5LCB0cnkgYWdhaW4uCQAETAAAAAICAAAAEEFzayBhZ2FpbiBsYXRlci4JAARMAAAAAgIAAAAYQmV0dGVyIG5vdCB0ZWxsIHlvdSBub3cuCQAETAAAAAIC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AAAQUAAAANY2FsbGVyQWRkcmVzcwkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACBQAAAA1jYWxsZXJBZGRyZXNzAgAAAAJfcQUAAAAIcXVlc3Rpb24JAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgUAAAANY2FsbGVyQWRkcmVzcwIAAAACX2EFAAAABmFuc3dlcgUAAAADbmlsAAAAAJy95FM=", "height": 2001269, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: EJ5q1hnrhpibdVExg4PYcyGyBmvhgP6oLnkC3RtNHXeP Next: 5MmQnKSoVnPuQL7P6rabxKihj6ZWK9T4jcAv9Uh9GCi7 Full:
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
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 | + | } | |
4 | 21 | ||
5 | 22 | ||
6 | 23 | @Callable(i) | |
7 | - | func createMuthuToken () = if ((i.caller == this)) | |
8 | - | then { | |
9 | - | let issue = Issue("MUTHU", "A test token by K.Muthu", 10, 1, true) | |
10 | - | let id = calculateAssetId(issue) | |
11 | - | $Tuple2([issue, BinaryEntry("id", id)], unit) | |
12 | - | } | |
13 | - | else throw("Token already issued") | |
14 | - | ||
15 | - | ||
16 | - | ||
17 | - | @Callable(i) | |
18 | - | func giveTokens (address,amount) = { | |
19 | - | let assetID = match getBinary(this, "id") { | |
20 | - | case id: ByteVector => | |
21 | - | id | |
22 | - | case _ => | |
23 | - | throw("Can't find Assest ID") | |
24 | - | } | |
25 | - | if (if ((i.caller == this)) | |
26 | - | then (assetBalance(this, assetID) >= amount) | |
27 | - | else false) | |
28 | - | then [IntegerEntry(toBase58String(address), amount), ScriptTransfer(Address(address), amount, assetID)] | |
29 | - | else throw("Can't call or not enough balance") | |
24 | + | func tellme (question) = { | |
25 | + | let a = extract(i.payment) | |
26 | + | let b = a.amount | |
27 | + | let callerAddress = toBase58String(i.caller.bytes) | |
28 | + | let answer = getAnswer(question, getPreviousAnswer(callerAddress)) | |
29 | + | WriteSet([DataEntry((callerAddress + "_q"), question), DataEntry((callerAddress + "_a"), answer)]) | |
30 | 30 | } | |
31 | 31 | ||
32 | - | ||
33 | - | @Verifier(tx) | |
34 | - | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
35 | 32 |
github/deemru/w8io/026f985 33.78 ms ◑