generated from Badger-Finance/badger-strategy-mix-v1
-
Notifications
You must be signed in to change notification settings - Fork 1
/
mock_deploy.py
102 lines (86 loc) · 2.79 KB
/
mock_deploy.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
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
from brownie import *
from config import (
BADGER_DEV_MULTISIG,
WANT,
LP_COMPONENT,
REWARD_TOKEN,
PROTECTED_TOKENS,
FEES,
)
from dotmap import DotMap
def main():
return deploy()
def deploy():
"""
Deploys, vault, controller and strats and wires them up for you to test
Also runs a uniswap to get you some funds
NOTE: Tests use fixtures outside this file
NOTE: This is just for testing, these settings are not ready for production
NOTE: If you fork any network beside mainnet, you'll need to do some tweaking
"""
deployer = accounts[0]
strategist = deployer
keeper = deployer
guardian = deployer
governance = accounts.at(BADGER_DEV_MULTISIG, force=True)
controller = Controller.deploy({"from": deployer})
controller.initialize(BADGER_DEV_MULTISIG, strategist, keeper, BADGER_DEV_MULTISIG)
sett = RemBadger.deploy({"from": deployer})
sett.initialize(
WANT,
controller,
BADGER_DEV_MULTISIG,
keeper,
guardian,
False,
"prefix",
"PREFIX",
)
sett.unpause({"from": governance})
controller.setVault(WANT, sett)
## TODO: Add guest list once we find compatible, tested, contract
# guestList = VipCappedGuestListWrapperUpgradeable.deploy({"from": deployer})
# guestList.initialize(sett, {"from": deployer})
# guestList.setGuests([deployer], [True])
# guestList.setUserDepositCap(100000000)
# sett.setGuestList(guestList, {"from": governance})
## Start up Strategy
strategy = BrikedStrategy.deploy({"from": deployer})
strategy.initialize(
BADGER_DEV_MULTISIG,
strategist,
controller,
keeper,
guardian,
PROTECTED_TOKENS,
FEES,
)
## Tool that verifies bytecode (run independetly) <- Webapp for anyone to verify
## Set up tokens
want = interface.IERC20(WANT)
lpComponent = interface.IERC20(LP_COMPONENT)
rewardToken = interface.IERC20(REWARD_TOKEN)
## Wire up Controller to Strart
## In testing will pass, but on live it will fail
controller.approveStrategy(WANT, strategy, {"from": governance})
controller.setStrategy(WANT, strategy, {"from": deployer})
## Uniswap some tokens here
router = Contract.from_explorer("0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D")
router.swapExactETHForTokens(
0, ## Mint out
["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", WANT],
deployer,
9999999999999999,
{"from": deployer, "value": 5000000000000000000},
)
return DotMap(
deployer=deployer,
controller=controller,
vault=sett,
sett=sett,
strategy=strategy,
# guestList=guestList,
want=want,
lpComponent=lpComponent,
rewardToken=rewardToken,
)