tx · 5q2uHhyUo3db3yprrkoeKnrfNFvbNodv1wPBrzq33FeB 3N1JYSyNP7mn7f1YTZ2aRdi6ThpKw23j9Sy: -0.01000000 Waves 2022.11.05 20:58 [2304135] smart account 3N1JYSyNP7mn7f1YTZ2aRdi6ThpKw23j9Sy > SELF 0.00000000 Waves
{ "type": 13, "id": "5q2uHhyUo3db3yprrkoeKnrfNFvbNodv1wPBrzq33FeB", "fee": 1000000, "feeAssetId": null, "timestamp": 1667671109514, "version": 2, "chainId": 84, "sender": "3N1JYSyNP7mn7f1YTZ2aRdi6ThpKw23j9Sy", "senderPublicKey": "65hdh3BQVcB4NhB1URp1RBWMK7AWDhrCSVjwbFjS64jo", "proofs": [ "3sSfxFHNRC3wrAe31YMjRGMJyg33UxheNeVomWpoukTpwhdMdqRJxvUvoUjcTokWYq23A6zSfwFdDWQDFz9vkUqF" ], "script": "base64:AAIFAAAAAAAAAAsIAhIDCgEIEgASAAAAAAUAAAAACXByZWNpc2lvbgAN4Lazp2QAAAEAAAATa2V5TWFuYWdlclB1YmxpY0tleQAAAAAJAAQiAAAAAQIAAAAQbWFuYWdlclB1YmxpY0tleQEAAAAWbWFuYWdlclB1YmxpY0tleU9yVW5pdAAAAAAEAAAAByRtYXRjaDAJAQAAABNrZXlNYW5hZ2VyUHVibGljS2V5AAAAAAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFzBQAAAAckbWF0Y2gwCQACWQAAAAEFAAAAAXMDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABFVuaXQFAAAABHVuaXQJAAACAAAAAQIAAAALTWF0Y2ggZXJyb3IBAAAAC211c3RNYW5hZ2VyAAAAAQAAAAFpBAAAAAJwZAkAAAIAAAABAgAAABFwZXJtaXNzaW9uIGRlbmllZAQAAAAHJG1hdGNoMAkBAAAAFm1hbmFnZXJQdWJsaWNLZXlPclVuaXQAAAAAAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAApCeXRlVmVjdG9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dBbW91bnQFAAAAA25pbAkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABAgAAAAdsZWFzZUlkBQAAAANuaWwEAAAAB3Jlc3VsdHMJAARMAAAAAgkBAAAAC0xlYXNlQ2FuY2VsAAAAAQUAAAAHbGVhc2VJZAkABEwAAAACCQEAAAAEQnVybgAAAAIFAAAADXNXYXZlc0Fzc2V0SWQIBQAAAAdwYXltZW50AAAABmFtb3VudAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAACnRvVHJhbnNmZXIFAAAABHVuaXQFAAAAA25pbAkABE4AAAACBQAAAAdyZXN1bHRzBQAAAAxsZWFzZVJlc3VsdHMAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tlea/QT5A=", "height": 2304135, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: 7GwfEHQ37WfsNB7QZi1QFpLFnvB4RrC7fekWsta2BZ6s Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let a = 1000000000000000000 | |
5 | + | ||
6 | + | func b () = getString("managerPublicKey") | |
7 | + | ||
8 | + | ||
9 | + | func c () = { | |
10 | + | let d = b() | |
11 | + | if ($isInstanceOf(d, "String")) | |
12 | + | then { | |
13 | + | let e = d | |
14 | + | fromBase58String(e) | |
15 | + | } | |
16 | + | else if ($isInstanceOf(d, "Unit")) | |
17 | + | then unit | |
18 | + | else throw("Match error") | |
19 | + | } | |
20 | + | ||
21 | + | ||
22 | + | func f (g) = { | |
23 | + | let h = throw("permission denied") | |
24 | + | let d = c() | |
25 | + | if ($isInstanceOf(d, "ByteVector")) | |
26 | + | then { | |
27 | + | let i = d | |
28 | + | if ((g.callerPublicKey == i)) | |
29 | + | then true | |
30 | + | else h | |
31 | + | } | |
32 | + | else if ($isInstanceOf(d, "Unit")) | |
33 | + | then if ((g.caller == this)) | |
34 | + | then true | |
35 | + | else h | |
36 | + | else throw("Match error") | |
37 | + | } | |
38 | + | ||
39 | + | ||
40 | + | func j () = { | |
41 | + | let d = getBoolean("inited") | |
42 | + | if ($isInstanceOf(d, "Boolean")) | |
43 | + | then { | |
44 | + | let k = d | |
45 | + | if ((k == false)) | |
46 | + | then true | |
47 | + | else throw("Already inited") | |
48 | + | } | |
49 | + | else if ($isInstanceOf(d, "Unit")) | |
50 | + | then false | |
51 | + | else throw("Match error") | |
52 | + | } | |
53 | + | ||
54 | + | ||
55 | + | @Callable(g) | |
56 | + | func init (l) = { | |
57 | + | let m = [f(g), j()] | |
58 | + | if ((m == m)) | |
59 | + | then { | |
60 | + | let n = Issue("sWaves", "", 0, 8, true, unit, 0) | |
61 | + | let o = calculateAssetId(n) | |
62 | + | [BooleanEntry("inited", true), StringEntry("sWavesAssetId", toBase58String(o)), StringEntry("leaserAddress", l), IntegerEntry("ratio", a), IntegerEntry("leasedAmount", 0), n] | |
63 | + | } | |
64 | + | else throw("Strict value is not equal to itself.") | |
65 | + | } | |
66 | + | ||
67 | + | ||
68 | + | ||
69 | + | @Callable(g) | |
70 | + | func stake () = { | |
71 | + | let p = g.payments[0] | |
72 | + | if ((p.assetId != unit)) | |
73 | + | then throw("Only WAVES supported") | |
74 | + | else if ((size(g.payments) != 1)) | |
75 | + | then throw("Wrong payments amount") | |
76 | + | else { | |
77 | + | let q = getIntegerValue("ratio") | |
78 | + | let r = fraction(p.amount, a, q) | |
79 | + | let o = fromBase58String(getStringValue("sWavesAssetId")) | |
80 | + | let s = getIntegerValue("leasedAmount") | |
81 | + | let t = (s + p.amount) | |
82 | + | let l = Address(fromBase58String(getStringValue("leaserAddress"))) | |
83 | + | let u = Lease(l, t) | |
84 | + | let v = calculateLeaseId(u) | |
85 | + | let w = [BinaryEntry("leaseId", v), u, IntegerEntry("leasedAmount", t), Reissue(o, r, true), ScriptTransfer(g.caller, r, o)] | |
86 | + | let d = getBinary("leaseId") | |
87 | + | if ($isInstanceOf(d, "ByteVector")) | |
88 | + | then { | |
89 | + | let x = d | |
90 | + | LeaseCancel(x) :: w | |
91 | + | } | |
92 | + | else if ($isInstanceOf(d, "Unit")) | |
93 | + | then w | |
94 | + | else throw("Match error") | |
95 | + | } | |
96 | + | } | |
97 | + | ||
98 | + | ||
99 | + | ||
100 | + | @Callable(g) | |
101 | + | func unstake () = { | |
102 | + | let p = g.payments[0] | |
103 | + | let o = fromBase58String(getStringValue("sWavesAssetId")) | |
104 | + | if ((p.assetId != o)) | |
105 | + | then throw("Only sWAVES supported") | |
106 | + | else if ((size(g.payments) != 1)) | |
107 | + | then throw("Wrong payments amount") | |
108 | + | else { | |
109 | + | let q = getIntegerValue("ratio") | |
110 | + | let y = fraction(p.amount, q, a) | |
111 | + | let z = getStringValue("internalAssetId") | |
112 | + | let s = getIntegerValue("leasedAmount") | |
113 | + | let t = (s - y) | |
114 | + | let x = getBinaryValue("leaseId") | |
115 | + | let A = if ((t > 0)) | |
116 | + | then { | |
117 | + | let l = Address(fromBase58String(getStringValue("leaserAddress"))) | |
118 | + | let u = Lease(l, t) | |
119 | + | let v = calculateLeaseId(u) | |
120 | + | [u, BinaryEntry("leaseId", v), IntegerEntry("leasedAmount", t)] | |
121 | + | } | |
122 | + | else [DeleteEntry("leaseId")] | |
123 | + | let w = [LeaseCancel(x), Burn(o, p.amount), ScriptTransfer(g.caller, y, unit)] | |
124 | + | (w ++ A) | |
125 | + | } | |
126 | + | } | |
127 | + | ||
128 | + | ||
129 | + | @Verifier(B) | |
130 | + | func C () = sigVerify(B.bodyBytes, B.proofs[0], B.senderPublicKey) | |
131 | + |
github/deemru/w8io/03bedc9 30.12 ms ◑![]()