tx · 5L2fQNfSJEhqxsAzrgJsZ9vuGjZrC91prVAK1ad2K3SR 3MqRnEd83AoPWjTCHP2PVpFpWg6KbBPCJyo: -0.01400000 Waves 2019.09.08 13:33 [666983] smart account 3MqRnEd83AoPWjTCHP2PVpFpWg6KbBPCJyo > SELF 0.00000000 Waves
{ "type": 13, "id": "5L2fQNfSJEhqxsAzrgJsZ9vuGjZrC91prVAK1ad2K3SR", "fee": 1400000, "feeAssetId": null, "timestamp": 1567938788083, "version": 1, "sender": "3MqRnEd83AoPWjTCHP2PVpFpWg6KbBPCJyo", "senderPublicKey": "C1VF5w6S6GzcSydWsAbL2czedDrjFAPUeyZ5HknvisxJ", "proofs": [ "4dVuGPdaHfnz5UPya5ZGnnS5zbMCXXJCsjFhzgPhhA8P55pH47E8UuHWWxVHwPLdRifZQaMSUGxj51M23wnSiepF" ], "script": "base64:AAIDAAAAAAAAAAAAAAAEAAAAAAxhbnN3ZXJzQ291bnQAAAAAAAAAABQAAAAAB2Fuc3dlcnMJAARMAAAAAgIAAAAOSXQgaXMgY2VydGFpbi4JAARMAAAAAgIAAAATSXQgaXMgZGVjaWRlZGx5IHNvLgkABEwAAAACAgAAABBXaXRob3V0IGEgZG91YnQuCQAETAAAAAICAAAAEVllcyAtIGRlZmluaXRlbHkuCQAETAAAAAICAAAAE1lvdSBtYXkgcmVseSBvbiBpdC4JAARMAAAAAgIAAAARQXMgSSBzZWUgaXQsIHllcy4JAARMAAAAAgIAAAAMTW9zdCBsaWtlbHkuCQAETAAAAAICAAAADU91dGxvb2sgZ29vZC4JAARMAAAAAgIAAAAEWWVzLgkABEwAAAACAgAAABNTaWducyBwb2ludCB0byB5ZXMuCQAETAAAAAICAAAAFlJlcGx5IGhhenksIHRyeSBhZ2Fpbi4JAARMAAAAAgIAAAAQQXNrIGFnYWluIGxhdGVyLgkABEwAAAACAgAAABhCZXR0ZXIgbm90IHRlbGwgeW91IG5vdy4JAARMAAAAAgIAAAATQ2Fubm90IHByZWRpY3Qgb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AAAAAl2gfA=", "chainId": 84, "height": 666983, "spentComplexity": 0 } View: original | compacted Prev: 7z4zSapJwY8GNTsruAyouWru4XjvgP39JJb3QByfUCCN Next: GtAaXNMZkU6Rsh7SrjCkeXz6Gnm7t1SetcAgSjW9QTPx Diff:
Old | New | Differences | |
---|---|---|---|
21 | 21 | ||
22 | 22 | ||
23 | 23 | @Callable(i) | |
24 | - | func tellme ( | |
24 | + | func tellme () = { | |
25 | 25 | let callerAddress = toBase58String(i.caller.bytes) | |
26 | - | let answer = getAnswer(question, getPreviousAnswer(callerAddress)) | |
27 | 26 | let myadr = addressFromStringValue("3NAcoeWdUTWn8csXJPG47v1Fjtjcfqxb5tu") | |
28 | 27 | let correctPrice = match getInteger(myadr, "waves_btc_8") { | |
29 | 28 | case a: Int => | |
31 | 30 | case _ => | |
32 | 31 | 0 | |
33 | 32 | } | |
34 | - | WriteSet([ | |
33 | + | WriteSet([DataEntry((callerAddress + "_cp"), correctPrice)]) | |
35 | 34 | } | |
36 | 35 | ||
37 | 36 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let answersCount = 20 | |
5 | 5 | ||
6 | 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 | 7 | ||
8 | 8 | func getAnswer (question,previousAnswer) = { | |
9 | 9 | let hash = sha256(toBytes((question + previousAnswer))) | |
10 | 10 | let index = toInt(hash) | |
11 | 11 | answers[(index % answersCount)] | |
12 | 12 | } | |
13 | 13 | ||
14 | 14 | ||
15 | 15 | func getPreviousAnswer (address) = match getString(this, (address + "_a")) { | |
16 | 16 | case a: String => | |
17 | 17 | a | |
18 | 18 | case _ => | |
19 | 19 | address | |
20 | 20 | } | |
21 | 21 | ||
22 | 22 | ||
23 | 23 | @Callable(i) | |
24 | - | func tellme ( | |
24 | + | func tellme () = { | |
25 | 25 | let callerAddress = toBase58String(i.caller.bytes) | |
26 | - | let answer = getAnswer(question, getPreviousAnswer(callerAddress)) | |
27 | 26 | let myadr = addressFromStringValue("3NAcoeWdUTWn8csXJPG47v1Fjtjcfqxb5tu") | |
28 | 27 | let correctPrice = match getInteger(myadr, "waves_btc_8") { | |
29 | 28 | case a: Int => | |
30 | 29 | a | |
31 | 30 | case _ => | |
32 | 31 | 0 | |
33 | 32 | } | |
34 | - | WriteSet([ | |
33 | + | WriteSet([DataEntry((callerAddress + "_cp"), correctPrice)]) | |
35 | 34 | } | |
36 | 35 | ||
37 | 36 | ||
38 | 37 | ||
39 | 38 | @Callable(i) | |
40 | 39 | func deposit () = { | |
41 | 40 | let pmt = extract(i.payment) | |
42 | 41 | if (isDefined(pmt.assetId)) | |
43 | 42 | then throw("can hodl waves only at the moment") | |
44 | 43 | else { | |
45 | 44 | let currentKey = toBase58String(i.caller.bytes) | |
46 | 45 | let currentAmount = match getInteger(this, currentKey) { | |
47 | 46 | case a: Int => | |
48 | 47 | a | |
49 | 48 | case _ => | |
50 | 49 | 0 | |
51 | 50 | } | |
52 | 51 | let myadr = addressFromStringValue("3NAcoeWdUTWn8csXJPG47v1Fjtjcfqxb5tu") | |
53 | 52 | let correctPrice = match getInteger(myadr, "waves_btc_8") { | |
54 | 53 | case a: Int => | |
55 | 54 | a | |
56 | 55 | case _ => | |
57 | 56 | 0 | |
58 | 57 | } | |
59 | 58 | let newAmount = (currentAmount + pmt.amount) | |
60 | 59 | WriteSet([DataEntry(currentKey, newAmount)]) | |
61 | 60 | } | |
62 | 61 | } | |
63 | 62 | ||
64 | 63 |
github/deemru/w8io/169f3d6 40.25 ms ◑