tx · 12Z1p7X3HLH9UNVgCDrT9t4qp3sEcCze1NbT9vVs1osu 3MxAdHSPHo4iVRecWvrS3waDZTEJBq9NKzh: -0.01400000 Waves 2021.10.07 13:40 [1735704] smart account 3MxAdHSPHo4iVRecWvrS3waDZTEJBq9NKzh > SELF 0.00000000 Waves
{ "type": 13, "id": "12Z1p7X3HLH9UNVgCDrT9t4qp3sEcCze1NbT9vVs1osu", "fee": 1400000, "feeAssetId": null, "timestamp": 1633603254320, "version": 1, "sender": "3MxAdHSPHo4iVRecWvrS3waDZTEJBq9NKzh", "senderPublicKey": "At2YdsZAdxWR6iQ2tZ9is8nmd6syQ3YhzGyBGwYFyk9d", "proofs": [ "2VrMp4JYLF9Ex8t4kkeVW6aTUrrUSLsK4NKovJtn2nSS6QTTKLffr6CuYQr5pdwr7XQLNyNQWNU4VVpRrLecdeWR" ], "script": "base64:AAIFAAAAAAAAAA4IAhIDCgEIEgASAwoBCAAAAB8AAAAAA1NFUAIAAAACX18AAAAABnNjYWxlOAAAAAAABfXhAAAAAAARcG9vbFN0YXRzUHJpY2VLZXkAAAAAAAAAAAQAAAAADmlkeFBvb2xBZGRyZXNzAAAAAAAAAAABAAAAAA1pZHhQb29sU3RhdHVzAAAAAAAAAAACAAAAABBpZHhQb29sTFBBc3NldElkAAAAAAAAAAADAAAAAA1pZHhBbXRBc3NldElkAAAAAAAAAAAEAAAAAA9pZHhQcmljZUFzc2V0SWQAAAAAAAAAAAUAAAAADmlkeEFtdEFzc2V0RGNtAAAAAAAAAAAGAAAAABBpZHhQcmljZUFzc2V0RGNtAAAAAAAAAAAHAAAAAA5pZHhJQW10QXNzZXRJZAAAAAAAAAAACAAAAAAQaWR4SVByaWNlQXNzZXRJZAAAAAAAAAAACQAAAAANaWR4TFBBc3NldERjbQAAAAAAAAAACgAAAAATaWR4TWF0Y2hlclB1YmxpY0tleQAAAAAAAAAACwEAAAAOa2V5UmVnaXN0ZXJQdXQAAAACAAAAC3Bvb2xBZGRyZXNzAAAAB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EFzc2V0QW10CQAETAAAAAIJAQAAAA9BdHRhY2hlZFBheW1lbnQAAAACBQAAAAxwcmljZUFzc2V0SWQFAAAAE3Jlc3VsdFByaWNlQXNzZXRBbXQFAAAAA25pbAMJAAAAAAAAAgUAAAAFbHBQdXQFAAAABWxwUHV0CQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAIJAQAAABFrZXlSZWdpc3RlckludmVzdAAAAAIFAAAAC3Bvb2xBZGRyZXNzCQACWAAAAAEIBQAAAAFpAAAADXRyYW5zYWN0aW9uSWQJAQAAABRkYXRhSW52ZXN0QWN0aW9uSW5mbwAAAAQFAAAAFHJlc3VsdEFtb3VudEFzc2V0QW10BQAAABNyZXN1bHRQcmljZUFzc2V0QW10BQAAAAZoZWlnaHQIBQAAAAlsYXN0QmxvY2sAAAAJdGltZXN0YW1wBQAAAANuaWwJAAACAAAAAQIAAAAkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQAAAgAAAAECAAAAJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5L7zSSg==", "chainId": 84, "height": 1735704, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let SEP = "__" | |
5 | + | ||
6 | + | let scale8 = 100000000 | |
7 | + | ||
8 | + | let poolStatsPriceKey = 4 | |
9 | + | ||
10 | + | let idxPoolAddress = 1 | |
11 | + | ||
12 | + | let idxPoolStatus = 2 | |
13 | + | ||
14 | + | let idxPoolLPAssetId = 3 | |
15 | + | ||
16 | + | let idxAmtAssetId = 4 | |
17 | + | ||
18 | + | let idxPriceAssetId = 5 | |
19 | + | ||
20 | + | let idxAmtAssetDcm = 6 | |
21 | + | ||
22 | + | let idxPriceAssetDcm = 7 | |
23 | + | ||
24 | + | let idxIAmtAssetId = 8 | |
25 | + | ||
26 | + | let idxIPriceAssetId = 9 | |
27 | + | ||
28 | + | let idxLPAssetDcm = 10 | |
29 | + | ||
30 | + | let idxMatcherPublicKey = 11 | |
31 | + | ||
32 | + | func keyRegisterPut (poolAddress,txId) = ((("%s%s%s__P__" + poolAddress) + "__") + txId) | |
33 | + | ||
34 | + | ||
35 | + | func keyRegisterInvest (poolAddress,txId) = ((("%s%s%s__invest__" + poolAddress) + "__") + txId) | |
36 | + | ||
37 | + | ||
38 | + | func keyPoolTotalAmtByAsset (poolAddress,assetId) = ((("%s%s%s__total__" + poolAddress) + "__") + assetId) | |
39 | + | ||
40 | + | ||
41 | + | func keyFactoryContract () = "%s__factoryContract" | |
42 | + | ||
43 | + | ||
44 | + | func keySlippageAmtPerAssetCumulative (poolAddress,assetId) = (((("%s%s%s__" + poolAddress) + "__") + assetId) + "__slippageCumulative") | |
45 | + | ||
46 | + | ||
47 | + | func keyFactoryConfig () = "%s__factoryConfig" | |
48 | + | ||
49 | + | ||
50 | + | func keyMappingPoolContractAddressToPoolAssets (poolContractAddress) = (("%s%s%s__" + poolContractAddress) + "__mappings__poolContract2PoolAssets") | |
51 | + | ||
52 | + | ||
53 | + | func keyMappingsInternal2baseAssetId (internalBaseAsset) = ("%s%s%d__mappings__internal2baseAssetId__" + toString(internalBaseAsset)) | |
54 | + | ||
55 | + | ||
56 | + | func keyPoolConfig (iAmtAsset,iPriceAsset) = (((("%d%d%s__" + iAmtAsset) + "__") + iPriceAsset) + "__config") | |
57 | + | ||
58 | + | ||
59 | + | func keyAllPoolsShutdown () = "%s__shutdown" | |
60 | + | ||
61 | + | ||
62 | + | func keyPoolWeight (contractAddress) = ("%s%s__poolWeight__" + contractAddress) | |
63 | + | ||
64 | + | ||
65 | + | let factoryContract = addressFromStringValue(valueOrErrorMessage(getString(this, keyFactoryContract()), "No Factory Acc found.")) | |
66 | + | ||
67 | + | func convertAssetId (assetId) = if (!(isDefined(assetId))) | |
68 | + | then "WAVES" | |
69 | + | else assetId | |
70 | + | ||
71 | + | ||
72 | + | func dataPutActionInfo (inAssetId,inAssetAmt,txHeight,txTimestamp) = makeString(["%s%d%d%d", inAssetId, toString(inAssetAmt), toString(txHeight), toString(txTimestamp)], SEP) | |
73 | + | ||
74 | + | ||
75 | + | func dataInvestActionInfo (outAmountAssetAmt,outPriceAssetAmt,txHeight,txTimestamp) = makeString(["%d%d%d%d", toString(outAmountAssetAmt), toString(outPriceAssetAmt), toString(txHeight), toString(txTimestamp)], SEP) | |
76 | + | ||
77 | + | ||
78 | + | func asString (val) = match val { | |
79 | + | case valStr: String => | |
80 | + | valStr | |
81 | + | case _ => | |
82 | + | throw("fail to cast into String") | |
83 | + | } | |
84 | + | ||
85 | + | ||
86 | + | func toScale (amt,resScale,curScale) = fraction(amt, resScale, curScale) | |
87 | + | ||
88 | + | ||
89 | + | @Callable(i) | |
90 | + | func constructor (factoryContract) = if ((i.caller != this)) | |
91 | + | then throw("permissions denied") | |
92 | + | else [StringEntry(keyFactoryContract(), factoryContract)] | |
93 | + | ||
94 | + | ||
95 | + | ||
96 | + | @Callable(i) | |
97 | + | func put () = { | |
98 | + | let pool = toString(i.caller) | |
99 | + | let pmtAmtAsset = value(i.payments[0]) | |
100 | + | let pmtAssetId = if (!(isDefined(pmtAmtAsset.assetId))) | |
101 | + | then "WAVES" | |
102 | + | else toBase58String(value(pmtAmtAsset.assetId)) | |
103 | + | let pmtAssetAmt = pmtAmtAsset.amount | |
104 | + | let poolAssets = split(valueOrErrorMessage(getString(factoryContract, keyMappingPoolContractAddressToPoolAssets(pool)), "Invalid caller"), SEP) | |
105 | + | let amountAssetId = parseIntValue(poolAssets[1]) | |
106 | + | let priceAssetId = parseIntValue(poolAssets[2]) | |
107 | + | let amountAsset = valueOrErrorMessage(getString(factoryContract, keyMappingsInternal2baseAssetId(amountAssetId)), "Cannot find asset") | |
108 | + | let priceAsset = valueOrErrorMessage(getString(factoryContract, keyMappingsInternal2baseAssetId(priceAssetId)), "Cannot find asset") | |
109 | + | let totalAmt = valueOrElse(getInteger(this, keyPoolTotalAmtByAsset(pool, pmtAssetId)), 0) | |
110 | + | let cumulativeSlippageAmt = valueOrElse(getInteger(this, keySlippageAmtPerAssetCumulative(pool, pmtAssetId)), 0) | |
111 | + | [StringEntry(keyRegisterPut(pool, toBase58String(i.transactionId)), dataPutActionInfo(pmtAssetId, pmtAssetAmt, height, lastBlock.timestamp)), IntegerEntry(keyPoolTotalAmtByAsset(pool, pmtAssetId), (totalAmt + pmtAssetAmt)), IntegerEntry(keySlippageAmtPerAssetCumulative(pool, pmtAssetId), (cumulativeSlippageAmt + pmtAssetAmt))] | |
112 | + | } | |
113 | + | ||
114 | + | ||
115 | + | ||
116 | + | @Callable(i) | |
117 | + | func invest (poolAddress) = { | |
118 | + | let poolAssets = split(valueOrErrorMessage(getString(factoryContract, keyMappingPoolContractAddressToPoolAssets(poolAddress)), "Invalid pool passed."), SEP) | |
119 | + | let poolAmountAssetId = valueOrErrorMessage(getString(factoryContract, keyMappingsInternal2baseAssetId(parseIntValue(poolAssets[1]))), "No asset mapping found") | |
120 | + | let poolPriceAssetId = valueOrErrorMessage(getString(factoryContract, keyMappingsInternal2baseAssetId(parseIntValue(poolAssets[2]))), "No asset mapping found") | |
121 | + | let poolConfig = split(valueOrErrorMessage(getString(factoryContract, keyPoolConfig(poolAssets[1], poolAssets[2])), "No factory config found for pool assets."), SEP) | |
122 | + | let amountAssetDecimals = parseIntValue(poolConfig[idxAmtAssetDcm]) | |
123 | + | let priceAssetDecimals = parseIntValue(poolConfig[idxPriceAssetDcm]) | |
124 | + | let amountAssetBalance = toScale(valueOrElse(getInteger(this, keyPoolTotalAmtByAsset(poolAddress, poolAmountAssetId)), 0), scale8, amountAssetDecimals) | |
125 | + | let priceAssetBalance = toScale(valueOrElse(getInteger(this, keyPoolTotalAmtByAsset(poolAddress, poolPriceAssetId)), 0), scale8, priceAssetDecimals) | |
126 | + | let poolStats = asString(invoke(addressFromStringValue(poolAddress), "statsREADONLY", nil, nil)) | |
127 | + | if ((poolStats == poolStats)) | |
128 | + | then { | |
129 | + | let currentPrice = parseIntValue(split(poolStats, SEP)[poolStatsPriceKey]) | |
130 | + | let pEqByA = fraction(currentPrice, amountAssetBalance, scale8) | |
131 | + | let resAssetsToPut = if ((pEqByA > priceAssetBalance)) | |
132 | + | then $Tuple2(fraction(priceAssetBalance, scale8, currentPrice), priceAssetBalance) | |
133 | + | else $Tuple2(amountAssetBalance, pEqByA) | |
134 | + | let resultAmountAssetAmt = toScale(resAssetsToPut._1, amountAssetDecimals, scale8) | |
135 | + | let resultPriceAssetAmt = toScale(resAssetsToPut._2, priceAssetDecimals, scale8) | |
136 | + | let amtAssetId = if ((poolAmountAssetId == "WAVES")) | |
137 | + | then unit | |
138 | + | else fromBase58String(poolAmountAssetId) | |
139 | + | let priceAssetId = if ((poolPriceAssetId == "WAVES")) | |
140 | + | then unit | |
141 | + | else fromBase58String(poolPriceAssetId) | |
142 | + | let lpPut = invoke(addressFromStringValue(poolAddress), "putForFree", nil, [AttachedPayment(amtAssetId, resultAmountAssetAmt), AttachedPayment(priceAssetId, resultPriceAssetAmt)]) | |
143 | + | if ((lpPut == lpPut)) | |
144 | + | then [StringEntry(keyRegisterInvest(poolAddress, toBase58String(i.transactionId)), dataInvestActionInfo(resultAmountAssetAmt, resultPriceAssetAmt, height, lastBlock.timestamp))] | |
145 | + | else throw("Strict value is not equal to itself.") | |
146 | + | } | |
147 | + | else throw("Strict value is not equal to itself.") | |
148 | + | } | |
149 | + | ||
150 | + | ||
151 | + | @Verifier(tx) | |
152 | + | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
153 | + |
github/deemru/w8io/026f985 17.00 ms ◑