# Deploy a Strategy / Vault for V2
**DEPRECATED**: use https://github.com/iearn-finance/yearn-vaults/blob/master/docs/OPERATIONS.md
---
NOTE: This repo is encouraged to create multiple scripts for governance and dev multisig execution of complex transactions
https://github.com/iearn-finance/chief-multisig-officer
**IMPORTANT**: you should **NOT** create a new release with a test vault
## 1. Before deploying
- [ ] Coordinate with Core Dev strategist for getting a review in board https://github.com/orgs/iearn-finance/projects/5
- [ ] Peer review completed by:
- yearn.rocks: at least 2 strategists
- Experimental: at least 1 strategist + 1 core dev in board
- [ ] Check if want token has a deploy vault already (>=v0.3.0) and coordinate to use that first if possible.
- [ ] (only if a new vault is needed) Deploy using the registry.
- `registry.newExperimentalVault(want, you, multisig_dev, treasury, "", "")`
- args: token, gov, guardian, rewards, name, symbol
- multisig_dev = '0x846e211e8ba920B353FB717631C015cf04061Cc9'
- gov for testing = '0x846e211e8ba920b353fb717631c015cf04061cc9' (dev.ychad.eth)
- treasury = '0x93A62dA5a14C80f265DAbC077fCEE437B1a0Efde'
- registry = v2.registry.ychad.eth
(treasury.ychad.eth)
- [ ] Coordinate with core devs proper cap limit for new vault and other settings
- [ ] Check new vault has ABI setup on etherscan (If Verification with vyper and proxy is not working that is ideal)
- [ ] Set a deposit limit to the vault
vault.setDepositLimit(50_000 * 1e18)
$50k USD converted to your want. Example above is 50k DAI
- [ ] Set management. vault.setManagement(multisig_strategists)
- multisig_strategists = '0x16388463d60FFE0661Cf7F1f31a7D658aC790ff7'
- [ ] Deploy strategy with settings and upload code to Etherscan for verification
- [ ] Tag github review issue https://github.com/orgs/iearn-finance/projects/5 with deployed version. Add mainnet addresses
## 2. After deploying strategy
- [ ] Add strategy to vault
- `vault.addStrategy(strategy, debt_ratio, rate_limit, 1000)`
- debt_ratio should be 9800 if first strategy on vault
- rate_limit is 0 unless there is reason for it to be different
- [ ] Set keeper
- `strategy.setKeeper(keep3r_manager)`
- keep3r_manager = '0x13dAda6157Fee283723c0254F43FF1FdADe4EEd6'
- [ ] Set rewards
- `strategy.setRewards(address)`
Read below if you want to use the sharer contract
- [ ] Set management fee to 0
- `vault.setManagementFee(0)`
- [ ] Set governance
- `vault.setGovernance(multisig)`
- multisig = '0x846e211e8ba920b353fb717631c015cf04061cc9'
(dev.ychad.eth)
- Governance needs to be accepted before it is in place. After you set this you will still have power until part 2.
- [ ] Run tests against "live" vault and strategy in mainnet-fork
- [ ] (Optional) tag vault as "test" in v2.registry.ychad.eth with dev msig trx
### Sharer contract (optional)
Sharer is a contract for distributing strategist rewards. For boarding school graduates suggested is 34% to strategist_ms and 66% to strategist.
Repo: https://github.com/Grandthrax/Sharer
- Setup rewards for your strategy by calling `sharer.addContributors`
- If you forked someone elses strategy then cut them in
- Be sure to reward people who helped you
### Example Script:
```
# TBD Fill CMO example script to fill
```
## 3. The Manual Phase
- [ ] Deposit some "want" tokens into the vault
- [ ] Do first harvest and make sure it worked correctly
- `strategy.harvest()`
- [ ] Publish on yearn.rocks
- Governance dev msig ***must*** call `vault.acceptGovernance()` first
- Talk to Facu
- [ ] Monitor harvest and tend triggers for first few days. Call harvest/tend manually
## 4. Setting up Keep3r
- [ ] Adjust trigger variables until they are correct
- `strategy.setProfitFactor()`
- `strategy.setDebtThreshold()`
- `strategy.setMaxReportDelay()`
- [ ] Add strategy to the keep3r job
- `keep3r_manager.addStrategy(strategy, 1_500_000, 1_500_000)`
- Tell Carlos harvest and tend gas usage. For instance 1.5m.
## 5. Scaling Up / Moving to Endorse
- [ ] Increase limits
- [ ] Add to experimental tab on yearn.finance
- [ ] Set management fee to production level
- `vault.setManagementFee(200)`
- [ ] Set governance to ychad.eth
- [ ] yearn governance now must accept governance and endorse
- `strategy.acceptGovernance()` should be run by ychad.eth
- `registry.endorseVault(strategy)` Needs ychad.eth governace accepted for this to work
- **Order is important. Will fail if order is wrong**
- [ ] Now you are on main yearn page!
## Revoking a strategy with normal migration
TBD @carlos and @sam
## Emergency Procedures
TBD Figure criteria in emergency situation for either revoking a strategy or doing a complete vault shutdown ask @doggie for reference and steps to follow for this section to review with strategist Group
TODO: Add flowchart(s)
1. Strategy has a bug
a. Strategy can be migrated without issues
- [ ] Revoke keep3r jobs
- [ ] Migrate Strategy to fixed Strategy
- [ ] Continue operation of new Strategy
b. Bug affects strategy migration
- [ ] Have governance or strategist call `Strategy.setEmergencyShutdown()`
- [ ] Monitor capital divestment until fully withdrawn by keep3r
1. Strategy touches protocol that has a bug
- [ ] Have governance or strategist call `Strategy.setEmergencyShutdown()`
- [ ] Monitor capital divestment until fully withdrawn by keep3r
1. Vault has a bug
a. Vault bug can only be exploited by vulnerable Strategy
- [ ] Review for potentially malicious strategies, especially `Strategy.liquidatePosition()`
- [ ] Review for the ability for malicious depositor to trigger fault through `Vault.withdraw()`
- [ ] Revoke any strategies that have vulnerability and/or remove them from withdrawal queue
- [ ] Ask users to migrate to version of Vault with fix applied
b. Vault bug is unlikely to be exploited if deposits are blocked
- [ ] Have governance or guardian call `Vault.setEmergencyShutdown(True)`
- [ ] Monitor capital divestments from all strategies until fully withdrawn
- [ ] Monitor withdrawals for issues
c. Vault bug is exploitable, even in `emergencyShutdown` mode.
- [ ] Have governance or guardian call `Vault.setEmergencyShutdown(True)`
- [ ] Deploy and approve "escape hatch" strategy
- [ ] Try to funnel as much capital into escape hatch as possible
- [ ] Conduct fund recovery merkledrop to users