tx · GVkJ43Noyp24kLehiMq1yC3bXnwy8HJKpieFDF86t9b

3MqkoGVxf9wAeNTiksudck7HuNKruh3W9yg:  -0.04000000 Waves

2021.08.25 00:19 [1672931] smart account 3MqkoGVxf9wAeNTiksudck7HuNKruh3W9yg > SELF 0.00000000 Waves

{ "type": 13, "id": "GVkJ43Noyp24kLehiMq1yC3bXnwy8HJKpieFDF86t9b", "fee": 4000000, "feeAssetId": null, "timestamp": 1629839984486, "version": 2, "chainId": 84, "sender": "3MqkoGVxf9wAeNTiksudck7HuNKruh3W9yg", "senderPublicKey": "4adRtnahFnRGxzn67XppfF97pKLyUFPtNw5aCZ4NM9UV", "proofs": [ "4h6obkaBf3mxdfWtbqPSMLzBUsmk6ZqcGYDyDpQ3swGk8ytCy8LUQ4UbVTsM5YQWYaHuwv2iBXMGuTJNX55w6aho" ], "script": "base64:AAIFAAAAAAAAABgIAhIECgIIGBIDCgEIEgMKAQgSBAoCCAQAAAAHAAAAAAZjb25maWcJAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAQAAABFAZXh0ck5hdGl2ZSgxMDUzKQAAAAIFAAAABHRoaXMCAAAABmNvbmZpZwIAAAAAAAAAAAVhZG1pbgkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkBAAAAEUBleHRyTmF0aXZlKDEwNTMpAAAAAgUAAAAEdGhpcwIAAAAFYWRtaW4CAAAAAAAAAAAFcG9vbHMJAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAgkABB0AAAACBQAAAAR0aGlzAgAAAAVwb29scwIAAAAWTm8ga2V5IHBvb2xzIHdhcyBmb3VuZAEAAAAHaXNBZG1pbgAAAAEAAAANY2FsbGVyQWRkcmVzcwMJAAAAAAAAAgUAAAANY2FsbGVyQWRkcmVzcwkBAAAAEUBleHRyTmF0aXZlKDEwNjIpAAAAAQUAAAAFYWRtaW4GBwEAAAAJY2hlY2tQb29sAAAAAQAAAAdwb29sQWRkAwkBAAAACGNvbnRhaW5zAAAAAgU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XB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAAAXQJAAJZAAAAAQUAAAAHdG9rZW5JZAUAAAADbmlsCQAAAgAAAAECAAAAGEluY29ycmVjdCBpbnZva2UgcmVzdWx0IQkAAAIAAAABAgAAABRObyBwYXltZW50IGF0dGFjaGVkIQkAAAIAAAABAgAAABdQb29sIGFkZHJlc3Mgbm90IGZvdW5kIQAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5H2OFOQ==", "height": 1672931, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9WVkNiUt3XcVv2pFcHDmMTYqhTQp29j1muK4FSrsgaAy Next: Cmz6MFHWwua2xPaQAjoeZf6uX4qcsWBuF5aB8DND9Svy Diff:
OldNewDifferences
3131 else throw("Admin and config address already definied!")
3232
3333
34+
35+@Callable(i)
36+func addPool (poolAddress) = if (isAdmin(i.caller))
37+ then {
38+ let poolList = split(pools, ";")
39+ if ((containsElement(poolList, poolAddress) == false))
40+ then {
41+ let newPools = (poolList :+ poolAddress)
42+[writeString("pools", makeString(newPools, ";"))]
43+ }
44+ else throw("Pool already exists!")
45+ }
46+ else throw("Address does not match with admin address!")
47+
48+
49+
50+@Callable(i)
51+func updateConfig (configAddress) = if (isAdmin(i.caller))
52+ then [writeString("config", configAddress)]
53+ else throw("Address does not match with admin address!")
54+
55+
56+
57+@Callable(i)
58+func depositAt (poolAddress,isCollateral) = if (checkPool(poolAddress))
59+ then if ((size(i.payments) > 0))
60+ then {
61+ let user = toBase58String(i.caller.bytes)
62+ let tokenAmount = invoke(addressFromStringValue(poolAddress), "deposit", [user, isCollateral], i.payments)
63+ let tokenId = getStringValue(addressFromStringValue(poolAddress), "dTokenId")
64+ match tokenAmount {
65+ case t: Int =>
66+[ScriptTransfer(i.caller, t, fromBase58String(tokenId))]
67+ case _ =>
68+ throw("Incorrect invoke result!")
69+ }
70+ }
71+ else throw("No payment attached!")
72+ else throw("Pool address not found!")
73+
74+
3475 @Verifier(tx)
3576 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
3677
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let config = valueOrElse(getStringValue(this, "config"), "")
55
66 let admin = valueOrElse(getStringValue(this, "admin"), "")
77
88 let pools = valueOrErrorMessage(getString(this, "pools"), "No key pools was found")
99
1010 func isAdmin (callerAddress) = if ((callerAddress == addressFromStringValue(admin)))
1111 then true
1212 else false
1313
1414
1515 func checkPool (poolAdd) = if (contains(pools, poolAdd))
1616 then true
1717 else false
1818
1919
2020 func writeString (key,stringValue) = StringEntry(key, stringValue)
2121
2222
2323 func writeInteger (key,integerValue) = IntegerEntry(key, integerValue)
2424
2525
2626 @Callable(i)
2727 func setup (configAddress,pools) = if (if (!(isDefined("config")))
2828 then !(isDefined("pools"))
2929 else false)
3030 then [writeString("config", configAddress), writeString("pools", makeString(pools, ";"))]
3131 else throw("Admin and config address already definied!")
3232
3333
34+
35+@Callable(i)
36+func addPool (poolAddress) = if (isAdmin(i.caller))
37+ then {
38+ let poolList = split(pools, ";")
39+ if ((containsElement(poolList, poolAddress) == false))
40+ then {
41+ let newPools = (poolList :+ poolAddress)
42+[writeString("pools", makeString(newPools, ";"))]
43+ }
44+ else throw("Pool already exists!")
45+ }
46+ else throw("Address does not match with admin address!")
47+
48+
49+
50+@Callable(i)
51+func updateConfig (configAddress) = if (isAdmin(i.caller))
52+ then [writeString("config", configAddress)]
53+ else throw("Address does not match with admin address!")
54+
55+
56+
57+@Callable(i)
58+func depositAt (poolAddress,isCollateral) = if (checkPool(poolAddress))
59+ then if ((size(i.payments) > 0))
60+ then {
61+ let user = toBase58String(i.caller.bytes)
62+ let tokenAmount = invoke(addressFromStringValue(poolAddress), "deposit", [user, isCollateral], i.payments)
63+ let tokenId = getStringValue(addressFromStringValue(poolAddress), "dTokenId")
64+ match tokenAmount {
65+ case t: Int =>
66+[ScriptTransfer(i.caller, t, fromBase58String(tokenId))]
67+ case _ =>
68+ throw("Incorrect invoke result!")
69+ }
70+ }
71+ else throw("No payment attached!")
72+ else throw("Pool address not found!")
73+
74+
3475 @Verifier(tx)
3576 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
3677

github/deemru/w8io/026f985 
64.19 ms