tx · FTpyVi6zsVrDQFHZVWbWrUV92SKtg9mnwYtHrJS6F8xf 3Mzep1R5kHeC1ecKFkWjuhU3Gw4LAdCib9N: -0.01000000 Waves 2023.11.08 15:41 [2834391] smart account 3Mzep1R5kHeC1ecKFkWjuhU3Gw4LAdCib9N > SELF 0.00000000 Waves
{ "type": 13, "id": "FTpyVi6zsVrDQFHZVWbWrUV92SKtg9mnwYtHrJS6F8xf", "fee": 1000000, "feeAssetId": null, "timestamp": 1699447378850, "version": 2, "chainId": 84, "sender": "3Mzep1R5kHeC1ecKFkWjuhU3Gw4LAdCib9N", "senderPublicKey": "41THq9VrFxHEvVGJyz2oMpJQErnSkkqJXpBypSDxa5Mv", "proofs": [ "2WBW727ieQvjm51GMrp2MrfYS8bz2y82JSkRGKH3JUoY67MD6z8UXh3iScbosu4LvkjPxYmBApKkcKrCkcJQRtfj" ], "script": "base64:BgIdCAISAwoBGBIDCgEYEgQKAgIYEgQKAgIYEgMKAQITAAlzZXBhcmF0b3ICAl9fAAdjaGFpbklkCQDJAQIJAMoBAggFBHRoaXMFYnl0ZXMAAQABAAhjaGFpbklkVAEBVAAIY2hhaW5JZFcBAVcBC211c3RBZGRyZXNzAgFpB2FkZHJlc3MDCQAAAggFAWkGY2FsbGVyBQdhZGRyZXNzBgkAAgECEXBlcm1pc3Npb24gZGVuaWVkAQhtdXN0VGhpcwEBaQkBC211c3RBZGRyZXNzAgUBaQUEdGhpcwADU0VQAgJfXwAFV0FWRVMCBVdBVkVTABBjb250cmFjdEZpbGVuYW1lAhV3eGRhb19jYWxjdWxhdG9yLnJpZGUBB3dyYXBFcnIBAXMJAKwCAgkArAICBRBjb250cmFjdEZpbGVuYW1lAgI6IAUBcwEIdGhyb3dFcnIBAXMJAAIBCQEHd3JhcEVycgEFAXMBEGtleUNvbmZpZ0FkZHJlc3MAAgolc19fY29uZmlnARJwb3dlckNvbmZpZ0FkZHJlc3MBDmZhY3RvcnlBZGRyZXNzCQETdmFsdWVPckVycm9yTWVz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pbWVkBQNuaWwDCQAAAgUGY2hlY2tzBQZjaGVja3MEFGFkZGl0aW9uYWxMb2NrUm91bmRzAAAEDmZhY3RvcnlBY3Rpb25zCQDMCAIJAPwHBAUOZmFjdG9yeUFkZHJlc3MCDGJvb2xlYW5FbnRyeQkAzAgCCQEKa2V5Q2xhaW1lZAEFC3VzZXJBZGRyZXNzCQDMCAIGBQNuaWwFA25pbAkAzAgCCQD8BwQFDmZhY3RvcnlBZGRyZXNzAiBjb21taXRBZnRlclN0YXJ0V2l0aExvY2tSb3VuZEZvcgkAzAgCCQEUcG93ZXJDb250cmFjdEFkZHJlc3MBBQ5mYWN0b3J5QWRkcmVzcwkAzAgCCQClCAEFDmZhY3RvcnlBZGRyZXNzCQDMCAIJAKUIAQULdXNlckFkZHJlc3MJAMwIAgUUYWRkaXRpb25hbExvY2tSb3VuZHMJAMwIAgkBDHBvd2VyQXNzZXRJZAEFDmZhY3RvcnlBZGRyZXNzCQDMCAIFCWF2YWlsYWJsZQUDbmlsBQNuaWwFA25pbAkAlAoCBQNuaWwFDmZhY3RvcnlBY3Rpb25zCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAWkBBXByaWNlAQ9jYWxsZXJQdWJsaWNLZXkJAJQKAgUDbmlsAAABAnR4AQZ2ZXJpZnkACQAAAgUHY2hhaW5JZAUIY2hhaW5JZFQcJulZ", "height": 2834391, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: HeWAM5sZQXvbdbm66cYq2W3YfzG54UKf1qdQsqQ6H6FB Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let separator = "__" | |
5 | + | ||
6 | + | let chainId = take(drop(this.bytes, 1), 1) | |
7 | + | ||
8 | + | let chainIdT = base58'2T' | |
9 | + | ||
10 | + | let chainIdW = base58'2W' | |
11 | + | ||
12 | + | func mustAddress (i,address) = if ((i.caller == address)) | |
13 | + | then true | |
14 | + | else throw("permission denied") | |
15 | + | ||
16 | + | ||
17 | + | func mustThis (i) = mustAddress(i, this) | |
18 | + | ||
19 | + | ||
20 | + | let SEP = "__" | |
21 | + | ||
22 | + | let WAVES = "WAVES" | |
23 | + | ||
24 | + | let contractFilename = "wxdao_calculator.ride" | |
25 | + | ||
26 | + | func wrapErr (s) = ((contractFilename + ": ") + s) | |
27 | + | ||
28 | + | ||
29 | + | func throwErr (s) = throw(wrapErr(s)) | |
30 | + | ||
31 | + | ||
32 | + | func keyConfigAddress () = "%s__config" | |
33 | + | ||
34 | + | ||
35 | + | func powerConfigAddress (factoryAddress) = valueOrErrorMessage(match getString(this, keyConfigAddress()) { | |
36 | + | case s: String => | |
37 | + | addressFromString(s) | |
38 | + | case _: Unit => | |
39 | + | unit | |
40 | + | case _ => | |
41 | + | throw("Match error") | |
42 | + | }, wrapErr("invalid power config address")) | |
43 | + | ||
44 | + | ||
45 | + | func keyPowerAssetId () = "powerAssetId" | |
46 | + | ||
47 | + | ||
48 | + | func powerAssetId (factoryAddress) = fromBase58String(valueOrErrorMessage(getString(powerConfigAddress(factoryAddress), keyPowerAssetId()), wrapErr("invalid power asset id"))) | |
49 | + | ||
50 | + | ||
51 | + | func keyPowerContractAddress () = "%s__powerContract" | |
52 | + | ||
53 | + | ||
54 | + | func powerContractAddress (factoryAddress) = valueOrErrorMessage(match getString(factoryAddress, keyPowerContractAddress()) { | |
55 | + | case s: String => | |
56 | + | addressFromString(s) | |
57 | + | case _: Unit => | |
58 | + | unit | |
59 | + | case _ => | |
60 | + | throw("Match error") | |
61 | + | }, wrapErr("invalid power contract address")) | |
62 | + | ||
63 | + | ||
64 | + | func keyAvailable (userAddress) = makeString(["%s%s", "available", toString(userAddress)], SEP) | |
65 | + | ||
66 | + | ||
67 | + | func keyClaimed (userAddress) = makeString(["%s%s", "claimed", toString(userAddress)], SEP) | |
68 | + | ||
69 | + | ||
70 | + | @Callable(i) | |
71 | + | func withdraw (args) = { | |
72 | + | let recipient = addressFromStringValue(args[0]) | |
73 | + | let amount = parseIntValue(args[1]) | |
74 | + | let result = invoke(i.caller, "transferWaves", [recipient.bytes, amount], nil) | |
75 | + | $Tuple2(nil, result) | |
76 | + | } | |
77 | + | ||
78 | + | ||
79 | + | ||
80 | + | @Callable(i) | |
81 | + | func setIntParam (args) = { | |
82 | + | let key = args[0] | |
83 | + | let val = parseIntValue(args[1]) | |
84 | + | let result = invoke(i.caller, "integerEntry", [key, val], nil) | |
85 | + | $Tuple2(nil, result) | |
86 | + | } | |
87 | + | ||
88 | + | ||
89 | + | ||
90 | + | @Callable(i) | |
91 | + | func swap (callerPublicKey,args) = $Tuple2(nil, unit) | |
92 | + | ||
93 | + | ||
94 | + | ||
95 | + | @Callable(i) | |
96 | + | func claim (callerPublicKey,args) = { | |
97 | + | let factoryAddress = i.caller | |
98 | + | let userAddress = addressFromPublicKey(callerPublicKey) | |
99 | + | let available = valueOrElse(getInteger(factoryAddress, keyAvailable(userAddress)), 0) | |
100 | + | let claimed = valueOrElse(getBoolean(factoryAddress, keyClaimed(userAddress)), false) | |
101 | + | let checks = [if ((available > 0)) | |
102 | + | then true | |
103 | + | else throwErr("nothing to claim"), if (!(claimed)) | |
104 | + | then true | |
105 | + | else throwErr("already claimed")] | |
106 | + | if ((checks == checks)) | |
107 | + | then { | |
108 | + | let additionalLockRounds = 0 | |
109 | + | let factoryActions = [invoke(factoryAddress, "booleanEntry", [keyClaimed(userAddress), true], nil), invoke(factoryAddress, "commitAfterStartWithLockRoundFor", [powerContractAddress(factoryAddress), toString(factoryAddress), toString(userAddress), additionalLockRounds, powerAssetId(factoryAddress), available], nil)] | |
110 | + | $Tuple2(nil, factoryActions) | |
111 | + | } | |
112 | + | else throw("Strict value is not equal to itself.") | |
113 | + | } | |
114 | + | ||
115 | + | ||
116 | + | ||
117 | + | @Callable(i) | |
118 | + | func price (callerPublicKey) = $Tuple2(nil, 0) | |
119 | + | ||
120 | + | ||
121 | + | @Verifier(tx) | |
122 | + | func verify () = (chainId == chainIdT) | |
123 | + |
github/deemru/w8io/026f985 207.26 ms ◑