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