-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest_goplus.py
More file actions
187 lines (155 loc) · 7.15 KB
/
test_goplus.py
File metadata and controls
187 lines (155 loc) · 7.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# Copyright 2023 The GoPlus. All rights reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import unittest
from goplus.address import Address
from goplus.approve import Approve
from goplus.dapp import Dapp
from goplus.decode import Decode
from goplus.errorcode import Code
from goplus.locker import Locker
from goplus.nft import Nft
from goplus.phishing_site import PushingSite
from goplus.rug_pull import RugPull
from goplus.token import Token
from goplus.tx_simulation import TxSimulation
class TokenTest(unittest.TestCase):
def test_token_security(self):
# token
res = Token().token_security(
chain_id="1", addresses=["0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"]
)
self.assertEqual(res.code, Code.SUCCESS, res.message)
def test_solana_token_security(self):
# solana
res = Token().solana_token_security(
addresses=["HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3"]
)
self.assertEqual(res.code, Code.SUCCESS, res.message)
def test_sui_token_security(self):
# sui
res = Token().sui_token_security(
addresses=[
"0x40402a987c2f8a71b755561bfbd16c2cbb991e27e609ad148809491c32bacab9::kui::KUI"
]
)
self.assertEqual(res.code, Code.SUCCESS, res.message)
class AddressTest(unittest.TestCase):
def test_address_security(self):
res = Address().address_security(
address="0xc8b759860149542a98a3eb57c14aadf59d6d89b9"
)
self.assertEqual(res.code, Code.SUCCESS, res.message)
class ApprovalTest(unittest.TestCase):
def test_approval_security_v1(self):
res = Approve().approve_security_v1(
chain_id="1", address="0x4639cd8cd52ec1cf2e496a606ce28d8afb1c792f"
)
self.assertEqual(res.code, Code.SUCCESS, res.message)
def test_token_approval_security(self):
res = Approve().token_approve_security(
chain_id="56", address="0xd018e2b543a2669410537f96293590138cacedf3"
)
self.assertEqual(res.code, Code.SUCCESS, res.message)
def test_erc721_approval_security(self):
res = Approve().erc721_approve_security(
chain_id="1", address="0xd95dbdab08a9fed2d71ac9c3028aac40905d8cf3"
)
self.assertEqual(res.code, Code.SUCCESS, res.message)
def test_erc1155_approval_security(self):
res = Approve().erc1155_approve_security(
chain_id="56", address="0xb0dccbb9c4a65a94a41a0165aaea79c8b2fc54ce"
)
self.assertEqual(res.code, Code.SUCCESS, res.message)
class DecodeTest(unittest.TestCase):
def test_signature_data_decode(self):
res = Decode(access_token=None).signature_data_decode(
chain_id="1",
address="0x4cc8aa0c6ffbe18534584da9b592aa438733ee66",
data="0xa0712d68000000000000000000000000"
"0000000000000000000000000000000062fee481",
)
self.assertEqual(res.code, Code.SUCCESS, res.message)
class NftTest(unittest.TestCase):
def test_nft_security(self):
res = Nft().nft_security(
chain_id="1", address="0x82f5ef9ddc3d231962ba57a9c2ebb307dc8d26c2"
)
self.assertIn(res.code, [Code.SUCCESS, Code.DATA_PENDING_SYNC], res.message)
class DappTest(unittest.TestCase):
def test_dapp_security(self):
res = Dapp().dapp_security(url="https://for.tube")
self.assertEqual(res.code, Code.SUCCESS, res.message)
class PhishingSiteTest(unittest.TestCase):
def test_phishing_site_security(self):
res = PushingSite().pushing_site_security(url="https://xn--cm-68s.cc/")
self.assertEqual(res.code, Code.SUCCESS, res.message)
class RugPullTest(unittest.TestCase):
def test_rug_pull_security(self):
res = RugPull().rug_pull_security(
chain_id="1", address="0x6B175474E89094C44Da98b954EedeAC495271d0F"
)
self.assertEqual(res.code, Code.SUCCESS, res.message)
class LockerTest(unittest.TestCase):
def test_locker_token(self):
res = Locker().locker_token(
chain_id="8453",
page_num=1,
page_size=100,
token_address="0x6fd0303649296360f10c07b24521deda9223086d",
)
self.assertEqual(res.code, Code.SUCCESS, res.message)
def test_locker_lp_v3(self):
res = Locker().locker_lp_v3(
chain_id="56",
page_num=1,
page_size=100,
pool_address="0x579df956c6cE6178fBBD78bbE4f05786cFBA9B76",
)
self.assertEqual(res.code, Code.SUCCESS, res.message)
class TxSimulationTest(unittest.TestCase):
def test_solana_tx_simulation(self):
res = TxSimulation().solana_tx_simulation(
encoded_transaction="AT+Td4vATQ8bPgyQPt25Hp6Ve2jECOkwS3+PC5Z8HhLK"
"/7mDbnQ8tW3sKzQnNeVWxsJzo8knzMhQZbnL+FpzVgOAAQADGuG"
"EgGi3qMErQECfFXEVxCXlALMU02fKK0Yf27WbmN3in"
"0h2yAJOqRM87lkKfGtIJh/K1ZeTCGy7baAOhr7lAHEGm4hX/quBhPt"
"of2NGGMA12sQ53BrrO1WYoPAAAAAAAUHVl1rR1ll4q"
"3QLbxXmVinsWpdivaeQV/mhOzBJCk8REfu0KcAzb3YRg2Ma9lf/One"
"Tw5veLElNTzFqNrsDkuYLvA+xH7fegRONkq/Pv7gl"
"UQsHQHoREAxHUw9pcWEqf8JzpBDzmh14iMUco6VGUnJ5JdUmYvy9vVSA"
"7Oxsk9U/04YFfm4JbWwLmfCCrhw+JkLOorQ/LWaR1"
"K9ts6sVhyf7Py+Jb8E9fs7m+Yp0tE0aoYujFI/3KfPd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