-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconftest.py
76 lines (55 loc) · 2.17 KB
/
conftest.py
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
#!/usr/bin/python3
import pytest
from brownie import Contract, PacDaoGovernance, accounts, network
from brownie.network.state import TxHistory
@pytest.fixture(scope="function", autouse=True)
def isolate(fn_isolation):
# perform a chain rewind after completing each test, to ensure proper isolation
# https://eth-brownie.readthedocs.io/en/v1.10.3/tests-pytest-intro.html#isolation-fixtures
pass
@pytest.fixture(scope="module")
def token(PacGovFungible, accounts, v1_token):
v2_token = PacGovFungible.deploy({"from": accounts[0]})
multisig = v1_token.owner()
v2_token.transfer_owner(multisig, {"from": v2_token.owner()})
v2_token.mint(accounts[0], 1000 * 10 ** v2_token.decimals(), {"from": multisig})
return v2_token
@pytest.fixture(scope="module")
def owner(token):
return token.owner()
@pytest.fixture(scope="module")
def minter(token, PacGovBridge, owner, v1_token):
bridge = PacGovBridge.deploy(token, v1_token.address, {"from": owner})
token.update_minter(bridge, {"from": owner})
v1_token.transferOwner(bridge, {"from": v1_token.owner()})
return bridge
@pytest.fixture(scope="module")
def v1_token(v1_hodler_addr):
if network.show_active() == "development":
x = PacDaoGovernance.deploy({"from": accounts[0]})
x.mint(v1_hodler_addr, 10**18, {"from": x.owner()})
return x
else:
return Contract.from_abi(
"PacDaoGovernance",
"0x3459cfCe9c0306EB1D5D0e2b78144C9FBD94c87B",
PacDaoGovernance.abi,
)
@pytest.fixture(scope="module")
def v1_hodler_addr():
return "0x6215181b1f33af4f0b60125017e72d3615dcd6e3"
@pytest.fixture(scope="module")
def v1_hodler(v1_token, minter, v1_hodler_addr):
v1_token.approve(
minter, v1_token.balanceOf(v1_hodler_addr), {"from": v1_hodler_addr}
)
return v1_hodler_addr
@pytest.fixture(scope="module")
def v2_hodler(token, v1_hodler, minter):
minter.upgrade(v1_hodler, {"from": v1_hodler})
assert token.balanceOf(v1_hodler) > 0
return v1_hodler
@pytest.fixture(scope="module")
def dummy_token(accounts, PacGovFungible):
dummy_token = PacGovFungible.deploy({"from": accounts[0]})
return dummy_token