tx · 6a7JYocrJow4W7uQF54hFEMez5X5kmbhosamSNeCSw5N

3N5TDZHiXyXByfTA47imbhEqAbzAupJR5xY:  -0.01000000 Waves

2022.11.22 21:42 [2328694] smart account 3N5TDZHiXyXByfTA47imbhEqAbzAupJR5xY > SELF 0.00000000 Waves

{ "type": 13, "id": "6a7JYocrJow4W7uQF54hFEMez5X5kmbhosamSNeCSw5N", "fee": 1000000, "feeAssetId": null, "timestamp": 1669142538538, "version": 2, "chainId": 84, "sender": "3N5TDZHiXyXByfTA47imbhEqAbzAupJR5xY", "senderPublicKey": "9rkQ1ChfNZ585cJFqVhjLk1mTNMXT93CZidHoYERtHML", "proofs": [ "2AMMiMbjMw9X9rn6At5AAH2q2hLiuKuHQ1fLdUMrEV5LSVBQKRHQvXjPpJpnjenZf8xPuPR7bPUtrFG3WGtEk3zn" ], "script": "base64:BgIaCAISBAoCCAgSAwoBCBIDCgEIEgYKBAgIAQEUAANTRVACAl9fAAVFTVBUWQIAAAlQUkVDSVNJT04AgICQu7rWrfANAAhERUNJTUFMUwCAwtcvAAlXRVNUX1BBUlQJAGkCBQlQUkVDSVNJT04ABQELa2V5QXNzZXRDZmcBDGJhc2VBc3NldFN0cgkAuQkCCQDMCAICBiVzJXMlcwkAzAgCAgZjb25maWcJAMwIAgIFYXNzZXQJAMwIAgUMYmFzZUFzc2V0U3RyBQNuaWwFA1NFUAEOa2V5SW5pdGlhbGl6ZWQACQC5CQIJAMwIAgICJXMJAMwIAgILaW5pdGlhbGl6ZWQFA25pbAUDU0VQAQhrZXlBZG1pbgAJALkJAgkAzAgCAgIlcwkAzAgCAgVhZG1pbgUDbmlsBQNTRVABDGtleUVhc3RBc3NldAAJALkJAgkAzAgCAgIlcwkAzAgCAgllYXN0QXNzZXQFA25pbAUDU0VQAQxrZXlXZXN0QXNzZXQACQC5CQIJAMwIAgICJXMJAMwIAgIJd2VzdEFzc2V0BQNuaWwFA1NFUAEPa2V5QXNzZXRTdG9yYWdlAAkAuQkCCQDMC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} View: original | compacted Prev: GQFFJjXxLVxbPippXRDPGN5V8gSbj23XWeARhesn9aLp Next: 9PwexppAvEuzWqshMVjCXUg6mhJG49fn6UtqMGh2tYJo Diff:
OldNewDifferences
101101
102102
103103 @Callable(i)
104-func setAdmin (_address) = {
105- let check = if (initialized())
106- then mustAdmin(i)
107- else false
108- if ((check == check))
109- then if (!(check))
110- then throw("Not allowed")
111- else [StringEntry(keyAdmin(), _address)]
112- else throw("Strict value is not equal to itself.")
113- }
104+func setAdmin (_address) = [StringEntry(keyAdmin(), _address)]
114105
115106
116107
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SEP = "__"
55
66 let EMPTY = ""
77
88 let PRECISION = 1000000000000000000
99
1010 let DECIMALS = 100000000
1111
1212 let WEST_PART = (PRECISION / 5)
1313
1414 func keyAssetCfg (baseAssetStr) = makeString(["%s%s%s", "config", "asset", baseAssetStr], SEP)
1515
1616
1717 func keyInitialized () = makeString(["%s", "initialized"], SEP)
1818
1919
2020 func keyAdmin () = makeString(["%s", "admin"], SEP)
2121
2222
2323 func keyEastAsset () = makeString(["%s", "eastAsset"], SEP)
2424
2525
2626 func keyWestAsset () = makeString(["%s", "westAsset"], SEP)
2727
2828
2929 func keyAssetStorage () = makeString(["%s", "assetStorage"], SEP)
3030
3131
3232 func keyBAssetId () = "B_asset_id"
3333
3434
3535 func dataAssetCfg (_contractId,_assetId,_backingRatio,_liquidationCollateral) = makeString(["%s%s%d%d", _contractId, _assetId, toString(_backingRatio), toString(_liquidationCollateral)], SEP)
3636
3737
3838 func initialized () = valueOrElse(getBoolean(this, keyInitialized()), false)
3939
4040
4141 func isOwner (i) = (this == i.caller)
4242
4343
4444 func adminAddressOrUnit () = match getString(this, keyAdmin()) {
4545 case s: String =>
4646 Address(fromBase58String(s))
4747 case _: Unit =>
4848 unit
4949 case _ =>
5050 throw("Match error")
5151 }
5252
5353
5454 func int0 (k) = valueOrElse(getInteger(this, k), 0)
5555
5656
5757 func mustAdmin (i) = {
5858 let pd = throw("permission denied")
5959 match adminAddressOrUnit() {
6060 case address: Address =>
6161 if ((i.caller == address))
6262 then true
6363 else pd
6464 case _: Unit =>
6565 if ((i.caller == this))
6666 then true
6767 else pd
6868 case _ =>
6969 throw("Match error")
7070 }
7171 }
7272
7373
7474 func checkContractAndAsset (_assetId,_contractId) = {
7575 let contractId = Address(fromBase58String(_contractId))
7676 let assetId = valueOrErrorMessage(getString(contractId, keyBAssetId()), "Wrong contract id")
7777 if ((assetId != _assetId))
7878 then throw("Wrong asset id")
7979 else nil
8080 }
8181
8282
8383 func checkRanges (value) = if (if ((value > 0))
8484 then (300 > value)
8585 else false)
8686 then true
8787 else throw("Out of range")
8888
8989
9090 @Callable(i)
9191 func initialize (_assetStoreAddress,_westAssetId) = if (if (initialized())
9292 then isOwner(i)
9393 else false)
9494 then throw("Not allowed")
9595 else {
9696 let east = Issue("East", "", 0, 8, true, unit, 0)
9797 let _eastAssetId = calculateAssetId(east)
9898 [StringEntry(keyEastAsset(), toBase58String(_eastAssetId)), StringEntry(keyWestAsset(), _westAssetId), BooleanEntry(keyInitialized(), true)]
9999 }
100100
101101
102102
103103 @Callable(i)
104-func setAdmin (_address) = {
105- let check = if (initialized())
106- then mustAdmin(i)
107- else false
108- if ((check == check))
109- then if (!(check))
110- then throw("Not allowed")
111- else [StringEntry(keyAdmin(), _address)]
112- else throw("Strict value is not equal to itself.")
113- }
104+func setAdmin (_address) = [StringEntry(keyAdmin(), _address)]
114105
115106
116107
117108 @Callable(i)
118109 func adminSetAssetStorage (_address) = {
119110 let check = if (initialized())
120111 then mustAdmin(i)
121112 else false
122113 if ((check == check))
123114 then if (!(check))
124115 then throw("Not allowed")
125116 else [StringEntry(keyAssetStorage(), _address)]
126117 else throw("Strict value is not equal to itself.")
127118 }
128119
129120
130121
131122 @Callable(i)
132123 func adminSetAsset (_assetId,_contractId,_backingRatio,_liquidationCollateral) = {
133124 let inited = if (initialized())
134125 then mustAdmin(i)
135126 else false
136127 if ((inited == inited))
137128 then if (!(inited))
138129 then throw("Not allowed")
139130 else {
140131 let westAssetId = getStringValue(keyWestAsset())
141132 if ((westAssetId == _assetId))
142133 then throw("West asset is not allowed")
143134 else {
144135 let checks = [checkContractAndAsset(_assetId, _contractId), checkRanges(_backingRatio), checkRanges(_liquidationCollateral)]
145136 if ((checks == checks))
146137 then {
147138 let assetCfg = dataAssetCfg(_contractId, _assetId, _backingRatio, _liquidationCollateral)
148139 [StringEntry(keyAssetCfg(_assetId), assetCfg)]
149140 }
150141 else throw("Strict value is not equal to itself.")
151142 }
152143 }
153144 else throw("Strict value is not equal to itself.")
154145 }
155146
156147
157148 @Verifier(tx)
158149 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
159150

github/deemru/w8io/026f985 
28.45 ms