tx · 5ai9BKHW4QAdmDs9aNSXoiHznyc5ZoMmfjN1qpDuNcfj 3N5ZhGLzDmoMwHsWKAoTqkFvVYuditKPyvY: -0.01000000 Waves 2022.11.14 15:34 [2316807] smart account 3N5ZhGLzDmoMwHsWKAoTqkFvVYuditKPyvY > SELF 0.00000000 Waves
{ "type": 13, "id": "5ai9BKHW4QAdmDs9aNSXoiHznyc5ZoMmfjN1qpDuNcfj", "fee": 1000000, "feeAssetId": null, "timestamp": 1668429277596, "version": 2, "chainId": 84, "sender": "3N5ZhGLzDmoMwHsWKAoTqkFvVYuditKPyvY", "senderPublicKey": "7mgUaX6yf7mFk48Gus7kVGRUwCZXtr2CKWJW6KoukPiW", "proofs": [ "4Ymnp6spP4nxoEqVWYHi6b1YDYdkNsYP98KZmcW9Ykqq1q4o3thX9GZsZ7LoA5Nvh6Ktxe8iT1mSWWJEkaDpZiYL" ], "script": "base64:AAIFAAAAAAAAAAkIAhIAEgMKAQEAAAABAAAAAAZ1c2RuSUQBAAAAIA/yHBKs5MQ8muxGGqslqLDsugcrRsxtiHLwteKSSQG0AAAAAgAAAAFpAQAAAAdkZXBvc2l0AAAAAAQAAAADcG10CQABkQAAAAIIBQAAAAFpAAAACHBheW1lbnRzAAAAAAAAAAAABAAAAAZjYWxsZXIJAAQlAAAAAQgFAAAAAWkAAAAGY2FsbGVyAwkBAAAAAiE9AAAAAggFAAAAA3BtdAAAAAdhc3NldElkBQAAAAZ1c2RuSUQJAAACAAAAAQIAAAANSW52YWxpZCBhc3NldAQAAAAJZGVwb3NpdGVkCQEAAAALdmFsdWVPckVsc2UAAAACCQAEGgAAAAIFAAAABHRoaXMFAAAABmNhbGxlcgAAAAAAAAAAAAQAAAABcwkBAAAADEludGVnZXJFbnRyeQAAAAIFAAAABmNhbGxlcgkAAGQAAAACCAUAAAADcG10AAAABmFtb3VudAUAAAAJZGVwb3NpdGVkBAAAAAdvblN0YWtlCQEAAAALdmFsdWVPckVsc2UAAAACCQAEGgAAAAIFAAAABHRoaXMCAAAACF90cmVzdXJ5AAAAAAAAAAAABAAAAA51cGRhdGVUcmVhc3VyeQkBAAAADEludGVnZXJFbnRyeQAAAAICAAAACV90cmVhc3VyeQkAAGQAAAACCAUAAAADcG10AAAABmFtb3VudAUAAAAHb25TdGFrZQkABEwAAAACBQAAAAFzCQAETAAAAAIFAAAADnVwZGF0ZVRyZWFzdXJ5BQAAAANuaWwAAAABaQEAAAAFY2xhaW0AAAABAAAABmFtb3VudAQAAAAGY2FsbGVyCQAEJQAAAAEIBQAAAAFpAAAABmNhbGxlcgQAAAALZm9yV2l0aGRyYXcJAQAAABFAZXh0ck5hdGl2ZSgxMDUwKQAAAAIFAAAABHRoaXMFAAAABmNhbGxlcgMJAABmAAAAAgUAAAAGYW1vdW50BQAAAAtmb3JXaXRoZHJhdwkAAAIAAAABAgAAABNOb3QgZW5vdWdoIHRvIGNsYWltCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACCQABLAAAAAIFAAAABmNhbGxlcgIAAAAJX3dpdGhkcmF3CQAAZQAAAAIFAAAAC2ZvcldpdGhkcmF3BQAAAAZhbW91bnQJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAAZhbW91bnQFAAAABnVzZG5JRAUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXkK6Q9Q", "height": 2316807, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BHc23HKW5ripZtuDBoHNFGabHNWDR5LwCuS3xZDHSysA Next: 5Sn25VTaaJXYJFWvK2ZaoGtwnBcvr8eARjgUHiTEbwkW Diff:
Old | New | Differences | |
---|---|---|---|
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = base58'25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT' | |
5 | 5 | ||
6 | - | let b = base58'DZ5LhvfGCEAFRmfcrtdjhhiLESBfN7dMvM8FEFQc6Qr6' | |
7 | - | ||
8 | - | let c = false | |
9 | - | ||
10 | - | @Callable(d) | |
11 | - | func stakeNSBT () = { | |
12 | - | let e = value(d.payments[0]) | |
13 | - | let f = e.amount | |
14 | - | if ((e.assetId != a)) | |
15 | - | then throw("attach USDN token only") | |
16 | - | else if (c) | |
17 | - | then throw("smart contract is on lock") | |
18 | - | else { | |
19 | - | let g = invoke(Address(base58'3NAefciWv6f9fWvEXdGgpHfanJFG8HqfjuT'), "put", [$Tuple2(500000, true)], [e]) | |
20 | - | if ((g == g)) | |
21 | - | then { | |
22 | - | let h = Reissue(b, f, true) | |
23 | - | [h, ScriptTransfer(d.caller, f, b)] | |
24 | - | } | |
25 | - | else throw("Strict value is not equal to itself.") | |
26 | - | } | |
6 | + | @Callable(b) | |
7 | + | func deposit () = { | |
8 | + | let c = b.payments[0] | |
9 | + | let d = toString(b.caller) | |
10 | + | if ((c.assetId != a)) | |
11 | + | then throw("Invalid asset") | |
12 | + | else { | |
13 | + | let e = valueOrElse(getInteger(this, d), 0) | |
14 | + | let f = IntegerEntry(d, (c.amount + e)) | |
15 | + | let g = valueOrElse(getInteger(this, "_tresury"), 0) | |
16 | + | let h = IntegerEntry("_treasury", (c.amount + g)) | |
17 | + | [f, h] | |
18 | + | } | |
27 | 19 | } | |
28 | 20 | ||
29 | 21 | ||
30 | - | @Verifier(i) | |
31 | - | func j () = sigVerify(i.bodyBytes, i.proofs[0], i.senderPublicKey) | |
22 | + | ||
23 | + | @Callable(b) | |
24 | + | func claim (i) = { | |
25 | + | let d = toString(b.caller) | |
26 | + | let j = getIntegerValue(this, d) | |
27 | + | if ((i > j)) | |
28 | + | then throw("Not enough to claim") | |
29 | + | else [IntegerEntry((d + "_withdraw"), (j - i)), ScriptTransfer(b.caller, i, a)] | |
30 | + | } | |
31 | + | ||
32 | + | ||
33 | + | @Verifier(k) | |
34 | + | func l () = sigVerify(k.bodyBytes, k.proofs[0], k.senderPublicKey) | |
32 | 35 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = base58'25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT' | |
5 | 5 | ||
6 | - | let b = base58'DZ5LhvfGCEAFRmfcrtdjhhiLESBfN7dMvM8FEFQc6Qr6' | |
7 | - | ||
8 | - | let c = false | |
9 | - | ||
10 | - | @Callable(d) | |
11 | - | func stakeNSBT () = { | |
12 | - | let e = value(d.payments[0]) | |
13 | - | let f = e.amount | |
14 | - | if ((e.assetId != a)) | |
15 | - | then throw("attach USDN token only") | |
16 | - | else if (c) | |
17 | - | then throw("smart contract is on lock") | |
18 | - | else { | |
19 | - | let g = invoke(Address(base58'3NAefciWv6f9fWvEXdGgpHfanJFG8HqfjuT'), "put", [$Tuple2(500000, true)], [e]) | |
20 | - | if ((g == g)) | |
21 | - | then { | |
22 | - | let h = Reissue(b, f, true) | |
23 | - | [h, ScriptTransfer(d.caller, f, b)] | |
24 | - | } | |
25 | - | else throw("Strict value is not equal to itself.") | |
26 | - | } | |
6 | + | @Callable(b) | |
7 | + | func deposit () = { | |
8 | + | let c = b.payments[0] | |
9 | + | let d = toString(b.caller) | |
10 | + | if ((c.assetId != a)) | |
11 | + | then throw("Invalid asset") | |
12 | + | else { | |
13 | + | let e = valueOrElse(getInteger(this, d), 0) | |
14 | + | let f = IntegerEntry(d, (c.amount + e)) | |
15 | + | let g = valueOrElse(getInteger(this, "_tresury"), 0) | |
16 | + | let h = IntegerEntry("_treasury", (c.amount + g)) | |
17 | + | [f, h] | |
18 | + | } | |
27 | 19 | } | |
28 | 20 | ||
29 | 21 | ||
30 | - | @Verifier(i) | |
31 | - | func j () = sigVerify(i.bodyBytes, i.proofs[0], i.senderPublicKey) | |
22 | + | ||
23 | + | @Callable(b) | |
24 | + | func claim (i) = { | |
25 | + | let d = toString(b.caller) | |
26 | + | let j = getIntegerValue(this, d) | |
27 | + | if ((i > j)) | |
28 | + | then throw("Not enough to claim") | |
29 | + | else [IntegerEntry((d + "_withdraw"), (j - i)), ScriptTransfer(b.caller, i, a)] | |
30 | + | } | |
31 | + | ||
32 | + | ||
33 | + | @Verifier(k) | |
34 | + | func l () = sigVerify(k.bodyBytes, k.proofs[0], k.senderPublicKey) | |
32 | 35 |
github/deemru/w8io/169f3d6 24.20 ms ◑