tx · GPn2hcymarZVuZa4LJLnqjYQ52aK774D7k1PtdE2y4Xj 3N5KQvkteXbTcUWkEUUDjoDcVh9AAqHK918: -0.01000000 Waves 2022.02.21 19:09 [1933641] smart account 3N5KQvkteXbTcUWkEUUDjoDcVh9AAqHK918 > SELF 0.00000000 Waves
{ "type": 13, "id": "GPn2hcymarZVuZa4LJLnqjYQ52aK774D7k1PtdE2y4Xj", "fee": 1000000, "feeAssetId": null, "timestamp": 1645459833902, "version": 2, "chainId": 84, "sender": "3N5KQvkteXbTcUWkEUUDjoDcVh9AAqHK918", "senderPublicKey": "6mMWgAo7xS1wCx1dAnqiqyEXvz5BGsKHCPYjqfHdabjb", "proofs": [ "4nHemn5jbe8VE15EZJq9WB5YeVBfet5w2obJVtnLmfJDjpBRWnz4pYm2TVP3t9hiJrbKuVqzE6M76fhtiDZjYS5g" ], "script": "base64:AAIFAAAAAAAAABEIAhIDCgEIEggKBgEBAQEIAQAAABUAAAAAA1NFUAIAAAACX18AAAAABUVNUFRZAgAAAAAAAAAADmlkeFBvb2xBZGRyZXNzAAAAAAAAAAABAAAAAAlpZHhMUEFzSWQAAAAAAAAAAAMAAAAACWlkeEFtQXNJZAAAAAAAAAAABAAAAAAJaWR4UHJBc0lkAAAAAAAAAAAFAAAAAA9pZHhGYWN0U3Rha0NudHIAAAAAAAAAAAEBAAAAC2tleUZhY3RDbnRyAAAAAAIAAAATJXNfX2ZhY3RvcnlDb250cmFjdAEAAAAMa2V5TWFuUHViS2V5AAAAAAIAAAAUJXNfX21hbmFnZXJQdWJsaWNLZXkBAAAAC2tleVBvb2xBZGRyAAAAAAIAAAAPJXNfX3Bvb2xBZGRyZXNzAQAAAAtrZXlBbXRBc3NldAAAAAACAAAADyVzX19hbW91bnRBc3NldAEAAAANa2V5UHJpY2VBc3NldAAAAAACAAAADiVzX19wcmljZUFzc2V0AQAAABBrZXlGYWN0b3J5Q29uZmlnAAAAAAIAAAARJXNfX2ZhY3RvcnlDb25maWcBAAAADWtleVB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AAADbmlsCQAETAAAAAIJAQAAAA9BdHRhY2hlZFBheW1lbnQAAAACBQAAAAlscEFzc2V0SWQFAAAABmFtb3VudAUAAAADbmlsAwkAAAAAAAACBQAAAAlnZXRPbmVUa24FAAAACWdldE9uZVRrbgUAAAADbmlsCQAAAgAAAAECAAAAJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAAIAAAABAgAAACRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4JAAACAAAAAQIAAAAkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAQAAAAHJG1hdGNoMAUAAAACdHgEAAAABWFkbWluCQEAAAALdmFsdWVPckVsc2UAAAACCQAEHQAAAAIFAAAABHRoaXMJAQAAAAxrZXlNYW5QdWJLZXkAAAAABQAAAAVFTVBUWQMJAAAAAAAAAgUAAAAFYWRtaW4FAAAABUVNUFRZCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleQkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAJAAJZAAAAAQUAAAAFYWRtaW4GHa4z", "height": 1933641, "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 EMPTY = "" | |
7 | + | ||
8 | + | let idxPoolAddress = 1 | |
9 | + | ||
10 | + | let idxLPAsId = 3 | |
11 | + | ||
12 | + | let idxAmAsId = 4 | |
13 | + | ||
14 | + | let idxPrAsId = 5 | |
15 | + | ||
16 | + | let idxFactStakCntr = 1 | |
17 | + | ||
18 | + | func keyFactCntr () = "%s__factoryContract" | |
19 | + | ||
20 | + | ||
21 | + | func keyManPubKey () = "%s__managerPublicKey" | |
22 | + | ||
23 | + | ||
24 | + | func keyPoolAddr () = "%s__poolAddress" | |
25 | + | ||
26 | + | ||
27 | + | func keyAmtAsset () = "%s__amountAsset" | |
28 | + | ||
29 | + | ||
30 | + | func keyPriceAsset () = "%s__priceAsset" | |
31 | + | ||
32 | + | ||
33 | + | func keyFactoryConfig () = "%s__factoryConfig" | |
34 | + | ||
35 | + | ||
36 | + | func keyPoolConfig (iAmtAs,iPrAs) = (((("%d%d%s__" + iAmtAs) + "__") + iPrAs) + "__config") | |
37 | + | ||
38 | + | ||
39 | + | func keyMappingsBaseAsset2internalId (bAStr) = ("%s%s%s__mappings__baseAsset2internalId__" + bAStr) | |
40 | + | ||
41 | + | ||
42 | + | func getStringOrFail (addr,key) = valueOrErrorMessage(getString(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], "")) | |
43 | + | ||
44 | + | ||
45 | + | func getIntOrFail (addr,key) = valueOrErrorMessage(getInteger(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], "")) | |
46 | + | ||
47 | + | ||
48 | + | let poolContract = addressFromStringValue(getStringOrFail(this, keyPoolAddr())) | |
49 | + | ||
50 | + | let factoryContract = addressFromStringValue(getStringOrFail(poolContract, keyFactCntr())) | |
51 | + | ||
52 | + | func getPoolConfig () = { | |
53 | + | let amtAs = getStringOrFail(poolContract, keyAmtAsset()) | |
54 | + | let priceAs = getStringOrFail(poolContract, keyPriceAsset()) | |
55 | + | let iPriceAs = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAs)) | |
56 | + | let iAmtAs = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAs)) | |
57 | + | split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAs), toString(iPriceAs))), SEP) | |
58 | + | } | |
59 | + | ||
60 | + | ||
61 | + | func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP) | |
62 | + | ||
63 | + | ||
64 | + | @Callable(i) | |
65 | + | func constructor (poolAddress) = if ((i.caller != this)) | |
66 | + | then throw("denied") | |
67 | + | else [StringEntry(keyPoolAddr(), poolAddress)] | |
68 | + | ||
69 | + | ||
70 | + | ||
71 | + | @Callable(i) | |
72 | + | func unstakeAndGetOneTkn (amount,exchResult,notUsed,outAmount,outAssetId,slippage) = { | |
73 | + | let checkPayments = if ((size(i.payments) != 0)) | |
74 | + | then throw("No pmnts expd") | |
75 | + | else true | |
76 | + | if ((checkPayments == checkPayments)) | |
77 | + | then { | |
78 | + | let cfg = getPoolConfig() | |
79 | + | let factoryCfg = getFactoryConfig() | |
80 | + | let lpAssetId = fromBase58String(cfg[idxLPAsId]) | |
81 | + | let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr") | |
82 | + | let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil) | |
83 | + | if ((unstakeInv == unstakeInv)) | |
84 | + | then { | |
85 | + | let getOneTkn = invoke(poolContract, "getOneTkn", [exchResult, notUsed, outAmount, outAssetId, slippage], [AttachedPayment(lpAssetId, amount)]) | |
86 | + | if ((getOneTkn == getOneTkn)) | |
87 | + | then nil | |
88 | + | else throw("Strict value is not equal to itself.") | |
89 | + | } | |
90 | + | else throw("Strict value is not equal to itself.") | |
91 | + | } | |
92 | + | else throw("Strict value is not equal to itself.") | |
93 | + | } | |
94 | + | ||
95 | + | ||
96 | + | @Verifier(tx) | |
97 | + | func verify () = match tx { | |
98 | + | case _ => | |
99 | + | let admin = valueOrElse(getString(this, keyManPubKey()), EMPTY) | |
100 | + | if ((admin == EMPTY)) | |
101 | + | then sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
102 | + | else sigVerify(tx.bodyBytes, tx.proofs[0], fromBase58String(admin)) | |
103 | + | } | |
104 | + |
github/deemru/w8io/026f985 21.73 ms ◑