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 | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let usdn = base58'25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT' | |
5 | - | ||
6 | - | let snsbtId = base58'DZ5LhvfGCEAFRmfcrtdjhhiLESBfN7dMvM8FEFQc6Qr6' | |
7 | - | ||
8 | - | let isStopped = false | |
4 | + | let usdnID = base58'25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT' | |
9 | 5 | ||
10 | 6 | @Callable(i) | |
11 | - | func stakeNSBT () = { | |
12 | - | let pmt = value(i.payments[0]) | |
13 | - | let amount = pmt.amount | |
14 | - | if ((pmt.assetId != usdn)) | |
15 | - | then throw("attach USDN token only") | |
16 | - | else if (isStopped) | |
17 | - | then throw("smart contract is on lock") | |
18 | - | else { | |
19 | - | let lockInv = invoke(Address(base58'3NAefciWv6f9fWvEXdGgpHfanJFG8HqfjuT'), "put", [$Tuple2(500000, true)], [pmt]) | |
20 | - | if ((lockInv == lockInv)) | |
21 | - | then { | |
22 | - | let snsbtIssue = Reissue(snsbtId, amount, true) | |
23 | - | [snsbtIssue, ScriptTransfer(i.caller, amount, snsbtId)] | |
24 | - | } | |
25 | - | else throw("Strict value is not equal to itself.") | |
26 | - | } | |
7 | + | func deposit () = { | |
8 | + | let pmt = i.payments[0] | |
9 | + | let caller = toString(i.caller) | |
10 | + | if ((pmt.assetId != usdnID)) | |
11 | + | then throw("Invalid asset") | |
12 | + | else { | |
13 | + | let deposited = valueOrElse(getInteger(this, caller), 0) | |
14 | + | let s = IntegerEntry(caller, (pmt.amount + deposited)) | |
15 | + | let onStake = valueOrElse(getInteger(this, "_tresury"), 0) | |
16 | + | let updateTreasury = IntegerEntry("_treasury", (pmt.amount + onStake)) | |
17 | + | [s, updateTreasury] | |
18 | + | } | |
19 | + | } | |
20 | + | ||
21 | + | ||
22 | + | ||
23 | + | @Callable(i) | |
24 | + | func claim (amount) = { | |
25 | + | let caller = toString(i.caller) | |
26 | + | let forWithdraw = getIntegerValue(this, caller) | |
27 | + | if ((amount > forWithdraw)) | |
28 | + | then throw("Not enough to claim") | |
29 | + | else [IntegerEntry((caller + "_withdraw"), (forWithdraw - amount)), ScriptTransfer(i.caller, amount, usdnID)] | |
27 | 30 | } | |
28 | 31 | ||
29 | 32 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let usdn = base58'25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT' | |
5 | - | ||
6 | - | let snsbtId = base58'DZ5LhvfGCEAFRmfcrtdjhhiLESBfN7dMvM8FEFQc6Qr6' | |
7 | - | ||
8 | - | let isStopped = false | |
4 | + | let usdnID = base58'25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT' | |
9 | 5 | ||
10 | 6 | @Callable(i) | |
11 | - | func stakeNSBT () = { | |
12 | - | let pmt = value(i.payments[0]) | |
13 | - | let amount = pmt.amount | |
14 | - | if ((pmt.assetId != usdn)) | |
15 | - | then throw("attach USDN token only") | |
16 | - | else if (isStopped) | |
17 | - | then throw("smart contract is on lock") | |
18 | - | else { | |
19 | - | let lockInv = invoke(Address(base58'3NAefciWv6f9fWvEXdGgpHfanJFG8HqfjuT'), "put", [$Tuple2(500000, true)], [pmt]) | |
20 | - | if ((lockInv == lockInv)) | |
21 | - | then { | |
22 | - | let snsbtIssue = Reissue(snsbtId, amount, true) | |
23 | - | [snsbtIssue, ScriptTransfer(i.caller, amount, snsbtId)] | |
24 | - | } | |
25 | - | else throw("Strict value is not equal to itself.") | |
26 | - | } | |
7 | + | func deposit () = { | |
8 | + | let pmt = i.payments[0] | |
9 | + | let caller = toString(i.caller) | |
10 | + | if ((pmt.assetId != usdnID)) | |
11 | + | then throw("Invalid asset") | |
12 | + | else { | |
13 | + | let deposited = valueOrElse(getInteger(this, caller), 0) | |
14 | + | let s = IntegerEntry(caller, (pmt.amount + deposited)) | |
15 | + | let onStake = valueOrElse(getInteger(this, "_tresury"), 0) | |
16 | + | let updateTreasury = IntegerEntry("_treasury", (pmt.amount + onStake)) | |
17 | + | [s, updateTreasury] | |
18 | + | } | |
19 | + | } | |
20 | + | ||
21 | + | ||
22 | + | ||
23 | + | @Callable(i) | |
24 | + | func claim (amount) = { | |
25 | + | let caller = toString(i.caller) | |
26 | + | let forWithdraw = getIntegerValue(this, caller) | |
27 | + | if ((amount > forWithdraw)) | |
28 | + | then throw("Not enough to claim") | |
29 | + | else [IntegerEntry((caller + "_withdraw"), (forWithdraw - amount)), ScriptTransfer(i.caller, amount, usdnID)] | |
27 | 30 | } | |
28 | 31 | ||
29 | 32 | ||
30 | 33 | @Verifier(tx) | |
31 | 34 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
32 | 35 |
github/deemru/w8io/169f3d6 23.42 ms ◑