tx · GRhoZrFn7UeBasXSDqY4KCPH1YXix5VkyUC5QmvjSFje 3NByvCG2T14xJ3bfRNpKCns37ehfBSTGja3: -0.01000000 Waves 2019.07.28 16:37 [605990] smart account 3NByvCG2T14xJ3bfRNpKCns37ehfBSTGja3 > SELF 0.00000000 Waves
{ "type": 13, "id": "GRhoZrFn7UeBasXSDqY4KCPH1YXix5VkyUC5QmvjSFje", "fee": 1000000, "feeAssetId": null, "timestamp": 1564321106374, "version": 1, "sender": "3NByvCG2T14xJ3bfRNpKCns37ehfBSTGja3", "senderPublicKey": "5ADSy4csCWyBrq24UKNhxf9g1q3ntYJ1JJC7582a5sF1", "proofs": [ "2dbgRk2Tz4crfLZgJDFC8Gzb2Cq2PxahT6tmYiRBzBcC9GJQzLb4iN7ByEA4Qfhd4Bm9P1PybJwbXTxXTfA9NHLD" ], "script": "base64:AAIDAAAAAAAAAAAAAAADAAAAAARzYWx0AgAAAARzYWx0AAAAAAZyZWJhaXQAAAAAAAAJJ8ABAAAAEmdldEludGVyZ2VyRGVmYXVsdAAAAAIAAAADa2V5AAAAB2RlZmF1bHQEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEFAAAAB2RlZmF1bHQAAAADAAAAAWkBAAAAB3Nwb25zb3IAAAABAAAADm9yYWNsZUFkZGRyZXNzBAAAAANrZXkJAAEsAAAAAgIAAAAKc3BvbnNvcmVkXwUAAAAOb3JhY2xlQWRkZHJlc3MEAAAAB3BheW1lbnQJAQAAAAdleHRyYWN0AAAAAQgFAAAAAWkAAAAHcGF5bWVudAMJAQAAAAIhPQAAAAIIBQAAAAdwYXltZW50AAAAB2Fzc2V0SWQFAAAABHVuaXQJAAACAAAAAQIAAAAcc3BvbnNvcnNoaXAgbXVzdCBiZSBpbiBXQVZFUwQAAAAIbmV3VmFsdWUJAABkAAAAAggFAAA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AAADqMHDS", "chainId": 84, "height": 605990, "spentComplexity": 0 } View: original | compacted Prev: none Next: RY88okCaxByZC5JUKqdTs3dgPNVevxSEoQjtrDafoXk Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let salt = "salt" | |
5 | + | ||
6 | + | let rebait = 600000 | |
7 | + | ||
8 | + | func getIntergerDefault (key,default) = match getInteger(this, key) { | |
9 | + | case a: Int => | |
10 | + | a | |
11 | + | case _ => | |
12 | + | default | |
13 | + | } | |
14 | + | ||
15 | + | ||
16 | + | @Callable(i) | |
17 | + | func sponsor (oracleAdddress) = { | |
18 | + | let key = ("sponsored_" + oracleAdddress) | |
19 | + | let payment = extract(i.payment) | |
20 | + | if ((payment.assetId != unit)) | |
21 | + | then throw("sponsorship must be in WAVES") | |
22 | + | else { | |
23 | + | let newValue = (payment.amount + getIntergerDefault(key, 0)) | |
24 | + | WriteSet([DataEntry(key, newValue)]) | |
25 | + | } | |
26 | + | } | |
27 | + | ||
28 | + | ||
29 | + | ||
30 | + | @Callable(i) | |
31 | + | func commit (commit) = { | |
32 | + | let caller = toBase58String(i.caller.bytes) | |
33 | + | let commitKey = ((("commit_" + caller) + "_") + toString(height)) | |
34 | + | if (isDefined(getString(this, commitKey))) | |
35 | + | then throw("commit already done") | |
36 | + | else WriteSet([DataEntry(commitKey, commit)]) | |
37 | + | } | |
38 | + | ||
39 | + | ||
40 | + | ||
41 | + | @Callable(i) | |
42 | + | func reveal (revealHeight,random) = if ((extract(parseInt(revealHeight)) >= height)) | |
43 | + | then throw("reveal must be in the past blocks after commit") | |
44 | + | else { | |
45 | + | let caller = toBase58String(i.caller.bytes) | |
46 | + | let commit = extract(getString(this, ((("commit_" + caller) + "_") + revealHeight))) | |
47 | + | let correctCommit = toBase16String(sha256(toBytes((random + salt)))) | |
48 | + | if ((commit != correctCommit)) | |
49 | + | then throw("invalid reveal") | |
50 | + | else { | |
51 | + | let revealKey = ((("reveal_" + caller) + "_") + revealHeight) | |
52 | + | if (isDefined(getString(this, revealKey))) | |
53 | + | then throw("reveal already in blockchain") | |
54 | + | else { | |
55 | + | let sponsorKey = ("sponsored_" + caller) | |
56 | + | let sponsoredAmount = getIntergerDefault(sponsorKey, 0) | |
57 | + | if ((sponsoredAmount >= rebait)) | |
58 | + | then ScriptResult(WriteSet([DataEntry(sponsorKey, (sponsoredAmount - rebait)), DataEntry(revealKey, random)]), TransferSet([ScriptTransfer(i.caller, rebait, unit)])) | |
59 | + | else WriteSet([DataEntry(revealKey, random)]) | |
60 | + | } | |
61 | + | } | |
62 | + | } | |
63 | + | ||
64 | + |
github/deemru/w8io/169f3d6 14.63 ms ◑