tx · 4RVNdkzG28UGL3SwiGqBYrZa5S4U29cumRBA6mhp97zh

3N5TDZHiXyXByfTA47imbhEqAbzAupJR5xY:  -0.01000000 Waves

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

{ "type": 13, "id": "4RVNdkzG28UGL3SwiGqBYrZa5S4U29cumRBA6mhp97zh", "fee": 1000000, "feeAssetId": null, "timestamp": 1669142619858, "version": 2, "chainId": 84, "sender": "3N5TDZHiXyXByfTA47imbhEqAbzAupJR5xY", "senderPublicKey": "9rkQ1ChfNZ585cJFqVhjLk1mTNMXT93CZidHoYERtHML", "proofs": [ "3yjUuudwEjnHFqGZupgKZDxng4HLKJy4Qw21N2mpgegvcJaLmDezTFKKMaQ1oYKsXWKfFqTeniTVqYY6N5yKkGGh" ], "script": "base64:BgIaCAISBAoCCAgSAwoBCBIDCgEIEgYKBAgIAQEUAANTRVACAl9fAAVFTVBUWQIAAAlQUkVDSVNJT04AgICQu7rWrfANAAhERUNJTUFMUwCAwtcvAAlXRVNUX1BBUlQJAGkCBQlQUkVDSVNJT04ABQELa2V5QXNzZXRDZmcBDGJhc2VBc3NldFN0cgkAuQkCCQDMCAICBiVzJXMlcwkAzAgCAgZjb25maWcJAMwIAgIFYXNzZXQJAMwIAgUMYmFzZUFzc2V0U3RyBQNuaWwFA1NFUAEOa2V5SW5pdGlhbGl6ZWQACQC5CQIJAMwIAgICJXMJAMwIAgILaW5pdGlhbGl6ZWQFA25pbAUDU0VQAQhrZXlBZG1pbgAJALkJAgkAzAgCAgIlcwkAzAgCAgVhZG1pbgUDbmlsBQNTRVABDGtleUVhc3RBc3NldAAJALkJAgkAzAgCAgIlcwkAzAgCAgllYXN0QXNzZXQFA25pbAUDU0VQAQxrZXlXZXN0QXNzZXQACQC5CQIJAMwIAgICJXMJAMwIAgIJd2VzdEFzc2V0BQNuaWwFA1NFUAEPa2V5QXNzZXRTdG9yYWdlAAkAuQkCCQDMC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HVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAQJ0eAEGdmVyaWZ5AAkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleaz0UT0=", "height": 2328694, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9PwexppAvEuzWqshMVjCXUg6mhJG49fn6UtqMGh2tYJo Next: BHv9ZgHxzBHTkXFoZnTLUvbeBZPRYcVjfMRvBfdJAAjD Diff:
OldNewDifferences
102102
103103 @Callable(i)
104104 func setAdmin (_address) = {
105- let isAddressCorrect = Address(fromBase58String(_address))
105+ let isAddressCorrect = addressFromStringValue(_address)
106106 if ((isAddressCorrect == isAddressCorrect))
107107 then [StringEntry(keyAdmin(), _address)]
108108 else throw("Strict value is not equal to itself.")
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)
104104 func setAdmin (_address) = {
105- let isAddressCorrect = Address(fromBase58String(_address))
105+ let isAddressCorrect = addressFromStringValue(_address)
106106 if ((isAddressCorrect == isAddressCorrect))
107107 then [StringEntry(keyAdmin(), _address)]
108108 else throw("Strict value is not equal to itself.")
109109 }
110110
111111
112112
113113 @Callable(i)
114114 func adminSetAssetStorage (_address) = {
115115 let check = if (initialized())
116116 then mustAdmin(i)
117117 else false
118118 if ((check == check))
119119 then if (!(check))
120120 then throw("Not allowed")
121121 else [StringEntry(keyAssetStorage(), _address)]
122122 else throw("Strict value is not equal to itself.")
123123 }
124124
125125
126126
127127 @Callable(i)
128128 func adminSetAsset (_assetId,_contractId,_backingRatio,_liquidationCollateral) = {
129129 let inited = if (initialized())
130130 then mustAdmin(i)
131131 else false
132132 if ((inited == inited))
133133 then if (!(inited))
134134 then throw("Not allowed")
135135 else {
136136 let westAssetId = getStringValue(keyWestAsset())
137137 if ((westAssetId == _assetId))
138138 then throw("West asset is not allowed")
139139 else {
140140 let checks = [checkContractAndAsset(_assetId, _contractId), checkRanges(_backingRatio), checkRanges(_liquidationCollateral)]
141141 if ((checks == checks))
142142 then {
143143 let assetCfg = dataAssetCfg(_contractId, _assetId, _backingRatio, _liquidationCollateral)
144144 [StringEntry(keyAssetCfg(_assetId), assetCfg)]
145145 }
146146 else throw("Strict value is not equal to itself.")
147147 }
148148 }
149149 else throw("Strict value is not equal to itself.")
150150 }
151151
152152
153153 @Verifier(tx)
154154 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
155155

github/deemru/w8io/026f985 
25.89 ms