1 | | - | {-# STDLIB_VERSION 5 #-} |
---|
2 | | - | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | | - | {-# CONTENT_TYPE DAPP #-} |
---|
4 | | - | let a = base58'ET8t5TozeUrUQfMzLzVeHTVo2vmiEeu2apj3AN6zwzsG' |
---|
5 | | - | |
---|
6 | | - | let b = base58'2nGfqMHdunJuX8jYzruMKz1e1vMNrhJtWMjHizRhB8Fk' |
---|
7 | | - | |
---|
8 | | - | let c = false |
---|
9 | | - | |
---|
10 | | - | @Callable(d) |
---|
11 | | - | func stake () = { |
---|
12 | | - | let e = value(d.payments[0]) |
---|
13 | | - | let f = e.amount |
---|
14 | | - | if ((e.assetId != a)) |
---|
15 | | - | then throw("attach testNSBT tokens only") |
---|
16 | | - | else if (c) |
---|
17 | | - | then throw("smart contract is on lock") |
---|
18 | | - | else { |
---|
19 | | - | let g = assetBalance(this, a) |
---|
20 | | - | let h = { |
---|
21 | | - | let i = assetInfo(b) |
---|
22 | | - | if ($isInstanceOf(i, "Asset")) |
---|
23 | | - | then { |
---|
24 | | - | let j = i |
---|
25 | | - | j.quantity |
---|
26 | | - | } |
---|
27 | | - | else throw("Can't find asset") |
---|
28 | | - | } |
---|
29 | | - | let k = ((h * 100000000) / (g - f)) |
---|
30 | | - | let l = ((f * k) / 100000000) |
---|
31 | | - | let m = Reissue(b, l, true) |
---|
32 | | - | let n = ScriptTransfer(d.caller, l, b) |
---|
33 | | - | [m, n] |
---|
34 | | - | } |
---|
35 | | - | } |
---|
36 | | - | |
---|
37 | | - | |
---|
38 | | - | |
---|
39 | | - | @Callable(d) |
---|
40 | | - | func withdraw (o) = { |
---|
41 | | - | let p = d.payments[0] |
---|
42 | | - | let q = d.payments[0].assetId |
---|
43 | | - | if ((q != b)) |
---|
44 | | - | then throw("Attach the correct LP token") |
---|
45 | | - | else { |
---|
46 | | - | let r = (p.amount - o) |
---|
47 | | - | if ((0 > o)) |
---|
48 | | - | then throw("Can't withdraw negative amount") |
---|
49 | | - | else if ((0 > r)) |
---|
50 | | - | then throw("Not enough balance") |
---|
51 | | - | else { |
---|
52 | | - | let s = Burn(b, o) |
---|
53 | | - | let n = ScriptTransfer(d.caller, r, a) |
---|
54 | | - | [s, n] |
---|
55 | | - | } |
---|
56 | | - | } |
---|
57 | | - | } |
---|
58 | | - | |
---|
59 | | - | |
---|
60 | | - | @Verifier(t) |
---|
61 | | - | func u () = sigVerify(t.bodyBytes, t.proofs[0], t.senderPublicKey) |
---|
62 | | - | |
---|
| 1 | + | # no script |
---|