Operations procedures
These operations might be needed at any point in time.
#
Revoking a strategy with normal migrationLet's say we found a problem in one of the strategies and we want to return all funds. There are two ways of doing it.
The scripts below use the HEGIC vault as an example.
#
From the vault# Grab the gov accountgov = accounts.at(vault.governance(), force=True)
# The cream strategy is the first in the withdrawal queues1 = Contract(vault.withdrawalQueue(0))
# Revoke msg should be sent from gov or guardianvault.revokeStrategy(s1, {"from": gov})
After running the command you will notice:
vault.strategies(s1).dict()['debtRatio'] == 0
Last step is running a harvest
to return funds to vault:
s1.harvest({"from": gov})>>> hegic.balanceOf(s1)0>>> hegic.balanceOf(vault)/1e18291731.2666932462
#
From the strategyFrom the strategy itself we can turn on emergency mode. To do it we need to run:
# Grab the strategist accountstrategist = accounts.at(s1.strategist(), force=True)
# Turn on the emergency exits1.setEmergencyExit({'from': strategist})
# Harvest to move funds to the vaults1.harvest({'from': strategist})
We should also see the strategy's debtRatio
going to 0
and funds returning to the vault.
#
Emergency ProceduresWe can also shutdown the vault to return assets as soon as possible. To do that we will need a guardian or governance account:
# Sound the alarmvault.setEmergencyShutdown(true, {'from': gov})
# Harvest all strategiess1.harvest({'from': gov})s2.harvest({'from': gov})s3.harvest({'from': gov})
# Check all the tokens are back in the vault>>> hegic.balanceOf(vault) == vault.totalAssets()True
You will notice that this procedure doesn't change the debt ratio:
>>> vault.strategies(s1).dict()['debtRatio']1600
It drops the credit to 0
:
>>> vault.creditAvailable(s1)0