6 | | - | let dAppWhitelistAddress = Address(base58'3N1SPvLZgv6FMfe5WNUtnPzt3okYxcJhYnR') |
---|
7 | | - | |
---|
8 | | - | let pAddress1 = addressFromString("3NCVDaT1ASbRd42hBSw4EG6ojGVRGtvMiz1") |
---|
9 | | - | |
---|
10 | | - | let pAddress2 = addressFromString("3Ms2kTAxdrcXDxwedfbNjSi6ewGCUqt3heZ") |
---|
11 | | - | |
---|
12 | | - | let pAddress3 = addressFromString("3N6ognm7xnQSFiownS1Df1LacJUQXvfDFLe") |
---|
13 | | - | |
---|
14 | | - | let pAddress4 = addressFromString("3MtVCmN9MZbWf9qxiMFoEPBrdc2fLp3SvuC") |
---|
15 | | - | |
---|
16 | | - | let pAddress5 = addressFromString("3MuWG8gsTK4RQBsm97sMCuUXW99JvRxwYSg") |
---|
17 | | - | |
---|
18 | | - | let ver = "0.0.1-otc-testnet" |
---|
19 | | - | |
---|
20 | | - | let validState = 1000 |
---|
21 | | - | |
---|
22 | | - | func getPayment (i) = match i.payment { |
---|
23 | | - | case p: AttachedPayment => |
---|
24 | | - | p |
---|
25 | | - | case _ => |
---|
26 | | - | throw("Payment must be attached") |
---|
27 | | - | } |
---|
28 | | - | |
---|
29 | | - | |
---|
30 | | - | func checkAddress (account) = { |
---|
31 | | - | let isAccountAllow = match getInteger(whitelistAddress, account) { |
---|
32 | | - | case a: Int => |
---|
33 | | - | a |
---|
34 | | - | case _ => |
---|
35 | | - | -255 |
---|
36 | | - | } |
---|
37 | | - | (isAccountAllow == validState) |
---|
38 | | - | } |
---|
39 | | - | |
---|
40 | | - | |
---|
41 | | - | @Callable(i) |
---|
42 | | - | func transfer (toAddress) = { |
---|
43 | | - | let dAppStatus = match getInteger(dAppWhitelistAddress, toString(this)) { |
---|
44 | | - | case a: Int => |
---|
45 | | - | a |
---|
46 | | - | case _ => |
---|
47 | | - | 0 |
---|
48 | | - | } |
---|
49 | | - | if ((dAppStatus == 0)) |
---|
50 | | - | then throw("Dealer dApp is not active") |
---|
51 | | - | else { |
---|
52 | | - | let callerCheck = checkAddress(toBase58String(i.caller.bytes)) |
---|
53 | | - | let recipientCheck = checkAddress(toAddress) |
---|
54 | | - | if (if (callerCheck) |
---|
55 | | - | then recipientCheck |
---|
56 | | - | else false) |
---|
57 | | - | then { |
---|
58 | | - | let payment = getPayment(i) |
---|
59 | | - | TransferSet([ScriptTransfer(addressFromStringValue(toAddress), payment.amount, payment.assetId)]) |
---|
60 | | - | } |
---|
61 | | - | else throw("This account has no right to send/get funds.") |
---|
62 | | - | } |
---|
63 | | - | } |
---|
67 | | - | func verify () = match tx { |
---|
68 | | - | case tx: SetScriptTransaction => |
---|
69 | | - | let pKey1Signed = if (isDefined(getInteger(extract(pAddress1), toBase58String(tx.id)))) |
---|
70 | | - | then 1 |
---|
71 | | - | else 0 |
---|
72 | | - | let pKey2Signed = if (isDefined(getInteger(extract(pAddress2), toBase58String(tx.id)))) |
---|
73 | | - | then 1 |
---|
74 | | - | else 0 |
---|
75 | | - | let pKey3Signed = if (isDefined(getInteger(extract(pAddress3), toBase58String(tx.id)))) |
---|
76 | | - | then 1 |
---|
77 | | - | else 0 |
---|
78 | | - | let pKey4Signed = if (isDefined(getInteger(extract(pAddress4), toBase58String(tx.id)))) |
---|
79 | | - | then 1 |
---|
80 | | - | else 0 |
---|
81 | | - | let pKey5Signed = if (isDefined(getInteger(extract(pAddress5), toBase58String(tx.id)))) |
---|
82 | | - | then 1 |
---|
83 | | - | else 0 |
---|
84 | | - | (((((pKey1Signed + pKey2Signed) + pKey3Signed) + pKey4Signed) + pKey5Signed) >= 3) |
---|
85 | | - | case _ => |
---|
86 | | - | false |
---|
87 | | - | } |
---|
| 8 | + | func verify () = true |
---|