tx · 14pVteVKiTRcxPkegmndQG8KffChELZBCApzhm2AyfQV 3NCMRpLsF8NsPL6q8VcF6fH88h8gjPHPtvF: -0.05000000 Waves 2023.10.06 14:53 [2786725] smart account 3NCMRpLsF8NsPL6q8VcF6fH88h8gjPHPtvF > SELF 0.00000000 Waves
{ "type": 13, "id": "14pVteVKiTRcxPkegmndQG8KffChELZBCApzhm2AyfQV", "fee": 5000000, "feeAssetId": null, "timestamp": 1696593232229, "version": 1, "sender": "3NCMRpLsF8NsPL6q8VcF6fH88h8gjPHPtvF", "senderPublicKey": "4AqDEPmpAWKHr1VaXU21GUNwWqqUfJMpS2tdsqaPUxGG", "proofs": [ "5TwVABSaYNr5A2A6i2ti1oU6gJdrM7CgaXimSwUgfAecdC9q7THz8xoBxBU8eq6Wsuau8TySugwHmgnAoCCbe8oW" ], "script": "base64:BgIkCAISCwoJAQEBAQEBCAgIEgQKAggBEgMKAQgSAwoBCBIDCgEIDAEFYXNJbnQBBXZhbHVlBAckbWF0Y2gwBQV2YWx1ZQMJAAECBQckbWF0Y2gwAgNJbnQEA2ludAUHJG1hdGNoMAUDaW50CQACAQIZd3JvbmcgdHlwZSwgZXhwZWN0ZWQ6IEludAEQd3JpdGVDb25zdFN0cmluZwIDa2V5BXZhbHVlAwkBASEBCQEJaXNEZWZpbmVkAQkAnQgCBQR0aGlzBQNrZXkJAQtTdHJpbmdFbnRyeQIFA2tleQUFdmFsdWUJAAIBCQCsAgICFWFscmVhZHkgaW5pdGlhbGl6ZWQ6IAUDa2V5ABJjb25maWdBZGRyZXNzU3RvcmUCBmNvbmZpZwANY29uZmlnQWRkcmVzcwkBE3ZhbHVlT3JFcnJvck1lc3NhZ2UCCQCmCAEJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgkAnQgCBQR0aGlzBRJjb25maWdBZGRyZXNzU3RvcmUCJ2NoaWxkcmVuLm1haW46IGNvbmZpZyBhZGRyZXNzIG5vdCBmb3VuZAIWaW52YWxpZCBjb25maWcgYWRkc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MJAPwHBAUPc3Rha2luZ0NvbnRyYWN0AghzdGFrZUZvcgkAzAgCBQdhZGRyZXNzBQNuaWwJAMwIAgkBD0F0dGFjaGVkUGF5bWVudAIFCnB3ckFzc2V0SWQFBHNraW4FA25pbAMJAAACBQFzBQFzBQNuaWwJAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4JAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4JAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4BaQEEaW5pdAEEY29uZgkAzAgCCQEQd3JpdGVDb25zdFN0cmluZwIFEmNvbmZpZ0FkZHJlc3NTdG9yZQUEY29uZgUDbmlsAD3DIrc=", "chainId": 84, "height": 2786725, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | func asInt (value) = match value { | |
5 | + | case int: Int => | |
6 | + | int | |
7 | + | case _ => | |
8 | + | throw("wrong type, expected: Int") | |
9 | + | } | |
10 | + | ||
11 | + | ||
12 | + | func writeConstString (key,value) = if (!(isDefined(getString(this, key)))) | |
13 | + | then StringEntry(key, value) | |
14 | + | else throw(("already initialized: " + key)) | |
15 | + | ||
16 | + | ||
17 | + | let configAddressStore = "config" | |
18 | + | ||
19 | + | let configAddress = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(this, configAddressStore), "children.main: config address not found")), "invalid config address") | |
20 | + | ||
21 | + | let HEIGHT = height | |
22 | + | ||
23 | + | func allowed (op) = invoke(configAddress, "opAllowed", [op], nil) | |
24 | + | ||
25 | + | ||
26 | + | let pwrAssetId = fromBase58String(valueOrErrorMessage(getString(configAddress, "powerAssetId"), "pwr asset id not found")) | |
27 | + | ||
28 | + | let stakingContract = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(configAddress, "contract_staking"), "no staking_contract")), "invalid staking address") | |
29 | + | ||
30 | + | let minPower = valueOrErrorMessage(getInteger(configAddress, (toString(this) + "_min_power_required_to_project")), "no _min_power_required_to_project") | |
31 | + | ||
32 | + | let childrenContract = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(configAddress, "contract_children"), "no children_contract")), "invalid children address") | |
33 | + | ||
34 | + | let wavesDAO = valueOrElse(getString(configAddress, "wavesDAO"), "3PEwRcYNAUtoFvKpBhKoiwajnZfdoDR6h4h") | |
35 | + | ||
36 | + | let factory = valueOrElse(getString(configAddress, "miners_factory"), "3PJVm7xLPabmYohbnvdgGDYHMwnZxF2x18m") | |
37 | + | ||
38 | + | @Callable(i) | |
39 | + | func project (skin,maxSkin,minCommitment,lockTime,investments,maxInvestments,investmentsToken,commitments,treasure) = { | |
40 | + | let a = allowed("project") | |
41 | + | if ((a == a)) | |
42 | + | then { | |
43 | + | let user = toString(i.caller) | |
44 | + | let power = asInt(invoke(stakingContract, "userPower", [user], nil)) | |
45 | + | if ((power == power)) | |
46 | + | then if ((minPower > power)) | |
47 | + | then throw(("Not enough staked power to create a project. Required " + toString(minPower))) | |
48 | + | else { | |
49 | + | let p = invoke(childrenContract, "projectFor", [user, skin, maxSkin, minCommitment, lockTime, investments, maxInvestments, investmentsToken, commitments, treasure], nil) | |
50 | + | if ((p == p)) | |
51 | + | then nil | |
52 | + | else throw("Strict value is not equal to itself.") | |
53 | + | } | |
54 | + | else throw("Strict value is not equal to itself.") | |
55 | + | } | |
56 | + | else throw("Strict value is not equal to itself.") | |
57 | + | } | |
58 | + | ||
59 | + | ||
60 | + | ||
61 | + | @Callable(i) | |
62 | + | func commit (child,amount) = { | |
63 | + | let a = allowed("commit") | |
64 | + | if ((a == a)) | |
65 | + | then { | |
66 | + | let account = toString(i.caller) | |
67 | + | let s = invoke(stakingContract, "unstakeFrom", [account, amount], nil) | |
68 | + | if ((s == s)) | |
69 | + | then { | |
70 | + | let c = invoke(childrenContract, "commitFor", [child, account], [AttachedPayment(pwrAssetId, amount)]) | |
71 | + | if ((c == c)) | |
72 | + | then nil | |
73 | + | else throw("Strict value is not equal to itself.") | |
74 | + | } | |
75 | + | else throw("Strict value is not equal to itself.") | |
76 | + | } | |
77 | + | else throw("Strict value is not equal to itself.") | |
78 | + | } | |
79 | + | ||
80 | + | ||
81 | + | ||
82 | + | @Callable(i) | |
83 | + | func commitForMiner (for) = if ((toString(i.caller) != factory)) | |
84 | + | then throw("denied") | |
85 | + | else { | |
86 | + | let c = invoke(childrenContract, "commitForMiner", [wavesDAO, for], i.payments) | |
87 | + | if ((c == c)) | |
88 | + | then nil | |
89 | + | else throw("Strict value is not equal to itself.") | |
90 | + | } | |
91 | + | ||
92 | + | ||
93 | + | ||
94 | + | @Callable(i) | |
95 | + | func undoCommit (child) = { | |
96 | + | let paused = allowed("undoCommit") | |
97 | + | if ((paused == paused)) | |
98 | + | then { | |
99 | + | let address = toString(i.caller) | |
100 | + | let skin = asInt(invoke(childrenContract, "undoCommitFor", [child, address], nil)) | |
101 | + | if ((skin == skin)) | |
102 | + | then { | |
103 | + | let s = invoke(stakingContract, "stakeFor", [address], [AttachedPayment(pwrAssetId, skin)]) | |
104 | + | if ((s == s)) | |
105 | + | then nil | |
106 | + | else throw("Strict value is not equal to itself.") | |
107 | + | } | |
108 | + | else throw("Strict value is not equal to itself.") | |
109 | + | } | |
110 | + | else throw("Strict value is not equal to itself.") | |
111 | + | } | |
112 | + | ||
113 | + | ||
114 | + | ||
115 | + | @Callable(i) | |
116 | + | func init (conf) = [writeConstString(configAddressStore, conf)] | |
117 | + | ||
118 | + |
github/deemru/w8io/169f3d6 32.10 ms ◑