tx · 4TgRwQ2rZ6jxcA7u1rDp4SHVvoGxomJ7qENhAs5dt3Wo

3N5TDZHiXyXByfTA47imbhEqAbzAupJR5xY:  -0.01000000 Waves

2022.11.23 00:10 [2328853] smart account 3N5TDZHiXyXByfTA47imbhEqAbzAupJR5xY > SELF 0.00000000 Waves

{ "type": 13, "id": "4TgRwQ2rZ6jxcA7u1rDp4SHVvoGxomJ7qENhAs5dt3Wo", "fee": 1000000, "feeAssetId": null, "timestamp": 1669151479999, "version": 2, "chainId": 84, "sender": "3N5TDZHiXyXByfTA47imbhEqAbzAupJR5xY", "senderPublicKey": "9rkQ1ChfNZ585cJFqVhjLk1mTNMXT93CZidHoYERtHML", "proofs": [ "4SW7PqPy5ZsJSEPeAVK94AwmyFxj4Xj1hWv7FbNbV3XBnnq7yqQCkRgQb1m89m4nXZ1JakozmECo8wQat924BELA" ], "script": "base64:BgIXCAISBAoCCAgSAwoBCBIGCgQICAEBEgAYAANTRVACAl9fAAVFTVBUWQIAAAlQUkVDSVNJT04AgICQu7rWrfANAAhERUNJTUFMUwCAwtcvAAlXRVNUX1BBUlQJAGkCBQlQUkVDSVNJT04ABQAQSWR4QXNzZXRDb250cmFjdAABABRJZHhBc3NldEJhY2tpbmdSYXRpbwACAQtrZXlBc3NldENmZwEMYmFzZUFzc2V0U3RyCQC5CQIJAMwIAgIGJXMlcyVzCQDMCAICBmNvbmZpZwkAzAgCAgVhc3NldAkAzAgCBQxiYXNlQXNzZXRTdHIFA25pbAUDU0VQAQ5rZXlJbml0aWFsaXplZAAJALkJAgkAzAgCAgIlcwkAzAgCAgtpbml0aWFsaXplZAUDbmlsBQNTRVABCGtleUFkbWluAAkAuQkCCQDMCAICAiVzCQDMCAICBWFkbWluBQNuaWwFA1NFUAEMa2V5RWFzdEFzc2V0AAkAuQkCCQDMCAICAiVzCQDMCAICCWVhc3RBc3NldAUDbmlsBQNTRVABDGtleVdlc3RBc3NldAAJALkJAgkAzAgCAgIlcwkAzAgCAgl3ZXN0QX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Q2ZnBQNuaWwJAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4JAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4BaQEEbWludAAEB3BheW1lbnQJAJEDAggFAWkIcGF5bWVudHMAAAMJAQIhPQIJAJADAQgFAWkIcGF5bWVudHMAAQkAAgECFVdyb25nIHBheW1lbnRzIGFtb3VudAQHYXNzZXRJZAQHJG1hdGNoMAgFB3BheW1lbnQHYXNzZXRJZAMJAAECBQckbWF0Y2gwAgpCeXRlVmVjdG9yBAJpZAUHJG1hdGNoMAkA2AQBBQJpZAMJAAECBQckbWF0Y2gwAgRVbml0BAV3YXZlcwUHJG1hdGNoMAIFV0FWRVMJAAIBAgtNYXRjaCBlcnJvcgQIYXNzZXRDZmcJALUJAgkBE3ZhbHVlT3JFcnJvck1lc3NhZ2UCCQCiCAEJAQtrZXlBc3NldENmZwEFB2Fzc2V0SWQCDVVua25vd24gYXNzZXQFA1NFUAQKY29udHJhY3RJZAkAkQMCBQhhc3NldENmZwUQSWR4QXNzZXRDb250cmFjdAQMYmFja2luZ1JhdGlvCQCRAwIFCGFzc2V0Q2ZnBRRJZHhBc3NldEJhY2tpbmdSYXRpbwQBeAkAAgEJAKwCAgUKY29udHJhY3RJZAUMYmFja2luZ1JhdGlvBQNuaWwBAnR4AQZ2ZXJpZnkACQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V5Xwznug==", "height": 2328853, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: C5oyaBp1iehmgGE7G72THfrhpKjSYgMGcSgxmVkzJSCk Next: Hj4M7iET1tsJWeQy8Le2kunqrVvPf9guYdjaXza1wSCT Diff:
OldNewDifferences
8181 func checkContractAndAsset (_assetId,_contractId) = {
8282 let contractId = Address(fromBase58String(_contractId))
8383 let assetId = valueOrErrorMessage(getString(contractId, keyBAssetId()), "Wrong contract id")
84- if (if ((assetId != "WAVES"))
84+ if (if ((_assetId != "WAVES"))
8585 then (assetId != _assetId)
8686 else false)
8787 then throw("Wrong asset id")
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 let IdxAssetContract = 1
1515
1616 let IdxAssetBackingRatio = 2
1717
1818 func keyAssetCfg (baseAssetStr) = makeString(["%s%s%s", "config", "asset", baseAssetStr], SEP)
1919
2020
2121 func keyInitialized () = makeString(["%s", "initialized"], SEP)
2222
2323
2424 func keyAdmin () = makeString(["%s", "admin"], SEP)
2525
2626
2727 func keyEastAsset () = makeString(["%s", "eastAsset"], SEP)
2828
2929
3030 func keyWestAsset () = makeString(["%s", "westAsset"], SEP)
3131
3232
3333 func keyAssetStorage () = makeString(["%s", "assetStorage"], SEP)
3434
3535
3636 func keyBAssetId () = "B_asset_id"
3737
3838
3939 func dataAssetCfg (_assetId,_contractId,_backingRatio,_liquidationCollateral) = makeString(["%s%s%d%d", _assetId, _contractId, toString(_backingRatio), toString(_liquidationCollateral)], SEP)
4040
4141
4242 func initialized () = valueOrElse(getBoolean(this, keyInitialized()), false)
4343
4444
4545 func isOwner (i) = (this == i.caller)
4646
4747
4848 func adminAddressOrUnit () = match getString(this, keyAdmin()) {
4949 case s: String =>
5050 Address(fromBase58String(s))
5151 case _: Unit =>
5252 unit
5353 case _ =>
5454 throw("Match error")
5555 }
5656
5757
5858 func eastAsset () = getStringValue(this, keyEastAsset())
5959
6060
6161 func int0 (k) = valueOrElse(getInteger(this, k), 0)
6262
6363
6464 func mustAdmin (i) = {
6565 let pd = throw("permission denied")
6666 match adminAddressOrUnit() {
6767 case address: Address =>
6868 if ((i.caller == address))
6969 then true
7070 else pd
7171 case _: Unit =>
7272 if ((i.caller == this))
7373 then true
7474 else pd
7575 case _ =>
7676 throw("Match error")
7777 }
7878 }
7979
8080
8181 func checkContractAndAsset (_assetId,_contractId) = {
8282 let contractId = Address(fromBase58String(_contractId))
8383 let assetId = valueOrErrorMessage(getString(contractId, keyBAssetId()), "Wrong contract id")
84- if (if ((assetId != "WAVES"))
84+ if (if ((_assetId != "WAVES"))
8585 then (assetId != _assetId)
8686 else false)
8787 then throw("Wrong asset id")
8888 else nil
8989 }
9090
9191
9292 func checkAddress (_address) = match addressFromString(_address) {
9393 case address: Address =>
9494 true
9595 case _: Unit =>
9696 throw("Invalid address")
9797 case _ =>
9898 throw("Match error")
9999 }
100100
101101
102102 func checkRanges (value) = if (if ((value > 0))
103103 then (300 > value)
104104 else false)
105105 then true
106106 else throw("Out of range")
107107
108108
109109 @Callable(i)
110110 func initialize (_assetStoreAddress,_westAssetId) = if (if (initialized())
111111 then isOwner(i)
112112 else false)
113113 then throw("Not allowed")
114114 else {
115115 let east = Issue("East", "", 0, 8, true, unit, 0)
116116 let _eastAssetId = calculateAssetId(east)
117117 [StringEntry(keyEastAsset(), toBase58String(_eastAssetId)), StringEntry(keyWestAsset(), _westAssetId), BooleanEntry(keyInitialized(), true)]
118118 }
119119
120120
121121
122122 @Callable(i)
123123 func setAdmin (_address) = {
124124 let check = if (if (initialized())
125125 then mustAdmin(i)
126126 else false)
127127 then checkAddress(_address)
128128 else false
129129 if ((check == check))
130130 then if (!(check))
131131 then throw("Not allowed")
132132 else [StringEntry(keyAdmin(), _address)]
133133 else throw("Strict value is not equal to itself.")
134134 }
135135
136136
137137
138138 @Callable(i)
139139 func adminSetAsset (_assetId,_contractId,_backingRatio,_liquidationCollateral) = {
140140 let inited = if (initialized())
141141 then mustAdmin(i)
142142 else false
143143 if ((inited == inited))
144144 then if (!(inited))
145145 then throw("Not allowed")
146146 else {
147147 let westAssetId = getStringValue(keyWestAsset())
148148 if ((westAssetId == _assetId))
149149 then throw("West asset is not allowed")
150150 else {
151151 let checks = [checkContractAndAsset(_assetId, _contractId), checkRanges(_backingRatio), checkRanges(_liquidationCollateral)]
152152 if ((checks == checks))
153153 then {
154154 let assetCfg = dataAssetCfg(_assetId, _contractId, _backingRatio, _liquidationCollateral)
155155 [StringEntry(keyAssetCfg(_assetId), assetCfg)]
156156 }
157157 else throw("Strict value is not equal to itself.")
158158 }
159159 }
160160 else throw("Strict value is not equal to itself.")
161161 }
162162
163163
164164
165165 @Callable(i)
166166 func mint () = {
167167 let payment = i.payments[0]
168168 if ((size(i.payments) != 1))
169169 then throw("Wrong payments amount")
170170 else {
171171 let assetId = match payment.assetId {
172172 case id: ByteVector =>
173173 toBase58String(id)
174174 case waves: Unit =>
175175 "WAVES"
176176 case _ =>
177177 throw("Match error")
178178 }
179179 let assetCfg = split(valueOrErrorMessage(getString(keyAssetCfg(assetId)), "Unknown asset"), SEP)
180180 let contractId = assetCfg[IdxAssetContract]
181181 let backingRatio = assetCfg[IdxAssetBackingRatio]
182182 let x = throw((contractId + backingRatio))
183183 nil
184184 }
185185 }
186186
187187
188188 @Verifier(tx)
189189 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
190190

github/deemru/w8io/026f985 
32.43 ms