1 | | - | {-# STDLIB_VERSION 8 #-} |
---|
2 | | - | {-# CONTENT_TYPE EXPRESSION #-} |
---|
3 | | - | let subwarL2_1 = base58'6muGj1AZfEJ2jxi2UKUDR8qsEchQtouSycDRaTHXk7Wx' |
---|
4 | | - | let subwarL2_2 = base58'DstkNBYUaD6nmPrRxSPM3bbv9hsAogWghMzRbPbYTJUj' |
---|
5 | | - | let targetDapp1 = value(addressFromString("3PKgN8rfmvF7hK7RWJbpvkh59e1pQkUzero")) |
---|
6 | | - | let targetDapp2 = value(addressFromString("3PJVm7xLPabmYohbnvdgGDYHMwnZxF2x18m")) |
---|
7 | | - | let securityDapp = value(addressFromString("3MzgLbskN82suZgkmqTvzQxDtZfjQfX1DLp")) |
---|
8 | | - | let unlimitedFunctions = "extendMainChain,appendBlock,startAltChain,extendAltChain" |
---|
9 | | - | let limitedFunctions = "join,leave,withdraw,claimLP" |
---|
10 | | - | let maxFeePerTx = 500000 |
---|
11 | | - | let signed1 = if (sigVerify_16Kb(tx.bodyBytes, tx.proofs[0], subwarL2_1)) |
---|
12 | | - | then 1 |
---|
13 | | - | else 0 |
---|
14 | | - | let signed2 = if (sigVerify_16Kb(tx.bodyBytes, tx.proofs[1], subwarL2_2)) |
---|
15 | | - | then 1 |
---|
16 | | - | else 0 |
---|
17 | | - | let isMultiSignValid = ((signed1 + signed2) == 2) |
---|
18 | | - | func isUnlimitedFunction (funcName) = (indexOf(unlimitedFunctions, funcName) != unit) |
---|
19 | | - | |
---|
20 | | - | func isLimitedFunction (funcName) = (indexOf(limitedFunctions, funcName) != unit) |
---|
21 | | - | |
---|
22 | | - | match tx { |
---|
23 | | - | case t: InvokeScriptTransaction => |
---|
24 | | - | let targetFuncName = t.function |
---|
25 | | - | if (isMultiSignValid) |
---|
26 | | - | then true |
---|
27 | | - | else if (if ((t.dApp == targetDapp1)) |
---|
28 | | - | then true |
---|
29 | | - | else (t.dApp == targetDapp2)) |
---|
30 | | - | then if (isUnlimitedFunction(targetFuncName)) |
---|
31 | | - | then true |
---|
32 | | - | else if (isLimitedFunction(targetFuncName)) |
---|
33 | | - | then if ((t.fee > maxFeePerTx)) |
---|
34 | | - | then throw("Transaction fee exceeds maximum allowed amount") |
---|
35 | | - | else { |
---|
36 | | - | let checkLimitResult = ScriptTransfer(securityDapp, 0, unit) |
---|
37 | | - | match checkLimitResult { |
---|
38 | | - | case checkLimitResult: ScriptTransfer => |
---|
39 | | - | true |
---|
40 | | - | case _ => |
---|
41 | | - | throw("Invalid response from security dApp") |
---|
42 | | - | } |
---|
43 | | - | } |
---|
44 | | - | else false |
---|
45 | | - | else false |
---|
46 | | - | case _ => |
---|
47 | | - | isMultiSignValid |
---|
48 | | - | } |
---|
| 1 | + | # no script |
---|