tx · sTiEhi8Rsjez3i71cow48R9VLVG5112NopvMH38XLeh

3N1ytAUyhtig9X6F2hHHs1jbzYxr47Yp8Fr:  -0.00400000 Waves

2024.09.24 08:52 [3297269] smart account 3N1ytAUyhtig9X6F2hHHs1jbzYxr47Yp8Fr > SELF 0.00000000 Waves

{ "type": 13, "id": "sTiEhi8Rsjez3i71cow48R9VLVG5112NopvMH38XLeh", "fee": 400000, "feeAssetId": null, "timestamp": 1727157155798, "version": 1, "sender": "3N1ytAUyhtig9X6F2hHHs1jbzYxr47Yp8Fr", "senderPublicKey": "jXCTQV8PjX2uC9UHBFveupYy9cjhY7stHbzE9cptymw", "proofs": [ "2padZL7BKzq1DEQVHnCY7SKt9WysNvYJyqhUqhHREKKaoM8Rsy5aEQ2mu3UkrNkowZFr5dQDoPUdz6e6947swwLE" ], "script": "base64:BwIOCAISBAoCAhgSBAoCAhggAAlzZXBhcmF0b3ICAl9fAAt3YXZlc1N0cmluZwIFV0FWRVMAEGNvbnRyYWN0RmlsZW5hbWUCF21lbWVfaW1fY2FsY3VsYXRvci5yaWRlAAVtdWx0OACAwtcvAQd3cmFwRXJyAQFzCQCsAgIJAKwCAgUQY29udHJhY3RGaWxlbmFtZQICOiAFAXMBCHRocm93RXJyAQFzCQACAQkBB3dyYXBFcnIBBQFzAQ92YWxpZGF0ZUFkZHJlc3MBB2FkZHJlc3MJAQlpc0RlZmluZWQBCQCmCAEFB2FkZHJlc3MADFNUQVRVU19FTVBUWQAAAAxTVEFUVVNfUkVBRFkAAQAJa1NodXRkb3duAgwlc19fc2h1dGRvd24AC2tQcmljZUFzc2V0AgxwcmljZV9fYXNzZXQADmtMaXN0aW5nVm9sdW1lAg5saXN0aW5nX3ZvbHVtZQARa1Bvb2xDb250cmFjdEhhc2gCEnBvb2xfY29udHJhY3RfaGFzaAATa0xhc3RFbXB0eVBvb2xJbmRleAIXbGFzdF9fZW1wdHlfcG9vbF9faW5kZXgAFGtGaXJzdEVtcHR5UG9vbEluZGV4Ahl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zcwkAzAgCBRNhbW91bnRBc3NldElkU3RyaW5nBQNuaWwFA25pbAkAzAgCCQD8BwQFDmZhY3RvcnlBZGRyZXNzAgxpbnRlZ2VyRW50cnkJAMwIAgUUa0ZpcnN0RW1wdHlQb29sSW5kZXgJAMwIAgUJcG9vbEluZGV4BQNuaWwFA25pbAkAzAgCCQD8BwQFDmZhY3RvcnlBZGRyZXNzAgxpbnRlZ2VyRW50cnkJAMwIAgkBC2tQb29sU3RhdHVzAQUJcG9vbEluZGV4CQDMCAIFDFNUQVRVU19SRUFEWQUDbmlsBQNuaWwFA25pbAkAlAoCBQdhY3Rpb25zBQ5mYWN0b3J5QWN0aW9ucwkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgAP1c57", "chainId": 84, "height": 3297269, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: 42gY3RtuQJvDHNQwaPDAQkqS5MWd9yBnxHFZMNXSNGy9 Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 7 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let separator = "__"
5+
6+let wavesString = "WAVES"
7+
8+let contractFilename = "meme_im_calculator.ride"
9+
10+let mult8 = 100000000
11+
12+func wrapErr (s) = ((contractFilename + ": ") + s)
13+
14+
15+func throwErr (s) = throw(wrapErr(s))
16+
17+
18+func validateAddress (address) = isDefined(addressFromString(address))
19+
20+
21+let STATUS_EMPTY = 0
22+
23+let STATUS_READY = 1
24+
25+let kShutdown = "%s__shutdown"
26+
27+let kPriceAsset = "price__asset"
28+
29+let kListingVolume = "listing_volume"
30+
31+let kPoolContractHash = "pool_contract_hash"
32+
33+let kLastEmptyPoolIndex = "last__empty_pool__index"
34+
35+let kFirstEmptyPoolIndex = "first__empty__pool__index"
36+
37+func kPoolAddressFromIndex (index) = makeString(["pool", toString(index)], separator)
38+
39+
40+func kPoolIndexFromAddress (address) = makeString(["pool", toString(address)], separator)
41+
42+
43+func kPoolAsset (address) = makeString(["asset", toString(address)], separator)
44+
45+
46+func kPoolStatus (index) = makeString(["pool", "status", toString(index)], separator)
47+
48+
49+let kFactoryAddress = "%s__factoryAddress"
50+
51+let factoryAddressOption = match getString(this, kFactoryAddress) {
52+ case s: String =>
53+ addressFromString(s)
54+ case _: Unit =>
55+ unit
56+ case _ =>
57+ throw("Match error")
58+}
59+
60+let factoryAddress = valueOrErrorMessage(factoryAddressOption, wrapErr("invalid factory address"))
61+
62+let shutdown = valueOrElse(getBoolean(factoryAddress, kShutdown), false)
63+
64+let lastEmptyIndex = valueOrElse(getInteger(factoryAddress, kLastEmptyPoolIndex), 0)
65+
66+let firstEmptyIndex = valueOrElse(getInteger(factoryAddress, kFirstEmptyPoolIndex), 0)
67+
68+let listingVolume = valueOrElse(getInteger(factoryAddress, kListingVolume), 0)
69+
70+func parseAssetId (input) = if ((input == wavesString))
71+ then unit
72+ else fromBase58String(input)
73+
74+
75+func assetIdToString (input) = if ((input == unit))
76+ then wavesString
77+ else toBase58String(value(input))
78+
79+
80+func mustAddress (caller,address) = if ((caller == address))
81+ then true
82+ else throwErr("permission denied")
83+
84+
85+func mustThis (caller) = mustAddress(caller, this)
86+
87+
88+func mustFactory (caller) = mustAddress(caller, factoryAddress)
89+
90+
91+func poolContractHash () = valueOrErrorMessage(getBinary(factoryAddress, kPoolContractHash), wrapErr("pool contract script hash is not set"))
92+
93+
94+@Callable(i)
95+func addEmptyPool (callerPublicKey,args) = {
96+ let newPoolAddress = addressFromPublicKey(callerPublicKey)
97+ let newPoolIndex = (lastEmptyIndex + 1)
98+ 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)]
99+ $Tuple2(nil, factoryActions)
100+ }
101+
102+
103+
104+@Callable(i)
105+func createPool (callerPublicKey,args) = {
106+ let checks = [if (!(shutdown))
107+ then true
108+ else throwErr("not allowed (shutdown)"), mustFactory(i.caller), if (((lastEmptyIndex - firstEmptyIndex) > 0))
109+ then true
110+ else throwErr("no empty pools available"), if ((i.payments[1].assetId == unit))
111+ then true
112+ else throwErr("price asset should be WAVES"), if ((i.payments[1].amount > listingVolume))
113+ then true
114+ else throwErr("payment[1] amount should be greater than listing volume"), if ((i.payments[0].assetId != unit))
115+ then true
116+ else throwErr("amount asset cannot be WAVES"), if ((i.payments[0].amount > 0))
117+ then true
118+ else throwErr("payment[0] amount should be greater than 0")]
119+ if ((checks == checks))
120+ then {
121+ let amountAssetId = i.payments[0].assetId
122+ let amountAssetIdString = assetIdToString(amountAssetId)
123+ let poolIndex = (firstEmptyIndex + 1)
124+ let poolAddressString = getStringValue(factoryAddress, kPoolAddressFromIndex(poolIndex))
125+ let poolAddress = addressFromStringValue(poolAddressString)
126+ let actions = [ScriptTransfer(poolAddress, i.payments[0].amount, i.payments[0].assetId), ScriptTransfer(poolAddress, i.payments[1].amount, i.payments[1].assetId)]
127+ let factoryActions = [invoke(factoryAddress, "stringEntry", [kPoolAsset(poolAddress), amountAssetIdString], nil), invoke(factoryAddress, "integerEntry", [kFirstEmptyPoolIndex, poolIndex], nil), invoke(factoryAddress, "integerEntry", [kPoolStatus(poolIndex), STATUS_READY], nil)]
128+ $Tuple2(actions, factoryActions)
129+ }
130+ else throw("Strict value is not equal to itself.")
131+ }
132+
133+

github/deemru/w8io/169f3d6 
20.47 ms