3 | | - | let matcherAddress = addressFromString("3Ms8fSfAxBLDjKvNVgACRzQoBLCtCWxtawu") |
---|
4 | | - | let matcherPublicKey = base58'6d1nbhBxLCxjUyL9xXcX2VVxj2kcKiYny7VqH4FwbApv' |
---|
5 | | - | let gatewayAddress = addressFromString("3Mrhtzv9KEtjx4mG47oxgjahHKW33oTntEV") |
---|
6 | | - | let whitelistAddress = addressFromString("3N6DwWxT82nGJUwBwd7L514r2u71gr7WhwJ") |
---|
7 | | - | let dAppWhitelistAddress = Address(base58'3N1SPvLZgv6FMfe5WNUtnPzt3okYxcJhYnR') |
---|
8 | | - | let gatewayControlAssetAddress = base58'3w8UGTKzu3YvwRrvWeDuXkUVxdg1RuX1VCy6QRw86Fw4' |
---|
9 | | - | let pAddress1 = addressFromString("3NCVDaT1ASbRd42hBSw4EG6ojGVRGtvMiz1") |
---|
10 | | - | let pAddress2 = addressFromString("3Ms2kTAxdrcXDxwedfbNjSi6ewGCUqt3heZ") |
---|
11 | | - | let pAddress3 = addressFromString("3N6ognm7xnQSFiownS1Df1LacJUQXvfDFLe") |
---|
12 | | - | let pAddress4 = addressFromString("3MtVCmN9MZbWf9qxiMFoEPBrdc2fLp3SvuC") |
---|
13 | | - | let pAddress5 = addressFromString("3MuWG8gsTK4RQBsm97sMCuUXW99JvRxwYSg") |
---|
14 | | - | let validState = 1000 |
---|
15 | | - | let ver = "2.0.0-testnet" |
---|
16 | | - | match tx { |
---|
17 | | - | case o: Order => |
---|
18 | | - | if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)) |
---|
19 | | - | then (o.matcherPublicKey == matcherPublicKey) |
---|
20 | | - | else false |
---|
21 | | - | case tx: TransferTransaction => |
---|
22 | | - | if (!(sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey))) |
---|
23 | | - | then throw("Transaction must be signed by owner") |
---|
24 | | - | else { |
---|
25 | | - | let userState = getInteger(extract(whitelistAddress), toBase58String(tx.sender.bytes)) |
---|
26 | | - | if (!(isDefined(userState))) |
---|
27 | | - | then throw("Address not in whitelist") |
---|
28 | | - | else if ((userState != validState)) |
---|
29 | | - | then throw("User not in valid state") |
---|
30 | | - | else if (!(isDefined(tx.assetId))) |
---|
31 | | - | then { |
---|
32 | | - | let key = (toBase58String(tx.sender.bytes) + "_WAVES") |
---|
33 | | - | let minAmount = getInteger(extract(whitelistAddress), key) |
---|
34 | | - | if (isDefined(minAmount)) |
---|
35 | | - | then { |
---|
36 | | - | let curBalance = wavesBalance(extract(tx.sender)) |
---|
37 | | - | if ((extract(minAmount) > (curBalance - tx.amount))) |
---|
38 | | - | then throw("Unable to send such amount (type=2)") |
---|
39 | | - | else true |
---|
40 | | - | } |
---|
41 | | - | else { |
---|
42 | | - | let keyOverall = "res_WAVES" |
---|
43 | | - | let minAmountOverall = getInteger(extract(whitelistAddress), keyOverall) |
---|
44 | | - | if (isDefined(minAmountOverall)) |
---|
45 | | - | then { |
---|
46 | | - | let curBalance = wavesBalance(extract(tx.sender)) |
---|
47 | | - | if ((extract(minAmountOverall) > (curBalance - tx.amount))) |
---|
48 | | - | then throw("Unable to send such amount (type=1)") |
---|
49 | | - | else true |
---|
50 | | - | } |
---|
51 | | - | else true |
---|
52 | | - | } |
---|
53 | | - | } |
---|
54 | | - | else if ((tx.assetId == gatewayControlAssetAddress)) |
---|
55 | | - | then (tx.recipient == gatewayAddress) |
---|
56 | | - | else { |
---|
57 | | - | let white1List = toBase58String(tx.sender.bytes) |
---|
58 | | - | let assetTxt = toBase58String(extract(tx.assetId)) |
---|
59 | | - | let white1ListAsset = ((white1List + "_") + assetTxt) |
---|
60 | | - | let white1ListOverall = ("res_" + assetTxt) |
---|
61 | | - | let white1ListAssetEntry = getInteger(extract(whitelistAddress), white1ListAsset) |
---|
62 | | - | if (!(isDefined(white1ListAssetEntry))) |
---|
63 | | - | then { |
---|
64 | | - | let white1ListOverallEntry = getInteger(extract(whitelistAddress), white1ListOverall) |
---|
65 | | - | if (!(isDefined(white1ListOverallEntry))) |
---|
66 | | - | then true |
---|
67 | | - | else { |
---|
68 | | - | let cur1Balance = assetBalance(tx.sender, tx.assetId) |
---|
69 | | - | if ((extract(white1ListOverallEntry) > (cur1Balance - tx.amount))) |
---|
70 | | - | then throw("Unable to send such amount (type=1)") |
---|
71 | | - | else true |
---|
72 | | - | } |
---|
73 | | - | } |
---|
74 | | - | else { |
---|
75 | | - | let cur1Balance = assetBalance(tx.sender, tx.assetId) |
---|
76 | | - | if ((extract(white1ListAssetEntry) > (cur1Balance - tx.amount))) |
---|
77 | | - | then throw("Unable to send such amount (type=2)") |
---|
78 | | - | else true |
---|
79 | | - | } |
---|
80 | | - | } |
---|
81 | | - | } |
---|
82 | | - | case tx: SetScriptTransaction => |
---|
83 | | - | let pKey1Signed = if (isDefined(getInteger(extract(pAddress1), toBase58String(tx.id)))) |
---|
84 | | - | then 1 |
---|
85 | | - | else 0 |
---|
86 | | - | let pKey2Signed = if (isDefined(getInteger(extract(pAddress2), toBase58String(tx.id)))) |
---|
87 | | - | then 1 |
---|
88 | | - | else 0 |
---|
89 | | - | let pKey3Signed = if (isDefined(getInteger(extract(pAddress3), toBase58String(tx.id)))) |
---|
90 | | - | then 1 |
---|
91 | | - | else 0 |
---|
92 | | - | let pKey4Signed = if (isDefined(getInteger(extract(pAddress4), toBase58String(tx.id)))) |
---|
93 | | - | then 1 |
---|
94 | | - | else 0 |
---|
95 | | - | let pKey5Signed = if (isDefined(getInteger(extract(pAddress5), toBase58String(tx.id)))) |
---|
96 | | - | then 1 |
---|
97 | | - | else 0 |
---|
98 | | - | (((((pKey1Signed + pKey2Signed) + pKey3Signed) + pKey4Signed) + pKey5Signed) >= 3) |
---|
99 | | - | case tx: LeaseTransaction => |
---|
100 | | - | false |
---|
101 | | - | case tx: SponsorFeeTransaction => |
---|
102 | | - | false |
---|
103 | | - | case tx: MassTransferTransaction => |
---|
104 | | - | false |
---|
105 | | - | case tx: IssueTransaction => |
---|
106 | | - | false |
---|
107 | | - | case tx: ReissueTransaction => |
---|
108 | | - | false |
---|
109 | | - | case tx: BurnTransaction => |
---|
110 | | - | false |
---|
111 | | - | case tx: ExchangeTransaction => |
---|
112 | | - | false |
---|
113 | | - | case tx: InvokeScriptTransaction => |
---|
114 | | - | match tx.payment { |
---|
115 | | - | case a: AttachedPayment => |
---|
116 | | - | match getInteger(dAppWhitelistAddress, toBase58String(addressFromRecipient(tx.dApp).bytes)) { |
---|
117 | | - | case unused: Int => |
---|
118 | | - | true |
---|
119 | | - | case _ => |
---|
120 | | - | false |
---|
121 | | - | } |
---|
122 | | - | case _ => |
---|
123 | | - | true |
---|
124 | | - | } |
---|
125 | | - | case _ => |
---|
126 | | - | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) |
---|
127 | | - | } |
---|
| 3 | + | let unhumanKey = base58'DdryFgsRPfamfcRxNjcmi9KXADbt4fPWamVct9YdyvMr' |
---|
| 4 | + | sigVerify(tx.bodyBytes, tx.proofs[0], unhumanKey) |
---|