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