tx · EAbvhZKuu8UjHqhRAoLr47ttcYmMHRqXDn4bYvoS63YV 3ND8WogVWB75u56huNDjLxm7tNqAj1pbB5W: -0.01000000 Waves 2022.11.05 18:36 [2303995] smart account 3ND8WogVWB75u56huNDjLxm7tNqAj1pbB5W > SELF 0.00000000 Waves
{ "type": 13, "id": "EAbvhZKuu8UjHqhRAoLr47ttcYmMHRqXDn4bYvoS63YV", "fee": 1000000, "feeAssetId": null, "timestamp": 1667662606947, "version": 2, "chainId": 84, "sender": "3ND8WogVWB75u56huNDjLxm7tNqAj1pbB5W", "senderPublicKey": "BnSNSWnbk9bwniqubAETucmcH3Wy96Ar9X5Vrnxpjw6e", "proofs": [ "zoq7FrJUXst6keeLaPFsWhQWMM3LNXCT69FjzRM5V8LEaDfiTkPD8ywm1ZVqxoCQ7kQSKcHRXmQSkSnr9nbZHY7" ], "script": "base64:AAIFAAAAAAAAABAIAhIDCgEIEgMKAQgSABIAAAAABQAAAAAJcHJlY2lzaW9uAAAAAAJUC+QAAQAAABNrZXlNYW5hZ2VyUHVibGljS2V5AAAAAAkABCIAAAABAgAAABBtYW5hZ2VyUHVibGljS2V5AQAAABZtYW5hZ2VyUHVibGljS2V5T3JVbml0AAAAAAQAAAAHJG1hdGNoMAkBAAAAE2tleU1hbmFnZXJQdWJsaWNLZXkAAAAAAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAXMFAAAAByRtYXRjaDAJAAJZAAAAAQUAAAABcwMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAEVW5pdAUAAAAEdW5pdAkAAAIAAAABAgAAAAtNYXRjaCBlcnJvcgEAAAALbXVzdE1hbmFnZXIAAAABAAAAAWkEAAAAAnBkCQAAAgAAAAECAAAAEXBlcm1pc3Npb24gZGVuaWVkBAAAAAckbWF0Y2gwCQEAAAAWbWFuYWdlclB1YmxpY0tleU9yVW5pdAAAAAADCQAAAQAAAAIFAAAAByRtYXRjaDACAAAACkJ5dGVWZWN0b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AAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleW43NWQ=", "height": 2303995, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: GVxe7LcgJWtZPMz6NGkUTb4GaLGmQAL7RX8vEwmg8k5V Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let precision = 10000000000 | |
5 | + | ||
6 | + | func keyManagerPublicKey () = getString("managerPublicKey") | |
7 | + | ||
8 | + | ||
9 | + | func managerPublicKeyOrUnit () = match keyManagerPublicKey() { | |
10 | + | case s: String => | |
11 | + | fromBase58String(s) | |
12 | + | case _: Unit => | |
13 | + | unit | |
14 | + | case _ => | |
15 | + | throw("Match error") | |
16 | + | } | |
17 | + | ||
18 | + | ||
19 | + | func mustManager (i) = { | |
20 | + | let pd = throw("permission denied") | |
21 | + | match managerPublicKeyOrUnit() { | |
22 | + | case pk: ByteVector => | |
23 | + | if ((i.callerPublicKey == pk)) | |
24 | + | then true | |
25 | + | else pd | |
26 | + | case _: Unit => | |
27 | + | if ((i.caller == this)) | |
28 | + | then true | |
29 | + | else pd | |
30 | + | case _ => | |
31 | + | throw("Match error") | |
32 | + | } | |
33 | + | } | |
34 | + | ||
35 | + | ||
36 | + | func mustNotInited () = match getBoolean("inited") { | |
37 | + | case inited: Boolean => | |
38 | + | if ((inited == false)) | |
39 | + | then true | |
40 | + | else throw("Already inited") | |
41 | + | case _: Unit => | |
42 | + | false | |
43 | + | case _ => | |
44 | + | throw("Match error") | |
45 | + | } | |
46 | + | ||
47 | + | ||
48 | + | @Callable(i) | |
49 | + | func debug (leaserAddress) = [StringEntry("leaserAddress", leaserAddress)] | |
50 | + | ||
51 | + | ||
52 | + | ||
53 | + | @Callable(i) | |
54 | + | func init (leaserAddress) = { | |
55 | + | let check = mustManager(i) | |
56 | + | if ((check == check)) | |
57 | + | then { | |
58 | + | let inited = mustNotInited() | |
59 | + | if ((inited == inited)) | |
60 | + | then { | |
61 | + | let sWaves = Issue("sWaves", "", 0, 8, true, unit, 0) | |
62 | + | let sWavesAssetId = calculateAssetId(sWaves) | |
63 | + | [BooleanEntry("inited", true), StringEntry("sWavesAssetId", toBase58String(sWavesAssetId)), StringEntry("leaserAddress", leaserAddress), IntegerEntry("ratio", precision), sWaves] | |
64 | + | } | |
65 | + | else throw("Strict value is not equal to itself.") | |
66 | + | } | |
67 | + | else throw("Strict value is not equal to itself.") | |
68 | + | } | |
69 | + | ||
70 | + | ||
71 | + | ||
72 | + | @Callable(i) | |
73 | + | func stake () = { | |
74 | + | let payment = i.payments[0] | |
75 | + | if ((payment.assetId != unit)) | |
76 | + | then throw("Only WAVES supported") | |
77 | + | else if ((size(i.payments) != 1)) | |
78 | + | then throw("Wrong payments amount") | |
79 | + | else { | |
80 | + | let ratio = getIntegerValue("ratio") | |
81 | + | let toReissue = fraction(payment.amount, precision, ratio) | |
82 | + | let sWavesAssetId = fromBase58String(getStringValue("sWavesAssetId")) | |
83 | + | [Reissue(sWavesAssetId, toReissue, true), ScriptTransfer(i.caller, toReissue, sWavesAssetId)] | |
84 | + | } | |
85 | + | } | |
86 | + | ||
87 | + | ||
88 | + | ||
89 | + | @Callable(i) | |
90 | + | func unstake () = { | |
91 | + | let payment = i.payments[0] | |
92 | + | let sWavesAssetId = fromBase58String(getStringValue("sWavesAssetId")) | |
93 | + | if ((payment.assetId != sWavesAssetId)) | |
94 | + | then throw("Only sWAVES suppoerted") | |
95 | + | else if ((size(i.payments) != 1)) | |
96 | + | then throw("Wrong payments amount") | |
97 | + | else { | |
98 | + | let ratio = getIntegerValue("ratio") | |
99 | + | let toTransfer = fraction(payment.amount, ratio, precision) | |
100 | + | let assetId = getStringValue("internalAssetId") | |
101 | + | [Burn(sWavesAssetId, payment.amount), ScriptTransfer(i.caller, toTransfer, unit)] | |
102 | + | } | |
103 | + | } | |
104 | + | ||
105 | + | ||
106 | + | @Verifier(tx) | |
107 | + | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
108 | + |
github/deemru/w8io/026f985 24.21 ms ◑