forked from yearn/brownie-strategy-mix
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
117 lines (90 loc) · 2.75 KB
/
conftest.py
File metadata and controls
117 lines (90 loc) · 2.75 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
import pytest
from brownie import config
@pytest.fixture
def andre(accounts):
# Andre, giver of tokens, and maker of yield
yield accounts[0]
@pytest.fixture
def token(andre, Token):
yield andre.deploy(Token)
@pytest.fixture
def gov(accounts):
# yearn multis... I mean YFI governance. I swear!
yield accounts[1]
@pytest.fixture
def rewards(gov):
yield gov # TODO: Add rewards contract
@pytest.fixture
def guardian(accounts):
# YFI Whale, probably
yield accounts[2]
@pytest.fixture
def vault(pm, gov, rewards, guardian, token):
Vault = pm(config["dependencies"][0]).Vault
vault = guardian.deploy(Vault, token, gov, rewards, "", "")
yield vault
@pytest.fixture
def strategist(accounts):
# You! Our new Strategist!
yield accounts[3]
@pytest.fixture
def keeper(accounts):
# This is our trusty bot!
yield accounts[4]
@pytest.fixture
def strategy(strategist, keeper, vault, Strategy):
strategy = strategist.deploy(Strategy, vault)
strategy.setKeeper(keeper)
yield strategy
@pytest.fixture
def nocoiner(accounts):
# Has no tokens (DeFi is a ponzi scheme!)
yield accounts[5]
@pytest.fixture
def pleb(accounts, andre, token, vault):
# Small fish in a big pond
a = accounts[6]
# Has 0.01% of tokens (heard about this new DeFi thing!)
bal = token.totalSupply() // 10000
token.transfer(a, bal, {"from": andre})
# Unlimited Approvals
token.approve(vault, 2 ** 256 - 1, {"from": a})
# Deposit half their stack
vault.deposit(bal // 2, {"from": a})
yield a
@pytest.fixture
def chad(accounts, andre, token, vault):
# Just here to have fun!
a = accounts[7]
# Has 0.1% of tokens (somehow makes money trying every new thing)
bal = token.totalSupply() // 1000
token.transfer(a, bal, {"from": andre})
# Unlimited Approvals
token.approve(vault, 2 ** 256 - 1, {"from": a})
# Deposit half their stack
vault.deposit(bal // 2, {"from": a})
yield a
@pytest.fixture
def greyhat(accounts, andre, token, vault):
# Chaotic evil, will eat you alive
a = accounts[8]
# Has 1% of tokens (earned them the *hard way*)
bal = token.totalSupply() // 100
token.transfer(a, bal, {"from": andre})
# Unlimited Approvals
token.approve(vault, 2 ** 256 - 1, {"from": a})
# Deposit half their stack
vault.deposit(bal // 2, {"from": a})
yield a
@pytest.fixture
def whale(accounts, andre, token, vault):
# Totally in it for the tech
a = accounts[9]
# Has 10% of tokens (was in the ICO)
bal = token.totalSupply() // 10
token.transfer(a, bal, {"from": andre})
# Unlimited Approvals
token.approve(vault, 2 ** 256 - 1, {"from": a})
# Deposit half their stack
vault.deposit(bal // 2, {"from": a})
yield a