tx · EJg93Z1ESc9ykWfThpysaK8kHSpcmdrTB3tYkuzPDhXj 3N3iAA2bkdjAiEhMKGnSGThfmaY18B1jvXD: -0.03200000 Waves 2022.06.06 23:07 [2084952] smart account 3N3iAA2bkdjAiEhMKGnSGThfmaY18B1jvXD > SELF 0.00000000 Waves
{ "type": 13, "id": "EJg93Z1ESc9ykWfThpysaK8kHSpcmdrTB3tYkuzPDhXj", "fee": 3200000, "feeAssetId": null, "timestamp": 1654546084389, "version": 2, "chainId": 84, "sender": "3N3iAA2bkdjAiEhMKGnSGThfmaY18B1jvXD", "senderPublicKey": "5LFb7ZNUXy1dvx2A39gFw1TMihAA2mY5d6MzB719q8Vz", "proofs": [ "4C8shwFpJhJrvaoiGhfFajWgDAjFV27hY49YmP6pAwCesUMbCuK1dCrJZkkvydYVsGqzK5nejyrnH4rTDwiaArYA" ], "script": "base64:AAIFAAAAAAAAABMIAhIDCgEIEgMKAQgSAwoBARIAAAAACgAAAAALa19pbnN1cmFuY2UCAAAAC2tfaW5zdXJhbmNlAAAAAAxrX3doaXRlbGlzdHQCAAAAC2tfd2hpdGVsaXN0AAAAAA1BRE1JTl9BRERSRVNTCQEAAAAHQWRkcmVzcwAAAAEBAAAAGgFUbspxk39jXvqIb02ujTgCQNA7p6nZQI8vAAAAABBBRE1JTl9QVUJMSUNfS0VZAQAAACC3HUQ2kz6BYDcABtv0mLme67rWgV2Yt1LGHBuoQ65xTgAAAAAEVVNETgEAAAAg93bq9/eDymXbbhPuAjvPWCmVqcHRjfJL2mzYHWKAyN4AAAAADFVTRE5fU1RBS0lORwkBAAAAB0FkZHJlc3MAAAABAQAAABoBVNUUiPoS2q6RwzbnHdK7erN5p99Do42YpgEAAAAOdG9Db21wb3NpdGVLZXkAAAACAAAABF9rZXkAAAAIX2FkZHJlc3MJAAEsAAAAAgkAASwAAAACBQAAAARfa2V5AgAAAAFfBQAAAAhfYWRkcmVzcwEAAAAJaW5zdXJhbmNlAAAAAAkBAAAAC3ZhbHVlT3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AAAAEVVNETgUAAAAHX2Ftb3VudAUAAAADbmlsAwkAAAAAAAACBQAAAAVzdGFrZQUAAAAFc3Rha2UJAQAAAA91cGRhdGVJbnN1cmFuY2UAAAABCQAAZAAAAAIJAQAAAAlpbnN1cmFuY2UAAAAABQAAAAdfYW1vdW50CQAAAgAAAAECAAAAJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAABQAAABBBRE1JTl9QVUJMSUNfS0VZzQRvbw==", "height": 2084952, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: HssXJLM4yHGUYTAMoFjfVuY4jsb4G361KgoBhjc3pJX5 Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let k_insurance = "k_insurance" | |
5 | 5 | ||
6 | 6 | let k_whitelistt = "k_whitelist" | |
7 | 7 | ||
8 | 8 | let ADMIN_ADDRESS = Address(base58'3Mz1td457M34EA7wU1swt2DBQDZEDpsMtgE') | |
9 | 9 | ||
10 | 10 | let ADMIN_PUBLIC_KEY = base58'DKoVYQRirYnan4ojiUkT12oE6XmpyNoht3ZcecUpgLsf' | |
11 | 11 | ||
12 | 12 | let USDN = base58'HezsdQuRDtzksAYUy97gfhKy7Z1NW2uXYSHA3bgqenNZ' | |
13 | 13 | ||
14 | 14 | let USDN_STAKING = Address(base58'3N9LkJahTMx41wGhSxLS42prCZtRCp4dhTs') | |
15 | 15 | ||
16 | 16 | func toCompositeKey (_key,_address) = ((_key + "_") + _address) | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | func insurance () = valueOrElse(getInteger(this, k_insurance), 0) | |
20 | 20 | ||
21 | 21 | ||
22 | 22 | func isWhitelist (_address) = valueOrElse(getBoolean(this, toCompositeKey(k_whitelistt, _address)), false) | |
23 | 23 | ||
24 | 24 | ||
25 | 25 | func updateInsurance (i) = [IntegerEntry(k_insurance, i)] | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | @Callable(i) | |
29 | 29 | func addWhitelist (_addresss) = if ((i.caller != ADMIN_ADDRESS)) | |
30 | 30 | then throw("Invalid addWhitelist params") | |
31 | 31 | else [BooleanEntry(toCompositeKey(k_whitelistt, _addresss), true)] | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | ||
35 | 35 | @Callable(i) | |
36 | 36 | func removeWhitelist (_addresss) = if ((i.caller != ADMIN_ADDRESS)) | |
37 | 37 | then throw("Invalid addWhitelist params") | |
38 | 38 | else [BooleanEntry(toCompositeKey(k_whitelistt, _addresss), false)] | |
39 | 39 | ||
40 | 40 | ||
41 | 41 | ||
42 | 42 | @Callable(i) | |
43 | 43 | func withdraw (_amount) = if (if (!(isWhitelist(toString(i.caller)))) | |
44 | 44 | then true | |
45 | 45 | else (_amount > insurance())) | |
46 | 46 | then throw("Invalid withdraw params") | |
47 | 47 | else { | |
48 | 48 | let unstake = invoke(USDN_STAKING, "unlockNeutrino", [_amount, toBase58String(USDN)], nil) | |
49 | 49 | if ((unstake == unstake)) | |
50 | 50 | then (updateInsurance((insurance() - _amount)) ++ [ScriptTransfer(i.caller, _amount, USDN)]) | |
51 | 51 | else throw("Strict value is not equal to itself.") | |
52 | 52 | } | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | ||
56 | 56 | @Callable(i) | |
57 | 57 | func deposit () = { | |
58 | 58 | let _amount = i.payments[0].amount | |
59 | 59 | if (if ((i.payments[0].assetId != USDN)) | |
60 | 60 | then true | |
61 | 61 | else if (!(isWhitelist(toString(i.caller)))) | |
62 | 62 | then (i.caller != ADMIN_ADDRESS) | |
63 | 63 | else false) | |
64 | 64 | then throw("Invalid deposit params") | |
65 | 65 | else { | |
66 | 66 | let stake = invoke(USDN_STAKING, "lockNeutrino", nil, [AttachedPayment(USDN, _amount)]) | |
67 | 67 | if ((stake == stake)) | |
68 | 68 | then updateInsurance((insurance() + _amount)) | |
69 | 69 | else throw("Strict value is not equal to itself.") | |
70 | 70 | } | |
71 | 71 | } | |
72 | 72 | ||
73 | 73 | ||
74 | 74 | @Verifier(tx) | |
75 | 75 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], ADMIN_PUBLIC_KEY) | |
76 | 76 |
github/deemru/w8io/169f3d6 51.68 ms ◑