tx · 9PwexppAvEuzWqshMVjCXUg6mhJG49fn6UtqMGh2tYJo

3N5TDZHiXyXByfTA47imbhEqAbzAupJR5xY:  -0.01000000 Waves

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

{ "type": 13, "id": "9PwexppAvEuzWqshMVjCXUg6mhJG49fn6UtqMGh2tYJo", "fee": 1000000, "feeAssetId": null, "timestamp": 1669142546629, "version": 2, "chainId": 84, "sender": "3N5TDZHiXyXByfTA47imbhEqAbzAupJR5xY", "senderPublicKey": "9rkQ1ChfNZ585cJFqVhjLk1mTNMXT93CZidHoYERtHML", "proofs": [ "YViiGutBmSqCoh3QR2mqVL8LDTCztzMjD4Av7m448acG4xs3dKCn6gn6D8FwhDRT57gYPFdbjUJ6KBWwh1Yvavb" ], "script": "base64:BgIaCAISBAoCCAgSAwoBCBIDCgEIEgYKBAgIAQEUAANTRVACAl9fAAVFTVBUWQIAAAlQUkVDSVNJT04AgICQu7rWrfANAAhERUNJTUFMUwCAwtcvAAlXRVNUX1BBUlQJAGkCBQlQUkVDSVNJT04ABQELa2V5QXNzZXRDZmcBDGJhc2VBc3NldFN0cgkAuQkCCQDMCAICBiVzJXMlcwkAzAgCAgZjb25maWcJAMwIAgIFYXNzZXQJAMwIAgUMYmFzZUFzc2V0U3RyBQNuaWwFA1NFUAEOa2V5SW5pdGlhbGl6ZWQACQC5CQIJAMwIAgICJXMJAMwIAgILaW5pdGlhbGl6ZWQFA25pbAUDU0VQAQhrZXlBZG1pbgAJALkJAgkAzAgCAgIlcwkAzAgCAgVhZG1pbgUDbmlsBQNTRVABDGtleUVhc3RBc3NldAAJALkJAgkAzAgCAgIlcwkAzAgCAgllYXN0QXNzZXQFA25pbAUDU0VQAQxrZXlXZXN0QXNzZXQACQC5CQIJAMwIAgICJXMJAMwIAgIJd2VzdEFzc2V0BQNuaWwFA1NFUAEPa2V5QXNzZXRTdG9yYWdlAAkAuQkCCQDMCAIC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ZXF1YWwgdG8gaXRzZWxmLgECdHgBBnZlcmlmeQAJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXkK0nU4", "height": 2328694, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 6a7JYocrJow4W7uQF54hFEMez5X5kmbhosamSNeCSw5N Next: 4RVNdkzG28UGL3SwiGqBYrZa5S4U29cumRBA6mhp97zh Diff:
OldNewDifferences
101101
102102
103103 @Callable(i)
104-func setAdmin (_address) = [StringEntry(keyAdmin(), _address)]
104+func setAdmin (_address) = {
105+ let isAddressCorrect = Address(fromBase58String(_address))
106+ if ((isAddressCorrect == isAddressCorrect))
107+ then [StringEntry(keyAdmin(), _address)]
108+ else throw("Strict value is not equal to itself.")
109+ }
105110
106111
107112
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) = [StringEntry(keyAdmin(), _address)]
104+func setAdmin (_address) = {
105+ let isAddressCorrect = Address(fromBase58String(_address))
106+ if ((isAddressCorrect == isAddressCorrect))
107+ then [StringEntry(keyAdmin(), _address)]
108+ else throw("Strict value is not equal to itself.")
109+ }
105110
106111
107112
108113 @Callable(i)
109114 func adminSetAssetStorage (_address) = {
110115 let check = if (initialized())
111116 then mustAdmin(i)
112117 else false
113118 if ((check == check))
114119 then if (!(check))
115120 then throw("Not allowed")
116121 else [StringEntry(keyAssetStorage(), _address)]
117122 else throw("Strict value is not equal to itself.")
118123 }
119124
120125
121126
122127 @Callable(i)
123128 func adminSetAsset (_assetId,_contractId,_backingRatio,_liquidationCollateral) = {
124129 let inited = if (initialized())
125130 then mustAdmin(i)
126131 else false
127132 if ((inited == inited))
128133 then if (!(inited))
129134 then throw("Not allowed")
130135 else {
131136 let westAssetId = getStringValue(keyWestAsset())
132137 if ((westAssetId == _assetId))
133138 then throw("West asset is not allowed")
134139 else {
135140 let checks = [checkContractAndAsset(_assetId, _contractId), checkRanges(_backingRatio), checkRanges(_liquidationCollateral)]
136141 if ((checks == checks))
137142 then {
138143 let assetCfg = dataAssetCfg(_contractId, _assetId, _backingRatio, _liquidationCollateral)
139144 [StringEntry(keyAssetCfg(_assetId), assetCfg)]
140145 }
141146 else throw("Strict value is not equal to itself.")
142147 }
143148 }
144149 else throw("Strict value is not equal to itself.")
145150 }
146151
147152
148153 @Verifier(tx)
149154 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
150155

github/deemru/w8io/026f985 
22.91 ms