tx · FuKAqhWzSzR6W2kR1YWywd3kcH9SiKqzCZVY8jF2bqap 3N5JsQHh6GJBT7gCj8pKKGhfmdVbHUUE7Ra: -0.01400000 Waves 2021.07.22 20:34 [1625157] smart account 3N5JsQHh6GJBT7gCj8pKKGhfmdVbHUUE7Ra > SELF 0.00000000 Waves
{ "type": 13, "id": "FuKAqhWzSzR6W2kR1YWywd3kcH9SiKqzCZVY8jF2bqap", "fee": 1400000, "feeAssetId": null, "timestamp": 1626975092009, "version": 2, "chainId": 84, "sender": "3N5JsQHh6GJBT7gCj8pKKGhfmdVbHUUE7Ra", "senderPublicKey": "6hg3zCfLeDbfSrz2QVG7hdax7eXSpabUDqSP1ya8PBVZ", "proofs": [ "4R3oRPfkC6fzJim2VQGJEoHLt7XLBqGtu6Q4rfjqGwS1naWWQjPKJxt86wWhtc5sj8s1SPH8K9HTZuwoQpurbYEQ" ], "script": "base64:AAIFAAAAAAAAAAcIAhIDCgEBAAAACgAAAAAOZ292ZXJuYW5jZUFkZHIJAQAAAAdBZGRyZXNzAAAAAQEAAAAAAAAAAAtzZXJ2aWNlQWRkcgkBAAAAB0FkZHJlc3MAAAABAQAAAAAAAAAAD2tleUxhc3RJbnRlcmVzdAIAAAANbGFzdF9pbnRlcmVzdAAAAAARa2V5VXNlclNXT1BMb2NrZWQCAAAADF9TV09QX2Ftb3VudAAAAAATa2V5VXNlckxhc3RJbnRlcmVzdAIAAAAOX2xhc3RfaW50ZXJlc3QAAAAACnNjYWxlVmFsdWUAAAAAAAX14QABAAAAE2dldExhc3RJbnRlcmVzdEluZm8AAAAABAAAAAxsYXN0SW50ZXJlc3QJAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAAQaAAAAAgUAAAAOZ292ZXJuYW5jZUFkZHIFAAAAD2tleUxhc3RJbnRlcmVzdAAAAAAAAAAAAAUAAAAMbGFzdEludGVyZXN0AQAAABFnZXRVc2VyU1dPUExvY2tlZAAAAAEAAAAEdXNlcgkBAAAAC3ZhbHVlT3JFb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QAAAApzY2FsZVZhbHVlBAAAAA91c2VyTmV3SW50ZXJlc3QFAAAADGxhc3RJbnRlcmVzdAkABRQAAAACBQAAAA91c2VyTmV3SW50ZXJlc3QFAAAAC2NsYWltQW1vdW50AAAAAQAAAAFpAQAAABFyZXN0YWtlR292ZXJuYW5jZQAAAAEAAAANbWluU1dPUHJld2FyZAMJAQAAAAIhPQAAAAIIBQAAAAFpAAAABmNhbGxlcgUAAAALc2VydmljZUFkZHIJAAACAAAAAQIAAAAxT25seSBzdGFraW5nIHNlcnZpY2UgaXMgYWxsb3dlZCB0byBjYWxsIHRoaXMgZnVuYwQAAAALY2xhaW1BbW91bnQICQEAAAAJY2xhaW1DYWxjAAAAAQUAAAAEdGhpcwAAAAJfMgMJAABmAAAAAgUAAAANbWluU1dPUHJld2FyZAUAAAALY2xhaW1BbW91bnQJAAACAAAAAQIAAAAqQW1vdW50IHRvIGNsYWltIGlzIGxlc3MgdGhhbiBtaW5TV09QcmV3YXJkBAAAAAF6CQAD/AAAAAQFAAAADmdvdmVybmFuY2VBZGRyAgAAABFjbGFpbUFuZFN0YWtlU1dPUAUAAAADbmlsBQAAAANuaWwDCQAAAAAAAAIFAAAAAXoFAAAAAXoFAAAAA25pbAkAAAIAAAABAgAAACRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4AAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tlecbFJzg=", "height": 1625157, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BLMP5ftxN92eJxKwSMCwNBp8oaY1Pd5Bairfs5X7KcF9 Next: 62sxiBmiAEbo46GqRg9LN6tzRexgNSXc8UZi3zkNMKSQ Diff:
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let a = | |
4 | + | let a = Address(base58'') | |
5 | 5 | ||
6 | - | let b = | |
6 | + | let b = Address(base58'') | |
7 | 7 | ||
8 | - | let c = "_ | |
8 | + | let c = "last_interest" | |
9 | 9 | ||
10 | - | let d = "_ | |
10 | + | let d = "_SWOP_amount" | |
11 | 11 | ||
12 | - | let e = "_ | |
12 | + | let e = "_last_interest" | |
13 | 13 | ||
14 | - | let f = | |
14 | + | let f = 100000000 | |
15 | 15 | ||
16 | - | let g = "_close_tx_id" | |
17 | - | ||
18 | - | let h = "Active" | |
19 | - | ||
20 | - | let i = "Canceled" | |
21 | - | ||
22 | - | let j = "Done" | |
23 | - | ||
24 | - | @Callable(k) | |
25 | - | func placeProposal (l,m) = { | |
26 | - | let n = $Tuple2(k.payments[0].amount, toBase58String(value(k.payments[0].assetId))) | |
27 | - | let o = n._1 | |
28 | - | let p = n._2 | |
29 | - | let q = toBase58String(k.transactionId) | |
30 | - | [StringEntry((q + f), toString(k.caller)), StringEntry((q + a), p), IntegerEntry((q + b), o), StringEntry((q + c), l), IntegerEntry((q + d), m), StringEntry((q + e), h)] | |
16 | + | func g () = { | |
17 | + | let h = valueOrElse(getInteger(a, c), 0) | |
18 | + | h | |
31 | 19 | } | |
32 | 20 | ||
33 | 21 | ||
22 | + | func i (j) = valueOrElse(getInteger(a, (toString(j) + d)), 0) | |
34 | 23 | ||
35 | - | @Callable(k) | |
36 | - | func cancelProposal (q) = { | |
37 | - | let r = valueOrErrorMessage(getString(this, (q + e)), (("Proposal with id '" + q) + "' not found")) | |
38 | - | if ((r != h)) | |
39 | - | then throw(((("Proposal with id '" + q) + "' is not active. Status: ") + r)) | |
40 | - | else { | |
41 | - | let s = addressFromStringValue(valueOrErrorMessage(getString(this, (q + f)), "owner not set")) | |
42 | - | let t = valueOrErrorMessage(getString(this, (q + a)), "Proposed asset not found") | |
43 | - | let u = valueOrErrorMessage(getInteger(this, (q + b)), "Proposed amount not found") | |
44 | - | if ((k.caller != s)) | |
45 | - | then throw("Only owner can cancel") | |
46 | - | else [ScriptTransfer(s, u, fromBase58String(t)), StringEntry((q + e), i), StringEntry((q + g), toBase58String(k.transactionId))] | |
47 | - | } | |
24 | + | ||
25 | + | func k (j,h) = { | |
26 | + | let l = i(j) | |
27 | + | let m = getInteger(a, (toString(j) + e)) | |
28 | + | let n = { | |
29 | + | let o = m | |
30 | + | if ($isInstanceOf(o, "Int")) | |
31 | + | then { | |
32 | + | let m = o | |
33 | + | m | |
34 | + | } | |
35 | + | else h | |
36 | + | } | |
37 | + | $Tuple2(n, l) | |
48 | 38 | } | |
49 | 39 | ||
50 | 40 | ||
41 | + | func p (q) = { | |
42 | + | let h = g() | |
43 | + | let r = k(q, h) | |
44 | + | let m = r._1 | |
45 | + | let s = r._2 | |
46 | + | let t = fraction(s, (h - m), f) | |
47 | + | let u = h | |
48 | + | $Tuple2(u, t) | |
49 | + | } | |
51 | 50 | ||
52 | - | @Callable(k) | |
53 | - | func acceptProposal (q) = { | |
54 | - | let v = $Tuple2(k.payments[0].amount, value(k.payments[0].assetId)) | |
55 | - | let o = v._1 | |
56 | - | let p = v._2 | |
57 | - | let r = valueOrErrorMessage(getString(this, (q + e)), (("Proposal with id '" + q) + "' not found")) | |
58 | - | if ((r != h)) | |
59 | - | then throw(((("Proposal with id '" + q) + "' is not active. Status: ") + r)) | |
60 | - | else { | |
61 | - | let w = valueOrErrorMessage(fromBase58String(valueOrErrorMessage(getString(this, (q + c)), "Desired asset not found")), "Incorrect desired asset id") | |
62 | - | let x = valueOrErrorMessage(getInteger(this, (q + d)), "Desired amount not found") | |
63 | - | if ((w != p)) | |
64 | - | then throw("Atatched asset doesn't match desired") | |
65 | - | else if ((x != o)) | |
66 | - | then throw("Attached asset amount doesn't match") | |
67 | - | else { | |
68 | - | let s = addressFromStringValue(valueOrErrorMessage(getString(this, (q + f)), "owner not set")) | |
69 | - | let t = valueOrErrorMessage(fromBase58String(valueOrErrorMessage(getString(this, (q + a)), "Proposed asset not found")), "Incorrect proposed asset id") | |
70 | - | let u = valueOrErrorMessage(getInteger(this, (q + b)), "Proposed amount not found") | |
71 | - | [ScriptTransfer(s, x, w), ScriptTransfer(k.caller, u, t), StringEntry((q + e), j), StringEntry((q + g), toBase58String(k.transactionId))] | |
72 | - | } | |
73 | - | } | |
74 | - | } | |
51 | + | ||
52 | + | @Callable(v) | |
53 | + | func restakeGovernance (w) = if ((v.caller != b)) | |
54 | + | then throw("Only staking service is allowed to call this func") | |
55 | + | else { | |
56 | + | let t = p(this)._2 | |
57 | + | if ((w > t)) | |
58 | + | then throw("Amount to claim is less than minSWOPreward") | |
59 | + | else { | |
60 | + | let x = invoke(a, "claimAndStakeSWOP", nil, nil) | |
61 | + | if ((x == x)) | |
62 | + | then nil | |
63 | + | else throw("Strict value is not equal to itself.") | |
64 | + | } | |
65 | + | } | |
75 | 66 | ||
76 | 67 | ||
77 | 68 | @Verifier(y) |
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let a = | |
4 | + | let a = Address(base58'') | |
5 | 5 | ||
6 | - | let b = | |
6 | + | let b = Address(base58'') | |
7 | 7 | ||
8 | - | let c = "_ | |
8 | + | let c = "last_interest" | |
9 | 9 | ||
10 | - | let d = "_ | |
10 | + | let d = "_SWOP_amount" | |
11 | 11 | ||
12 | - | let e = "_ | |
12 | + | let e = "_last_interest" | |
13 | 13 | ||
14 | - | let f = | |
14 | + | let f = 100000000 | |
15 | 15 | ||
16 | - | let g = "_close_tx_id" | |
17 | - | ||
18 | - | let h = "Active" | |
19 | - | ||
20 | - | let i = "Canceled" | |
21 | - | ||
22 | - | let j = "Done" | |
23 | - | ||
24 | - | @Callable(k) | |
25 | - | func placeProposal (l,m) = { | |
26 | - | let n = $Tuple2(k.payments[0].amount, toBase58String(value(k.payments[0].assetId))) | |
27 | - | let o = n._1 | |
28 | - | let p = n._2 | |
29 | - | let q = toBase58String(k.transactionId) | |
30 | - | [StringEntry((q + f), toString(k.caller)), StringEntry((q + a), p), IntegerEntry((q + b), o), StringEntry((q + c), l), IntegerEntry((q + d), m), StringEntry((q + e), h)] | |
16 | + | func g () = { | |
17 | + | let h = valueOrElse(getInteger(a, c), 0) | |
18 | + | h | |
31 | 19 | } | |
32 | 20 | ||
33 | 21 | ||
22 | + | func i (j) = valueOrElse(getInteger(a, (toString(j) + d)), 0) | |
34 | 23 | ||
35 | - | @Callable(k) | |
36 | - | func cancelProposal (q) = { | |
37 | - | let r = valueOrErrorMessage(getString(this, (q + e)), (("Proposal with id '" + q) + "' not found")) | |
38 | - | if ((r != h)) | |
39 | - | then throw(((("Proposal with id '" + q) + "' is not active. Status: ") + r)) | |
40 | - | else { | |
41 | - | let s = addressFromStringValue(valueOrErrorMessage(getString(this, (q + f)), "owner not set")) | |
42 | - | let t = valueOrErrorMessage(getString(this, (q + a)), "Proposed asset not found") | |
43 | - | let u = valueOrErrorMessage(getInteger(this, (q + b)), "Proposed amount not found") | |
44 | - | if ((k.caller != s)) | |
45 | - | then throw("Only owner can cancel") | |
46 | - | else [ScriptTransfer(s, u, fromBase58String(t)), StringEntry((q + e), i), StringEntry((q + g), toBase58String(k.transactionId))] | |
47 | - | } | |
24 | + | ||
25 | + | func k (j,h) = { | |
26 | + | let l = i(j) | |
27 | + | let m = getInteger(a, (toString(j) + e)) | |
28 | + | let n = { | |
29 | + | let o = m | |
30 | + | if ($isInstanceOf(o, "Int")) | |
31 | + | then { | |
32 | + | let m = o | |
33 | + | m | |
34 | + | } | |
35 | + | else h | |
36 | + | } | |
37 | + | $Tuple2(n, l) | |
48 | 38 | } | |
49 | 39 | ||
50 | 40 | ||
41 | + | func p (q) = { | |
42 | + | let h = g() | |
43 | + | let r = k(q, h) | |
44 | + | let m = r._1 | |
45 | + | let s = r._2 | |
46 | + | let t = fraction(s, (h - m), f) | |
47 | + | let u = h | |
48 | + | $Tuple2(u, t) | |
49 | + | } | |
51 | 50 | ||
52 | - | @Callable(k) | |
53 | - | func acceptProposal (q) = { | |
54 | - | let v = $Tuple2(k.payments[0].amount, value(k.payments[0].assetId)) | |
55 | - | let o = v._1 | |
56 | - | let p = v._2 | |
57 | - | let r = valueOrErrorMessage(getString(this, (q + e)), (("Proposal with id '" + q) + "' not found")) | |
58 | - | if ((r != h)) | |
59 | - | then throw(((("Proposal with id '" + q) + "' is not active. Status: ") + r)) | |
60 | - | else { | |
61 | - | let w = valueOrErrorMessage(fromBase58String(valueOrErrorMessage(getString(this, (q + c)), "Desired asset not found")), "Incorrect desired asset id") | |
62 | - | let x = valueOrErrorMessage(getInteger(this, (q + d)), "Desired amount not found") | |
63 | - | if ((w != p)) | |
64 | - | then throw("Atatched asset doesn't match desired") | |
65 | - | else if ((x != o)) | |
66 | - | then throw("Attached asset amount doesn't match") | |
67 | - | else { | |
68 | - | let s = addressFromStringValue(valueOrErrorMessage(getString(this, (q + f)), "owner not set")) | |
69 | - | let t = valueOrErrorMessage(fromBase58String(valueOrErrorMessage(getString(this, (q + a)), "Proposed asset not found")), "Incorrect proposed asset id") | |
70 | - | let u = valueOrErrorMessage(getInteger(this, (q + b)), "Proposed amount not found") | |
71 | - | [ScriptTransfer(s, x, w), ScriptTransfer(k.caller, u, t), StringEntry((q + e), j), StringEntry((q + g), toBase58String(k.transactionId))] | |
72 | - | } | |
73 | - | } | |
74 | - | } | |
51 | + | ||
52 | + | @Callable(v) | |
53 | + | func restakeGovernance (w) = if ((v.caller != b)) | |
54 | + | then throw("Only staking service is allowed to call this func") | |
55 | + | else { | |
56 | + | let t = p(this)._2 | |
57 | + | if ((w > t)) | |
58 | + | then throw("Amount to claim is less than minSWOPreward") | |
59 | + | else { | |
60 | + | let x = invoke(a, "claimAndStakeSWOP", nil, nil) | |
61 | + | if ((x == x)) | |
62 | + | then nil | |
63 | + | else throw("Strict value is not equal to itself.") | |
64 | + | } | |
65 | + | } | |
75 | 66 | ||
76 | 67 | ||
77 | 68 | @Verifier(y) | |
78 | 69 | func z () = sigVerify(y.bodyBytes, y.proofs[0], y.senderPublicKey) | |
79 | 70 |
github/deemru/w8io/169f3d6 41.49 ms ◑