tx · GdkZMMoDfS7xogYUG8FU5XtZRZgBxxxA6WU72YFZ384w 3MyDGEoKp1gF4LSRknk9vSuDEyrwuYXcQEQ: -0.01000000 Waves 2022.05.06 15:17 [2039829] smart account 3MyDGEoKp1gF4LSRknk9vSuDEyrwuYXcQEQ > SELF 0.00000000 Waves
{ "type": 13, "id": "GdkZMMoDfS7xogYUG8FU5XtZRZgBxxxA6WU72YFZ384w", "fee": 1000000, "feeAssetId": null, "timestamp": 1651839441618, "version": 2, "chainId": 84, "sender": "3MyDGEoKp1gF4LSRknk9vSuDEyrwuYXcQEQ", "senderPublicKey": "BhRnrwd6wVHSkSaWXCjQRjaoXcpCdUW2hkJD6V7uVDxN", "proofs": [ "dA15626W2uwCyN2EdZZnVhokQkEL3Qd4DPgzhuY9tnDKTt7MZapkoEzKDjzL3J6BYWo3H1EGMHvVg1VhNhyxGVw" ], "script": "base64:AAIFAAAAAAAAAB0IAhIDCgEIEgASBAoCCAESAwoBARIFCgMICAESAAAAAAkAAAAACnNoaW55d2dnaWQBAAAAIIlpzwL/trq51HGW13m4mXYmsHTQd3n0c26G8PRznwYmAAAAAAxhZG1pbkFkZHJlc3MJAQAAABFAZXh0ck5hdGl2ZSgxMDYyKQAAAAECAAAAIzNNcE50aVBTUlNxNk5uYVFZazM4QmZXU3paY2dBWVR5clE5AAAAAA1hc3NldHNBZGRyZXNzAQAAABoBV4y1SJ9+nhXVGJeOG3f7CX9nYtrhbWMlSQEAAAANdHJ5R2V0SW50ZWdlcgAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFiBQAAAAckbWF0Y2gwBQAAAAFiAAAAAAAAAAAAAQAAAA10cnlHZXRCb29sZWFuAAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQbAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgA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QEAAAALaW50ZXJuYWxQYXkAAAACBQAAAApjYWxsZXJBZGRyBQAAAAZhbW91bnQAAAABaQEAAAANdHJhbnNmZXJDb2lucwAAAAMAAAALZnJvbUFkZHJlc3MAAAAJdG9BZGRyZXNzAAAABmFtb3VudAMDCQEAAAACIT0AAAACCAUAAAABaQAAAAZjYWxsZXIFAAAADGFkbWluQWRkcmVzcwkBAAAAAiE9AAAAAggIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwUAAAANYXNzZXRzQWRkcmVzcwcJAAACAAAAAQIAAAAweW91IGFyZSBub3QgYXV0aG9yaXplZCB0byBwZXJmb3JtIHRoaXMgb3BlcmF0aW9uCQEAAAAQaW50ZXJuYWxUcmFuc2ZlcgAAAAMFAAAAC2Zyb21BZGRyZXNzBQAAAAl0b0FkZHJlc3MFAAAABmFtb3VudAAAAAFpAQAAAAZSZWRlZW0AAAAABAAAAAphZGRyZXNzU3RyCQAEJQAAAAEIBQAAAAFpAAAABmNhbGxlcgQAAAAOcmVzZXJ2ZWRBbW91bnQJAQAAAA10cnlHZXRJbnRlZ2VyAAAAAQkAASwAAAACBQAAAAphZGRyZXNzU3RyAgAAAAlfUmVzZXJ2ZWQDCQAAAAAAAAIFAAAADnJlc2VydmVkQW1vdW50AAAAAAAAAAAACQAAAgAAAAECAAAAEU5vdGhpbmcgdG8gcmVkZWVtCQAETAAAAAIJAQAAAAtEZWxldGVFbnRyeQAAAAEJAAEsAAAAAgUAAAAKYWRkcmVzc1N0cgIAAAAJX1Jlc2VydmVkCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAOcmVzZXJ2ZWRBbW91bnQFAAAACnNoaW55d2dnaWQFAAAAA25pbAAAAACoLJOu", "height": 2039829, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: GYPVqiwDogKNhH12xTiir7o8qCy7he912Kn3SnxBNktR Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let shinywggid = base58'AFQS5E4ELtxex3iANtWtUU2V2oWJZSo8VVnK8z3VFmqf' | |
5 | + | ||
6 | + | let adminAddress = addressFromStringValue("3MpNtiPSRSq6NnaQYk38BfWSzZcgAYTyrQ9") | |
7 | + | ||
8 | + | let assetsAddress = base58'3PEktVux2RhchSN63DsDo4b4mz4QqzKSeDv' | |
9 | + | ||
10 | + | func tryGetInteger (key) = match getInteger(this, key) { | |
11 | + | case b: Int => | |
12 | + | b | |
13 | + | case _ => | |
14 | + | 0 | |
15 | + | } | |
16 | + | ||
17 | + | ||
18 | + | func tryGetBoolean (key) = match getBoolean(this, key) { | |
19 | + | case b: Boolean => | |
20 | + | b | |
21 | + | case _ => | |
22 | + | false | |
23 | + | } | |
24 | + | ||
25 | + | ||
26 | + | func internalDeposit (addressStr,amountIn) = { | |
27 | + | let amount = tryGetInteger((addressStr + "_Deposit")) | |
28 | + | [IntegerEntry((addressStr + "_Deposit"), (amount + amountIn))] | |
29 | + | } | |
30 | + | ||
31 | + | ||
32 | + | func internalPay (addressStr,amount) = { | |
33 | + | let deposited = tryGetInteger((addressStr + "_Deposit")) | |
34 | + | if ((0 > (deposited - amount))) | |
35 | + | then throw("Not enough deposit to build.") | |
36 | + | else if (((deposited - amount) == 0)) | |
37 | + | then [DeleteEntry((addressStr + "_Deposit"))] | |
38 | + | else [IntegerEntry((addressStr + "_Deposit"), (deposited - amount))] | |
39 | + | } | |
40 | + | ||
41 | + | ||
42 | + | func internalReserve (addressStr,amount) = { | |
43 | + | let reservedAmount = tryGetInteger((addressStr + "_Reserved")) | |
44 | + | [IntegerEntry((addressStr + "_Reserved"), (reservedAmount + amount))] | |
45 | + | } | |
46 | + | ||
47 | + | ||
48 | + | func internalTransfer (fromAddress,toAddress,amount) = (internalPay(fromAddress, amount) ++ internalDeposit(toAddress, amount)) | |
49 | + | ||
50 | + | ||
51 | + | @Callable(i) | |
52 | + | func setAssetAddress (assetAddr) = if (if ((i.caller != this)) | |
53 | + | then (i.caller != adminAddress) | |
54 | + | else false) | |
55 | + | then throw("you are not authorized to perform this operation") | |
56 | + | else [StringEntry("AssetAddress", assetAddr)] | |
57 | + | ||
58 | + | ||
59 | + | ||
60 | + | @Callable(i) | |
61 | + | func Deposit () = { | |
62 | + | let addressStr = toString(i.originCaller) | |
63 | + | let pmt = i.payments[0] | |
64 | + | if ((pmt == pmt)) | |
65 | + | then { | |
66 | + | let amountIn = value(i.payments[0].amount) | |
67 | + | if ((amountIn == amountIn)) | |
68 | + | then { | |
69 | + | let assetIn = pmt.assetId | |
70 | + | if ((assetIn == assetIn)) | |
71 | + | then if ((assetIn != shinywggid)) | |
72 | + | then throw("Only $HEG payments allowed") | |
73 | + | else { | |
74 | + | let amount = tryGetInteger((addressStr + "_Deposit")) | |
75 | + | internalDeposit(addressStr, (amount + amountIn)) | |
76 | + | } | |
77 | + | else throw("Strict value is not equal to itself.") | |
78 | + | } | |
79 | + | else throw("Strict value is not equal to itself.") | |
80 | + | } | |
81 | + | else throw("Strict value is not equal to itself.") | |
82 | + | } | |
83 | + | ||
84 | + | ||
85 | + | ||
86 | + | @Callable(i) | |
87 | + | func Pay (addressStr,amount) = if (if (if ((i.caller != this)) | |
88 | + | then (i.caller != adminAddress) | |
89 | + | else false) | |
90 | + | then (i.caller.bytes != assetsAddress) | |
91 | + | else false) | |
92 | + | then throw("you are not authorized to perform this operation") | |
93 | + | else internalPay(addressStr, amount) | |
94 | + | ||
95 | + | ||
96 | + | ||
97 | + | @Callable(i) | |
98 | + | func CallerPay (amount) = { | |
99 | + | let callerAddr = toString(i.caller) | |
100 | + | internalPay(callerAddr, amount) | |
101 | + | } | |
102 | + | ||
103 | + | ||
104 | + | ||
105 | + | @Callable(i) | |
106 | + | func transferCoins (fromAddress,toAddress,amount) = if (if ((i.caller != adminAddress)) | |
107 | + | then (i.caller.bytes != assetsAddress) | |
108 | + | else false) | |
109 | + | then throw("you are not authorized to perform this operation") | |
110 | + | else internalTransfer(fromAddress, toAddress, amount) | |
111 | + | ||
112 | + | ||
113 | + | ||
114 | + | @Callable(i) | |
115 | + | func Redeem () = { | |
116 | + | let addressStr = toString(i.caller) | |
117 | + | let reservedAmount = tryGetInteger((addressStr + "_Reserved")) | |
118 | + | if ((reservedAmount == 0)) | |
119 | + | then throw("Nothing to redeem") | |
120 | + | else [DeleteEntry((addressStr + "_Reserved")), ScriptTransfer(i.caller, reservedAmount, shinywggid)] | |
121 | + | } | |
122 | + | ||
123 | + |
github/deemru/w8io/026f985 19.14 ms ◑