tx · C5oyaBp1iehmgGE7G72THfrhpKjSYgMGcSgxmVkzJSCk

3N5TDZHiXyXByfTA47imbhEqAbzAupJR5xY:  -0.01000000 Waves

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

{ "type": 13, "id": "C5oyaBp1iehmgGE7G72THfrhpKjSYgMGcSgxmVkzJSCk", "fee": 1000000, "feeAssetId": null, "timestamp": 1669151452644, "version": 2, "chainId": 84, "sender": "3N5TDZHiXyXByfTA47imbhEqAbzAupJR5xY", "senderPublicKey": "9rkQ1ChfNZ585cJFqVhjLk1mTNMXT93CZidHoYERtHML", "proofs": [ "5WuzC6Qy5qGExrVHeQpMDEbtijxVa21rV9erp5MTXJm7Bdhg4HnGMCE2JAVEBc9ddyiHoQZxQsLduV32ULFt1rut" ], "script": "base64:BgIXCAISBAoCCAgSAwoBCBIGCgQICAEBEgAYAANTRVACAl9fAAVFTVBUWQIAAAlQUkVDSVNJT04AgICQu7rWrfANAAhERUNJTUFMUwCAwtcvAAlXRVNUX1BBUlQJAGkCBQlQUkVDSVNJT04ABQAQSWR4QXNzZXRDb250cmFjdAABABRJZHhBc3NldEJhY2tpbmdSYXRpbwACAQtrZXlBc3NldENmZwEMYmFzZUFzc2V0U3RyCQC5CQIJAMwIAgIGJXMlcyVzCQDMCAICBmNvbmZpZwkAzAgCAgVhc3NldAkAzAgCBQxiYXNlQXNzZXRTdHIFA25pbAUDU0VQAQ5rZXlJbml0aWFsaXplZAAJALkJAgkAzAgCAgIlcwkAzAgCAgtpbml0aWFsaXplZAUDbmlsBQNTRVABCGtleUFkbWluAAkAuQkCCQDMCAICAiVzCQDMCAICBWFkbWluBQNuaWwFA1NFUAEMa2V5RWFzdEFzc2V0AAkAuQkCCQDMCAICAiVzCQDMCAICCWVhc3RBc3NldAUDbmlsBQNTRVABDGtleVdlc3RBc3NldAAJALkJAgkAzAgCAgIlcwkAzAgCAgl3ZXN0QXNzZXQFA25pb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FA25pbAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgFpAQRtaW50AAQHcGF5bWVudAkAkQMCCAUBaQhwYXltZW50cwAAAwkBAiE9AgkAkAMBCAUBaQhwYXltZW50cwABCQACAQIVV3JvbmcgcGF5bWVudHMgYW1vdW50BAdhc3NldElkBAckbWF0Y2gwCAUHcGF5bWVudAdhc3NldElkAwkAAQIFByRtYXRjaDACCkJ5dGVWZWN0b3IEAmlkBQckbWF0Y2gwCQDYBAEFAmlkAwkAAQIFByRtYXRjaDACBFVuaXQEBXdhdmVzBQckbWF0Y2gwAgVXQVZFUwkAAgECC01hdGNoIGVycm9yBAhhc3NldENmZwkAtQkCCQETdmFsdWVPckVycm9yTWVzc2FnZQIJAKIIAQkBC2tleUFzc2V0Q2ZnAQUHYXNzZXRJZAINVW5rbm93biBhc3NldAUDU0VQBApjb250cmFjdElkCQCRAwIFCGFzc2V0Q2ZnBRBJZHhBc3NldENvbnRyYWN0BAxiYWNraW5nUmF0aW8JAJEDAgUIYXNzZXRDZmcFFElkeEFzc2V0QmFja2luZ1JhdGlvBAF4CQACAQkArAICBQpjb250cmFjdElkBQxiYWNraW5nUmF0aW8FA25pbAECdHgBBnZlcmlmeQAJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXkOcuac", "height": 2328853, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BHv9ZgHxzBHTkXFoZnTLUvbeBZPRYcVjfMRvBfdJAAjD Next: 4TgRwQ2rZ6jxcA7u1rDp4SHVvoGxomJ7qENhAs5dt3Wo 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 ((assetId != _assetId))
84+ if (if ((assetId != "WAVES"))
85+ then (assetId != _assetId)
86+ else false)
8587 then throw("Wrong asset id")
8688 else nil
8789 }
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 ((assetId != _assetId))
84+ if (if ((assetId != "WAVES"))
85+ then (assetId != _assetId)
86+ else false)
8587 then throw("Wrong asset id")
8688 else nil
8789 }
8890
8991
9092 func checkAddress (_address) = match addressFromString(_address) {
9193 case address: Address =>
9294 true
9395 case _: Unit =>
9496 throw("Invalid address")
9597 case _ =>
9698 throw("Match error")
9799 }
98100
99101
100102 func checkRanges (value) = if (if ((value > 0))
101103 then (300 > value)
102104 else false)
103105 then true
104106 else throw("Out of range")
105107
106108
107109 @Callable(i)
108110 func initialize (_assetStoreAddress,_westAssetId) = if (if (initialized())
109111 then isOwner(i)
110112 else false)
111113 then throw("Not allowed")
112114 else {
113115 let east = Issue("East", "", 0, 8, true, unit, 0)
114116 let _eastAssetId = calculateAssetId(east)
115117 [StringEntry(keyEastAsset(), toBase58String(_eastAssetId)), StringEntry(keyWestAsset(), _westAssetId), BooleanEntry(keyInitialized(), true)]
116118 }
117119
118120
119121
120122 @Callable(i)
121123 func setAdmin (_address) = {
122124 let check = if (if (initialized())
123125 then mustAdmin(i)
124126 else false)
125127 then checkAddress(_address)
126128 else false
127129 if ((check == check))
128130 then if (!(check))
129131 then throw("Not allowed")
130132 else [StringEntry(keyAdmin(), _address)]
131133 else throw("Strict value is not equal to itself.")
132134 }
133135
134136
135137
136138 @Callable(i)
137139 func adminSetAsset (_assetId,_contractId,_backingRatio,_liquidationCollateral) = {
138140 let inited = if (initialized())
139141 then mustAdmin(i)
140142 else false
141143 if ((inited == inited))
142144 then if (!(inited))
143145 then throw("Not allowed")
144146 else {
145147 let westAssetId = getStringValue(keyWestAsset())
146148 if ((westAssetId == _assetId))
147149 then throw("West asset is not allowed")
148150 else {
149151 let checks = [checkContractAndAsset(_assetId, _contractId), checkRanges(_backingRatio), checkRanges(_liquidationCollateral)]
150152 if ((checks == checks))
151153 then {
152154 let assetCfg = dataAssetCfg(_assetId, _contractId, _backingRatio, _liquidationCollateral)
153155 [StringEntry(keyAssetCfg(_assetId), assetCfg)]
154156 }
155157 else throw("Strict value is not equal to itself.")
156158 }
157159 }
158160 else throw("Strict value is not equal to itself.")
159161 }
160162
161163
162164
163165 @Callable(i)
164166 func mint () = {
165167 let payment = i.payments[0]
166168 if ((size(i.payments) != 1))
167169 then throw("Wrong payments amount")
168170 else {
169171 let assetId = match payment.assetId {
170172 case id: ByteVector =>
171173 toBase58String(id)
172174 case waves: Unit =>
173175 "WAVES"
174176 case _ =>
175177 throw("Match error")
176178 }
177179 let assetCfg = split(valueOrErrorMessage(getString(keyAssetCfg(assetId)), "Unknown asset"), SEP)
178180 let contractId = assetCfg[IdxAssetContract]
179181 let backingRatio = assetCfg[IdxAssetBackingRatio]
180182 let x = throw((contractId + backingRatio))
181183 nil
182184 }
183185 }
184186
185187
186188 @Verifier(tx)
187189 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
188190

github/deemru/w8io/026f985 
27.57 ms