tx · 5cgqR8DJvrRMm5S1PFf2u4iFiGXJvt9pqt2oH75DAaUp

3N1ytAUyhtig9X6F2hHHs1jbzYxr47Yp8Fr:  -0.00500000 Waves

2024.09.26 09:57 [3300251] smart account 3N1ytAUyhtig9X6F2hHHs1jbzYxr47Yp8Fr > SELF 0.00000000 Waves

{ "type": 13, "id": "5cgqR8DJvrRMm5S1PFf2u4iFiGXJvt9pqt2oH75DAaUp", "fee": 500000, "feeAssetId": null, "timestamp": 1727333903899, "version": 2, "chainId": 84, "sender": "3N1ytAUyhtig9X6F2hHHs1jbzYxr47Yp8Fr", "senderPublicKey": "jXCTQV8PjX2uC9UHBFveupYy9cjhY7stHbzE9cptymw", "proofs": [ "4we4HDjZSK2odX3iPeegvvDJYetRYXHc2Mu5kmVnWmEyskLJYxTDnr7RQdvqZQZAEx5RKFoRT9kYBi4L9cTE1jdg" ], "script": "base64:BwITCAISAwoBCBIECgICGBIECgICGCAACXNlcGFyYXRvcgICX18AC3dhdmVzU3RyaW5nAgVXQVZFUwAQY29udHJhY3RGaWxlbmFtZQIXbWVtZV9pbV9jYWxjdWxhdG9yLnJpZGUABW11bHQ4AIDC1y8BB3dyYXBFcnIBAXMJAKwCAgkArAICBRBjb250cmFjdEZpbGVuYW1lAgI6IAUBcwEIdGhyb3dFcnIBAXMJAAIBCQEHd3JhcEVycgEFAXMBD3ZhbGlkYXRlQWRkcmVzcwEHYWRkcmVzcwkBCWlzRGVmaW5lZAEJAKYIAQUHYWRkcmVzcwAMU1RBVFVTX0VNUFRZAAAADFNUQVRVU19SRUFEWQABAAlrU2h1dGRvd24CDnNodXRkb3duX19mbGFnAAtrUHJpY2VBc3NldAIMcHJpY2VfX2Fzc2V0AA5rTGlzdGluZ1ZvbHVtZQIPbGlzdGluZ19fdm9sdW1lABFrUG9vbENvbnRyYWN0SGFzaAIUcG9vbF9fY29udHJhY3RfX2hhc2gAE2tMYXN0RW1wdHlQb29sSW5kZXgCF2xhc3RfX2VtcHR5X3Bvb2xf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Ga Next: CRrcKDGeT7Q8cSiekc59tc1nvUjKuv8fLk1559cwH2PQ Diff:
OldNewDifferences
9191 func poolContractHash () = valueOrErrorMessage(getBinary(factoryAddress, kPoolContractHash), wrapErr("pool contract script hash is not set"))
9292
9393
94-func isPoolAddressExists (address) = match getInteger(factoryAddress, kPoolIndexFromAddress(address)) {
95- case t: Int =>
96- true
97- case _ =>
98- false
99-}
100-
101-
10294 @Callable(i)
10395 func init (factoryAddressStr) = {
10496 let checkCaller = mustThis(i.caller)
113105 func addEmptyPool (callerPublicKey,args) = {
114106 let newPoolAddress = addressFromPublicKey(callerPublicKey)
115107 let newPoolIndex = (lastEmptyIndex + 1)
116- let checks = [if (!(isPoolAddressExists(newPoolAddress)))
108+ let checks = [if (!(isDefined(getInteger(factoryAddress, kPoolIndexFromAddress(newPoolAddress)))))
117109 then true
118110 else throwErr("pool address is already registered")]
119111 if ((checks == checks))
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 7 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let separator = "__"
55
66 let wavesString = "WAVES"
77
88 let contractFilename = "meme_im_calculator.ride"
99
1010 let mult8 = 100000000
1111
1212 func wrapErr (s) = ((contractFilename + ": ") + s)
1313
1414
1515 func throwErr (s) = throw(wrapErr(s))
1616
1717
1818 func validateAddress (address) = isDefined(addressFromString(address))
1919
2020
2121 let STATUS_EMPTY = 0
2222
2323 let STATUS_READY = 1
2424
2525 let kShutdown = "shutdown__flag"
2626
2727 let kPriceAsset = "price__asset"
2828
2929 let kListingVolume = "listing__volume"
3030
3131 let kPoolContractHash = "pool__contract__hash"
3232
3333 let kLastEmptyPoolIndex = "last__empty_pool__index"
3434
3535 let kFirstEmptyPoolIndex = "first__empty__pool__index"
3636
3737 func kPoolAddressFromIndex (index) = makeString(["pool", toString(index)], separator)
3838
3939
4040 func kPoolIndexFromAddress (address) = makeString(["pool", toString(address)], separator)
4141
4242
4343 func kPoolAsset (address) = makeString(["asset", toString(address)], separator)
4444
4545
4646 func kPoolStatus (index) = makeString(["pool", "status", toString(index)], separator)
4747
4848
4949 let kFactoryAddress = "factory__address"
5050
5151 let factoryAddressOption = match getString(this, kFactoryAddress) {
5252 case s: String =>
5353 addressFromString(s)
5454 case _: Unit =>
5555 unit
5656 case _ =>
5757 throw("Match error")
5858 }
5959
6060 let factoryAddress = valueOrErrorMessage(factoryAddressOption, wrapErr("invalid factory address"))
6161
6262 let shutdown = valueOrElse(getBoolean(factoryAddress, kShutdown), false)
6363
6464 let lastEmptyIndex = valueOrElse(getInteger(factoryAddress, kLastEmptyPoolIndex), 0)
6565
6666 let firstEmptyIndex = valueOrElse(getInteger(factoryAddress, kFirstEmptyPoolIndex), 0)
6767
6868 let listingVolume = valueOrElse(getInteger(factoryAddress, kListingVolume), 0)
6969
7070 func parseAssetId (input) = if ((input == wavesString))
7171 then unit
7272 else fromBase58String(input)
7373
7474
7575 func assetIdToString (input) = if ((input == unit))
7676 then wavesString
7777 else toBase58String(value(input))
7878
7979
8080 func mustAddress (caller,address) = if ((caller == address))
8181 then true
8282 else throwErr("permission denied")
8383
8484
8585 func mustThis (caller) = mustAddress(caller, this)
8686
8787
8888 func mustFactory (caller) = mustAddress(caller, factoryAddress)
8989
9090
9191 func poolContractHash () = valueOrErrorMessage(getBinary(factoryAddress, kPoolContractHash), wrapErr("pool contract script hash is not set"))
9292
9393
94-func isPoolAddressExists (address) = match getInteger(factoryAddress, kPoolIndexFromAddress(address)) {
95- case t: Int =>
96- true
97- case _ =>
98- false
99-}
100-
101-
10294 @Callable(i)
10395 func init (factoryAddressStr) = {
10496 let checkCaller = mustThis(i.caller)
10597 if ((checkCaller == checkCaller))
10698 then [StringEntry(kFactoryAddress, factoryAddressStr)]
10799 else throw("Strict value is not equal to itself.")
108100 }
109101
110102
111103
112104 @Callable(i)
113105 func addEmptyPool (callerPublicKey,args) = {
114106 let newPoolAddress = addressFromPublicKey(callerPublicKey)
115107 let newPoolIndex = (lastEmptyIndex + 1)
116- let checks = [if (!(isPoolAddressExists(newPoolAddress)))
108+ let checks = [if (!(isDefined(getInteger(factoryAddress, kPoolIndexFromAddress(newPoolAddress)))))
117109 then true
118110 else throwErr("pool address is already registered")]
119111 if ((checks == checks))
120112 then {
121113 let factoryActions = [invoke(factoryAddress, "integerEntry", [kLastEmptyPoolIndex, newPoolIndex], nil), invoke(factoryAddress, "stringEntry", [kPoolAddressFromIndex(newPoolIndex), toString(newPoolAddress)], nil), invoke(factoryAddress, "integerEntry", [kPoolIndexFromAddress(newPoolAddress), newPoolIndex], nil), invoke(factoryAddress, "integerEntry", [kPoolStatus(newPoolIndex), STATUS_EMPTY], nil)]
122114 $Tuple2(nil, factoryActions)
123115 }
124116 else throw("Strict value is not equal to itself.")
125117 }
126118
127119
128120
129121 @Callable(i)
130122 func createPool (callerPublicKey,args) = {
131123 let checks = [if (!(shutdown))
132124 then true
133125 else throwErr("not allowed (shutdown)"), mustFactory(i.caller), if (((lastEmptyIndex - firstEmptyIndex) > 0))
134126 then true
135127 else throwErr("no empty pools available"), if ((i.payments[1].assetId == unit))
136128 then true
137129 else throwErr("price asset should be WAVES"), if ((i.payments[1].amount > listingVolume))
138130 then true
139131 else throwErr("payment[1] amount should be greater than listing volume"), if ((i.payments[0].assetId != unit))
140132 then true
141133 else throwErr("amount asset cannot be WAVES"), if ((i.payments[0].amount > 0))
142134 then true
143135 else throwErr("payment[0] amount should be greater than 0")]
144136 if ((checks == checks))
145137 then {
146138 let amountAssetId = i.payments[0].assetId
147139 let amountAssetIdString = assetIdToString(amountAssetId)
148140 let poolIndex = (firstEmptyIndex + 1)
149141 let poolAddressString = getStringValue(factoryAddress, kPoolAddressFromIndex(poolIndex))
150142 let poolAddress = addressFromStringValue(poolAddressString)
151143 let actions = [ScriptTransfer(poolAddress, i.payments[0].amount, i.payments[0].assetId), ScriptTransfer(poolAddress, i.payments[1].amount, i.payments[1].assetId)]
152144 let factoryActions = [invoke(factoryAddress, "stringEntry", [kPoolAsset(poolAddress), amountAssetIdString], nil), invoke(factoryAddress, "integerEntry", [kFirstEmptyPoolIndex, poolIndex], nil), invoke(factoryAddress, "integerEntry", [kPoolStatus(poolIndex), STATUS_READY], nil)]
153145 $Tuple2(actions, factoryActions)
154146 }
155147 else throw("Strict value is not equal to itself.")
156148 }
157149
158150

github/deemru/w8io/026f985 
29.91 ms