Skip to main content
Version: 0.4.2

Operations procedures

These operations might be needed at any point in time.

Revoking a strategy with normal migration

Let'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 account
gov =, force=True)

# The cream strategy is the first in the withdrawal queue
s1 = Contract(vault.withdrawalQueue(0))

# Revoke msg should be sent from gov or guardian
vault.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)
>>> hegic.balanceOf(vault)/1e18

From the strategy

From the strategy itself we can turn on emergency mode. To do it we need to run:

# Grab the strategist account
strategist =, force=True)

# Turn on the emergency exit
s1.setEmergencyExit({'from': strategist})

# Harvest to move funds to the vault
s1.harvest({'from': strategist})

We should also see the strategy's debtRatio going to 0 and funds returning to the vault.

Emergency Procedures

We 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 alarm
vault.setEmergencyShutdown(true, {'from': gov})

# Harvest all strategies
s1.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()

You will notice that this procedure doesn't change the debt ratio:

>>> vault.strategies(s1).dict()['debtRatio']

It drops the credit to 0:

>>> vault.creditAvailable(s1)