Registry.vy

Registry.vy

Events

Methods

setGovernance

acceptGovernance

latestRelease

latestVault

newRelease

newVault

newVault

newExperimentalVault

newExperimentalVault

endorseVault

endorseVault

setBanksy

setBanksy

tagVault

ABI

Byte code

# Registry.vy

vyper: `0.3.3`

## Events

NewRelease

- `release_id` : uint256, indexed

- `template` : address, notIndexed

- `api_version` : string, notIndexed

NewVault

- `token` : address, indexed

- `vault_id` : uint256, indexed

- `vault` : address, notIndexed

- `api_version` : string, notIndexed

NewExperimentalVault

- `token` : address, indexed

- `deployer` : address, indexed

- `vault` : address, notIndexed

- `api_version` : string, notIndexed

NewGovernance

- `governance` : address, notIndexed

VaultTagged

- `vault` : address, notIndexed

- `tag` : string, notIndexed

## Methods

### setGovernance

type: `nonpayable function`

Starts the 1st phase of the governance transfer.

Throws if the caller is not current governance.

Arguments:

- `governance`: - The next governance address

### acceptGovernance

type: `nonpayable function`

Completes the 2nd phase of the governance transfer.

Throws if the caller is not the pending caller. Emits a `NewGovernance` event.

### latestRelease

type: `view function`

Returns the api version of the latest release.

Throws if no releases are registered yet.

Returns:

- `_0` - The api version of the latest release.

### latestVault

type: `view function`

Returns the latest deployed vault for the given token.

Throws if no vaults are endorsed yet for the given token.

Arguments:

- `token`: - The token address to find the latest vault for.

Returns:

- `_0` - The address of the latest vault for the given token.

### newRelease

type: `nonpayable function`

Add a previously deployed Vault as the template contract for the latest release, to be used by further "forwarder-style" delegatecall proxy contracts that can be deployed from the registry throw other methods (to save gas).

Throws if caller isn't `self.governance`. Throws if `vault`'s governance isn't `self.governance`. Throws if the api version is the same as the previous release. Emits a `NewVault` event.

Arguments:

- `vault`: - The vault that will be used as the template contract for the next release.

### newVault

type: `nonpayable function`

Create a new vault for the given token using the latest release in the registry, as a simple "forwarder-style" delegatecall proxy to the latest release. Also adds the new vault to the list of "endorsed" vaults for that token.

`governance` is set in the new vault as `self.governance`, with no ability to override. Throws if caller isn't `self.governance`. Throws if no releases are registered yet. Throws if there already is a registered vault for the given token with the latest api version. Emits a `NewVault` event.

Arguments:

-

`token`: - The token that may be deposited into the new Vault.

-

`guardian`: - The address authorized for guardian interactions in the new Vault.

-

`rewards`: - The address to use for collecting rewards in the new Vault

-

`name`: - Specify a custom Vault name. Set to empty string for default choice.

-

`symbol`: - Specify a custom Vault symbol name. Set to empty string for default choice.

-

`releaseDelta`: - Specify the number of releases prior to the latest to use as a target. Default is latest.

Returns:

- `_0` - The address of the newly-deployed vault

### newVault

type: `nonpayable function`

`governance` is set in the new vault as `self.governance`, with no ability to override. Throws if caller isn't `self.governance`. Throws if no releases are registered yet. Throws if there already is a registered vault for the given token with the latest api version. Emits a `NewVault` event.

Arguments:

-

`token`: - The token that may be deposited into the new Vault.

-

`guardian`: - The address authorized for guardian interactions in the new Vault.

-

`rewards`: - The address to use for collecting rewards in the new Vault

-

`name`: - Specify a custom Vault name. Set to empty string for default choice.

-

`symbol`: - Specify a custom Vault symbol name. Set to empty string for default choice.

-

`releaseDelta`: - Specify the number of releases prior to the latest to use as a target. Default is latest.

Returns:

- `_0` - The address of the newly-deployed vault

### newExperimentalVault

type: `nonpayable function`

Create a new vault for the given token using the latest release in the registry, as a simple "forwarder-style" delegatecall proxy to the latest release. Does not add the new vault to the list of "endorsed" vaults for that token.

Throws if no releases are registered yet. Emits a `NewExperimentalVault` event.

Arguments:

-

`token`: - The token that may be deposited into the new Vault.

-

`governance`: - The address authorized for governance interactions in the new Vault.

-

`guardian`: - The address authorized for guardian interactions in the new Vault.

-

`rewards`: - The address to use for collecting rewards in the new Vault

-

`name`: - Specify a custom Vault name. Set to empty string for default choice.

-

`symbol`: - Specify a custom Vault symbol name. Set to empty string for default choice.

-

`releaseDelta`: - Specify the number of releases prior to the latest to use as a target. Default is latest.

Returns:

- `_0` - The address of the newly-deployed vault

### newExperimentalVault

type: `nonpayable function`

Throws if no releases are registered yet. Emits a `NewExperimentalVault` event.

Arguments:

-

`token`: - The token that may be deposited into the new Vault.

-

`governance`: - The address authorized for governance interactions in the new Vault.

-

`guardian`: - The address authorized for guardian interactions in the new Vault.

-

`rewards`: - The address to use for collecting rewards in the new Vault

-

`name`: - Specify a custom Vault name. Set to empty string for default choice.

-

`symbol`: - Specify a custom Vault symbol name. Set to empty string for default choice.

-

`releaseDelta`: - Specify the number of releases prior to the latest to use as a target. Default is latest.

Returns:

- `_0` - The address of the newly-deployed vault

### endorseVault

type: `nonpayable function`

Adds an existing vault to the list of "endorsed" vaults for that token.

`governance` is set in the new vault as `self.governance`, with no ability to override. Throws if caller isn't `self.governance`. Throws if `vault`'s governance isn't `self.governance`. Throws if no releases are registered yet. Throws if `vault`'s api version does not match latest release. Throws if there already is a deployment for the vault's token with the latest api version. Emits a `NewVault` event.

Arguments:

-

`vault`: - The vault that will be endorsed by the Registry.

-

`releaseDelta`: - Specify the number of releases prior to the latest to use as a target. Default is latest.

### endorseVault

type: `nonpayable function`

`governance` is set in the new vault as `self.governance`, with no ability to override. Throws if caller isn't `self.governance`. Throws if `vault`'s governance isn't `self.governance`. Throws if no releases are registered yet. Throws if `vault`'s api version does not match latest release. Throws if there already is a deployment for the vault's token with the latest api version. Emits a `NewVault` event.

Arguments:

-

`vault`: - The vault that will be endorsed by the Registry.

-

`releaseDelta`: - Specify the number of releases prior to the latest to use as a target. Default is latest.

### setBanksy

type: `nonpayable function`

Set the ability of a particular tagger to tag current vaults.

Throws if caller is not `self.governance`.

Arguments:

-

`tagger`: - The address to approve or deny access to tagging.

-

`allowed`: - Whether to approve or deny `tagger`. Defaults to approve.

### setBanksy

type: `nonpayable function`

Throws if caller is not `self.governance`.

Arguments:

-

`tagger`: - The address to approve or deny access to tagging.

-

`allowed`: - Whether to approve or deny `tagger`. Defaults to approve.

### tagVault

type: `nonpayable function`

Tag a Vault with a message.

Throws if caller is not `self.governance` or an approved tagger. Emits a `VaultTagged` event.

Arguments:

-

`vault`: - The address to tag with the given `tag` message.

-

`tag`: - The message to tag `vault` with.

## ABI

```
[ { "name": "NewRelease", "inputs": [ { "name": "release_id", "type": "uint256", "indexed": true }, { "name": "template", "type": "address", "indexed": false }, { "name": "api_version", "type": "string", "indexed": false } ], "anonymous": false, "type": "event" }, { "name": "NewVault", "inputs": [ { "name": "token", "type": "address", "indexed": true }, { "name": "vault_id", "type": "uint256", "indexed": true }, { "name": "vault", "type": "address", "indexed": false }, { "name": "api_version", "type": "string", "indexed": false } ], "anonymous": false, "type": "event" }, { "name": "NewExperimentalVault", "inputs": [ { "name": "token", "type": "address", "indexed": true }, { "name": "deployer", "type": "address", "indexed": true }, { "name": "vault", "type": "address", "indexed": false }, { "name": "api_version", "type": "string", "indexed": false } ], "anonymous": false, "type": "event" }, { "name": "NewGovernance", "inputs": [ { "name": "governance", "type": "address", "indexed": false } ], "anonymous": false, "type": "event" }, { "name": "VaultTagged", "inputs": [ { "name": "vault", "type": "address", "indexed": false }, { "name": "tag", "type": "string", "indexed": false } ], "anonymous": false, "type": "event" }, { "stateMutability": "nonpayable", "type": "constructor", "inputs": [], "outputs": [] }, { "stateMutability": "nonpayable", "type": "function", "name": "setGovernance", "inputs": [ { "name": "governance", "type": "address" } ], "outputs": [] }, { "stateMutability": "nonpayable", "type": "function", "name": "acceptGovernance", "inputs": [], "outputs": [] }, { "stateMutability": "view", "type": "function", "name": "latestRelease", "inputs": [], "outputs": [ { "name": "", "type": "string" } ] }, { "stateMutability": "view", "type": "function", "name": "latestVault", "inputs": [ { "name": "token", "type": "address" } ], "outputs": [ { "name": "", "type": "address" } ] }, { "stateMutability": "nonpayable", "type": "function", "name": "newRelease", "inputs": [ { "name": "vault", "type": "address" } ], "outputs": [] }, { "stateMutability": "nonpayable", "type": "function", "name": "newVault", "inputs": [ { "name": "token", "type": "address" }, { "name": "guardian", "type": "address" }, { "name": "rewards", "type": "address" }, { "name": "name", "type": "string" }, { "name": "symbol", "type": "string" } ], "outputs": [ { "name": "", "type": "address" } ] }, { "stateMutability": "nonpayable", "type": "function", "name": "newVault", "inputs": [ { "name": "token", "type": "address" }, { "name": "guardian", "type": "address" }, { "name": "rewards", "type": "address" }, { "name": "name", "type": "string" }, { "name": "symbol", "type": "string" }, { "name": "releaseDelta", "type": "uint256" } ], "outputs": [ { "name": "", "type": "address" } ] }, { "stateMutability": "nonpayable", "type": "function", "name": "newExperimentalVault", "inputs": [ { "name": "token", "type": "address" }, { "name": "governance", "type": "address" }, { "name": "guardian", "type": "address" }, { "name": "rewards", "type": "address" }, { "name": "name", "type": "string" }, { "name": "symbol", "type": "string" } ], "outputs": [ { "name": "", "type": "address" } ] }, { "stateMutability": "nonpayable", "type": "function", "name": "newExperimentalVault", "inputs": [ { "name": "token", "type": "address" }, { "name": "governance", "type": "address" }, { "name": "guardian", "type": "address" }, { "name": "rewards", "type": "address" }, { "name": "name", "type": "string" }, { "name": "symbol", "type": "string" }, { "name": "releaseDelta", "type": "uint256" } ], "outputs": [ { "name": "", "type": "address" } ] }, { "stateMutability": "nonpayable", "type": "function", "name": "endorseVault", "inputs": [ { "name": "vault", "type": "address" } ], "outputs": [] }, { "stateMutability": "nonpayable", "type": "function", "name": "endorseVault", "inputs": [ { "name": "vault", "type": "address" }, { "name": "releaseDelta", "type": "uint256" } ], "outputs": [] }, { "stateMutability": "nonpayable", "type": "function", "name": "setBanksy", "inputs": [ { "name": "tagger", "type": "address" } ], "outputs": [] }, { "stateMutability": "nonpayable", "type": "function", "name": "setBanksy", "inputs": [ { "name": "tagger", "type": "address" }, { "name": "allowed", "type": "bool" } ], "outputs": [] }, { "stateMutability": "nonpayable", "type": "function", "name": "tagVault", "inputs": [ { "name": "vault", "type": "address" }, { "name": "tag", "type": "string" } ], "outputs": [] }, { "stateMutability": "view", "type": "function", "name": "numReleases", "inputs": [], "outputs": [ { "name": "", "type": "uint256" } ] }, { "stateMutability": "view", "type": "function", "name": "releases", "inputs": [ { "name": "arg0", "type": "uint256" } ], "outputs": [ { "name": "", "type": "address" } ] }, { "stateMutability": "view", "type": "function", "name": "numVaults", "inputs": [ { "name": "arg0", "type": "address" } ], "outputs": [ { "name": "", "type": "uint256" } ] }, { "stateMutability": "view", "type": "function", "name": "vaults", "inputs": [ { "name": "arg0", "type": "address" }, { "name": "arg1", "type": "uint256" } ], "outputs": [ { "name": "", "type": "address" } ] }, { "stateMutability": "view", "type": "function", "name": "tokens", "inputs": [ { "name": "arg0", "type": "uint256" } ], "outputs": [ { "name": "", "type": "address" } ] }, { "stateMutability": "view", "type": "function", "name": "numTokens", "inputs": [], "outputs": [ { "name": "", "type": "uint256" } ] }, { "stateMutability": "view", "type": "function", "name": "isRegistered", "inputs": [ { "name": "arg0", "type": "address" } ], "outputs": [ { "name": "", "type": "bool" } ] }, { "stateMutability": "view", "type": "function", "name": "governance", "inputs": [], "outputs": [ { "name": "", "type": "address" } ] }, { "stateMutability": "view", "type": "function", "name": "pendingGovernance", "inputs": [], "outputs": [ { "name": "", "type": "address" } ] }, { "stateMutability": "view", "type": "function", "name": "tags", "inputs": [ { "name": "arg0", "type": "address" } ], "outputs": [ { "name": "", "type": "string" } ] }, { "stateMutability": "view", "type": "function", "name": "banksy", "inputs": [ { "name": "arg0", "type": "address" } ], "outputs": [ { "name": "", "type": "bool" } ] }]
```

## Byte code

```
0x336007556110a161001c6300000000396110a16000016300000000f3600436101561000d57610cac565b60003560e01c3461109c5763ab033ea98118610042576004358060a01c61109c57604052600754331861109c57604051600855005b63238efcbc811861008657600854331861109c57336007557f4f386975ea1c2f7cf1845b08bee00626fbb624ecad16254d63d9bb9ba86526de3360405260206040a1005b637be0ca5e811861014b57602080610100526325829410604052606060406004605c6001600054600180821061109c57808203905090506020526000526040600020545afa6100da573d600060003e3d6000fd5b60403d1061109c57604051604001601c81511161109c5780518060c05260208201805160e05250505060c081610100018151808252602083016020830181518152505050805180602083010181600003601f163682375050601f19601f825160200101169050905081019050610100f35b63e177dc7081186101ad576004358060a01c61109c5760405260036040516020526000526040600020806002604051602052600052604060002054600180821061109c5780820390509050602052600052604060002090505460605260206060f35b6333990d4b81186103bb576004358060a01c61109c57604052600754331861109c57600054606052600060605111156102c45763258294106102c05260606102c060046102dc6040515afa610207573d600060003e3d6000fd5b60403d1061109c576102c0516102c001601c81511161109c5780518061034052602082018051610360525050506103408051602082012090506325829410610200526060610200600461021c6001606051600180821061109c57808203905090506020526000526040600020545afa610285573d600060003e3d6000fd5b60403d1061109c576102005161020001601c81511161109c57805180610280526020820180516102a0525050506102808051602082012090501461109c575b60405160016060516020526000526040600020556060516001818183011061109c57808201905090506000556060517fa6fbd216b6734f34092f1be6b7247e1551a6d4f2d5000c53721cfdc119a5b7cf60406040516101405280610160526325829410608052606060806004609c6040515afa610346573d600060003e3d6000fd5b60403d1061109c57608051608001601c81511161109c57805180610100526020820180516101205250505061010081610140018151808252602083016020830181518152505050805180602083010181600003601f163682375050601f19601f825160200101169050905081019050610140a2005b63108ca11e81186103d15760006104a0526103e4565b63b0b40fce81186105015760a4356104a0525b6004358060a01c61109c576103a0526024358060a01c61109c576103c0526044358060a01c61109c576103e052606435600401604081351161109c578035806104005260208201818161042037505050608435600401602081351161109c578035806104605260208201803561048052505050600754331861109c57600054600180821061109c57808203905090506104a05180821061109c57808203905090506104c0526103a051604052336060526103e0516080526103c05160a052610400518060c0528060e08261042060045afa50506104605180610120526104805161014052506104c051610160526104dc610500610cb2565b610500516104e0526103a0516040526104e0516060526104fa610e1a565b60206104e0f35b635b73aa0d81186105175760006104605261052a565b635bd4b0f2811861070c5760c435610460525b6004358060a01c61109c57610340526024358060a01c61109c57610360526044358060a01c61109c57610380526064358060a01c61109c576103a052608435600401604081351161109c578035806103c0526020820181816103e03750505060a435600401602081351161109c578035806104205260208201803561044052505050600054600180821061109c57808203905090506104605180821061109c57808203905090506104805261034051604052610360516060526103a0516080526103805160a0526103c0518060c0528060e0826103e060045afa5050610420518061012052610440516101405250610480516101605261062b6104c0610cb2565b6104c0516104a05233610340517f57a9cdc2a05e05f66e76769bdbe88e21ec45d9ee0f97d4cb60395d4c75dcbcda60406104a05161058052806105a05263258294106104c05260606104c060046104dc6104a0515afa610690573d600060003e3d6000fd5b60403d1061109c576104c0516104c001601c81511161109c57805180610540526020820180516105605250505061054081610580018151808252602083016020830181518152505050805180602083010181600003601f163682375050601f19601f825160200101169050905081019050610580a360206104a0f35b6329b2e0c681186107225760006103c052610735565b63b366a35c8118610900576024356103c0525b6004358060a01c61109c576103a052600754331861109c5733635aa6e6756103e05260206103e060046103fc6103a0515afa610776573d600060003e3d6000fd5b60203d1061109c576103e0518060a01c61109c5761042052610420511861109c57600054600180821061109c57808203905090506103c05180821061109c57808203905090506103e0526325829410610440526060610440600461045c60016103e0516020526000526040600020545afa6107f6573d600060003e3d6000fd5b60403d1061109c576104405161044001601c81511161109c578051806104c0526020820180516104e0525050506104c0805180610400526020820180516104205250505061040051610420206325829410610500526060610500600461051c6103a0515afa61086a573d600060003e3d6000fd5b60403d1061109c576105005161050001601c81511161109c57805180610580526020820180516105a0525050506105808051602082012090501861109c5763fc0c546a610440526020610440600461045c6103a0515afa6108d0573d600060003e3d6000fd5b60203d1061109c57610440518060a01c61109c5761048052610480516040526103a0516060526108fe610e1a565b005b632cad8f9f811861091557600160605261092f565b635e05f6af811861095c576024358060011c61109c576060525b6004358060a01c61109c57604052600754331861109c57606051600a604051602052600052604060002055005b6360bd68f88118610a87576004358060a01c61109c57604052602435600401607881351161109c5780358060605260208201818160803750505060075433146109b457600a336020526000526040600020541561109c575b606051806009604051602052600052604060002055600160096040516020526000526040600020016000602083601f01046004811161109c578015610a0c57905b6020810260800151818401556001018181186109f5575b505050507f07bd58794c2ca0ae152f7719eb5f02c654476de972cadec0e8191ae8be42096d6040604051610100528061012052806101000160605180825260208201818183608060045afa90505050805180602083010181600003601f163682375050601f19601f82516020010116905081019050610100a1005b6356e0a94b8118610a9e5760005460405260206040f35b63b6a9f40f8118610ac357600160043560205260005260406000205460405260206040f35b63f9c7bba58118610af6576004358060a01c61109c57604052600260405160205260005260406000205460605260206060f35b637bbfc69e8118610b3a576004358060a01c61109c576040526003604051602052600052604060002080602435602052600052604060002090505460605260206060f35b634f64b2be8118610b5f57600460043560205260005260406000205460405260206040f35b638e499bcf8118610b765760055460405260206040f35b63c3c5a5478118610ba9576004358060a01c61109c57604052600660405160205260005260406000205460605260206060f35b635aa6e6758118610bc05760075460405260206040f35b63f39c38a08118610bd75760085460405260206040f35b6358b8f8428118610c77576004358060a01c61109c576040526020806060526009604051602052600052604060002081606001815480825260018301602083016000602084601f01046004811161109c578015610c4657905b8084015460208202840152600101818118610c30575b5050505050805180602083010181600003601f163682375050601f19601f8251602001011690509050810190506060f35b63ee711ed58118610caa576004358060a01c61109c57604052600a60405160205260005260406000205460605260206060f35b505b60006000fd5b600161016051602052600052604060002054610180526000610180511461109c577f602d3d8160093d39f3363d3d373d3d3d363d73000000000000000000000000006101c0526101805160601b6101d3527f5af43d82803e903d91602b57fd5bf300000000000000000000000000000000006101e75260366101c06000f06101a05263a5b81fdf6101c05260c06040516101e05260605161020052608051610220528061024052806101e00160c0518082526020820181818360e060045afa90505050805180602083010181600003601f163682375050601f19601f825160200101169050810190508061026052806101e00161012051808252602082016101405181525050805180602083010181600003601f163682375050601f19601f8251602001011690508101905060a05161028052506101a0513b1561109c57600060006101646101dc60006101a0515af1610e11573d600060003e3d6000fd5b6101a051815250565b600260405160205260005260406000205460805260006080511115610f2e5763258294106102e05260606102e060046102fc6060515afa610e60573d600060003e3d6000fd5b60403d1061109c576102e0516102e001601c81511161109c5780518061036052602082018051610380525050506103608051602082012090506325829410610220526060610220600461023c6003604051602052600052604060002080608051600180821061109c578082039050905060205260005260406000209050545afa610eef573d600060003e3d6000fd5b60403d1061109c576102205161022001601c81511161109c578051806102a0526020820180516102c0525050506102a08051602082012090501461109c575b606051600360405160205260005260406000208060805160205260005260406000209050556080516001818183011061109c578082019050905060026040516020526000526040600020556006604051602052600052604060002054610fce576001600660405160205260005260406000205560405160046005546020526000526040600020556005546001818183011061109c57808201905090506005555b6080516040517fce089905ba4a4d622553bcb5646fd23e895c256f0376eee04e99e61cec1dc7e86040606051610160528061018052632582941060a052606060a0600460bc6060515afa611027573d600060003e3d6000fd5b60403d1061109c5760a05160a001601c81511161109c57805180610120526020820180516101405250505061012081610160018151808252602083016020830181518152505050805180602083010181600003601f163682375050601f19601f825160200101169050905081019050610160a3565b600080fd
```


CommonHealthCheck.sol

CommonHealthCheck.sol

Functions

setGovernance

setManagement

setProfitLimitRatio

setlossLimitRatio

setStrategyLimits

setCheck

check

# CommonHealthCheck.sol

## Functions

### setGovernance

```
function setGovernance( ) external
```

### setManagement

```
function setManagement( ) external
```

### setProfitLimitRatio

```
function setProfitLimitRatio( ) external
```

### setlossLimitRatio

```
function setlossLimitRatio( ) external
```

### setStrategyLimits

```
function setStrategyLimits( ) external
```

### setCheck

```
function setCheck( ) external
```

### check

```
function check( ) external returns (bool)
```

### _runChecks

```
function _runChecks( ) internal returns (bool)
```

### _executeDefaultCheck

```
function _executeDefaultCheck( ) internal returns (bool)
```


BaseStrategy.sol

BaseStrategy.sol

Functions

apiVersion

Return Values

name

Return Values

delegatedAssets

constructor

Parameters

setHealthCheck

setDoHealthCheck

setStrategist

Parameters

setKeeper

Parameters

setRewards

Parameters

setMinReportDelay

Parameters

setMaxReportDelay

Parameters

setCreditThreshold

Parameters

setForceHarvestTriggerOnce

Parameters

setBaseFeeOracle

Parameters

setMetadataURI

Parameters

governance

ethToWant

Parameters

Return Values

estimatedTotalAssets

Return Values

isActive

prepareReturn

adjustPosition

liquidatePosition

liquidateAllPositions

tendTrigger

Parameters

Return Values

tend

harvestTrigger

Parameters

Return Values

isBaseFeeAcceptable

Return Values

harvest

withdraw

Parameters

Return Values

prepareMigration

migrate

Parameters

setEmergencyExit

protectedTokens

sweep

Parameters

Events

Harvested

UpdatedStrategist

UpdatedKeeper

UpdatedRewards

UpdatedMinReportDelay

UpdatedMaxReportDelay

UpdatedBaseFeeOracle

UpdatedCreditThreshold

ForcedHarvestTrigger

EmergencyExitEnabled

UpdatedMetadataURI

SetHealthCheck

SetDoHealthCheck

# BaseStrategy.sol

## Functions

### apiVersion

```
function apiVersion( ) public returns (string)
```

Used to track which version of `StrategyAPI` this Strategy
implements.

The Strategy's version must match the Vault's `API_VERSION`.

#### Return Values

NameTypeDescription`A`string which holds the current API version of this contract.

### name

```
function name( ) external returns (string)
```

This Strategy's name.

@dev
You can use this field to manage the "version" of this Strategy, e.g.
`StrategySomethingOrOtherV1`. However, "API Version" is managed by
`apiVersion()` function above.

#### Return Values

NameTypeDescription`This`Strategy's name.

### delegatedAssets

```
function delegatedAssets( ) external returns (uint256)
```

The amount (priced in want) of the total assets managed by this strategy should not count
towards Yearn's TVL calculations.

@dev
You can override this field to set it to a non-zero value if some of the assets of this
Strategy is somehow delegated inside another part of Yearn's ecosystem e.g. another Vault.
Note that this value must be strictly less than or equal to the amount provided by
`estimatedTotalAssets()` below, as the TVL calc will be total assets minus delegated assets.
Also note that this value is used to determine the total assets under management by this
strategy, for the purposes of computing the management fee in `Vault`

@return
The amount of assets this strategy manages that should not be included in Yearn's Total Value
Locked (TVL) calculation across it's ecosystem.

### _onlyAuthorized

```
function _onlyAuthorized( ) internal
```

### _onlyEmergencyAuthorized

```
function _onlyEmergencyAuthorized( ) internal
```

### _onlyStrategist

```
function _onlyStrategist( ) internal
```

### _onlyGovernance

```
function _onlyGovernance( ) internal
```

### _onlyRewarder

```
function _onlyRewarder( ) internal
```

### _onlyKeepers

```
function _onlyKeepers( ) internal
```

### _onlyVaultManagers

```
function _onlyVaultManagers( ) internal
```

### constructor

```
function constructor( ) internal
```

### _initialize

```
function _initialize( address _vault, address _strategist, address _rewards, address _keeper ) internal
```

Initializes the Strategy, this is called only once, when the
contract is deployed.

`_vault` should implement `VaultAPI`.

#### Parameters

NameTypeDescription`_vault`addressThe address of the Vault responsible for this Strategy.`_strategist`addressThe address to assign as `strategist`.The strategist is able to change the reward address`_rewards`addressThe address to use for pulling rewards.`_keeper`addressThe address of the _keeper._keepercan harvest and tend a strategy.

### setHealthCheck

```
function setHealthCheck( ) external
```

### setDoHealthCheck

```
function setDoHealthCheck( ) external
```

### setStrategist

```
function setStrategist( address _strategist ) external
```

Used to change `strategist`.

This may only be called by governance or the existing strategist.

#### Parameters

NameTypeDescription`_strategist`addressThe new address to assign as `strategist`.

### setKeeper

```
function setKeeper( address _keeper ) external
```

Used to change `keeper`.

`keeper` is the only address that may call `tend()` or `harvest()`,
other than `governance()` or `strategist`. However, unlike
`governance()` or `strategist`, `keeper` may only call `tend()`
and `harvest()`, and no other authorized functions, following the
principle of least privilege.

This may only be called by governance or the strategist.

#### Parameters

NameTypeDescription`_keeper`addressThe new address to assign as `keeper`.

### setRewards

```
function setRewards( address _rewards ) external
```

Used to change `rewards`. EOA or smart contract which has the permission
to pull rewards from the vault.

This may only be called by the strategist.

#### Parameters

NameTypeDescription`_rewards`addressThe address to use for pulling rewards.

### setMinReportDelay

```
function setMinReportDelay( uint256 _delay ) external
```

Used to change `minReportDelay`. `minReportDelay` is the minimum number
of blocks that should pass for `harvest()` to be called.

For external keepers (such as the Keep3r network), this is the minimum
time between jobs to wait. (see `harvestTrigger()`
for more details.)

This may only be called by governance or the strategist.

#### Parameters

NameTypeDescription`_delay`uint256The minimum number of seconds to wait between harvests.

### setMaxReportDelay

```
function setMaxReportDelay( uint256 _delay ) external
```

Used to change `maxReportDelay`. `maxReportDelay` is the maximum number
of blocks that should pass for `harvest()` to be called.

For external keepers (such as the Keep3r network), this is the maximum
time between jobs to wait. (see `harvestTrigger()`
for more details.)

This may only be called by governance or the strategist.

#### Parameters

NameTypeDescription`_delay`uint256The maximum number of seconds to wait between harvests.

### setCreditThreshold

```
function setCreditThreshold( uint256 _creditThreshold ) external
```

Used to ensure that any significant credit a strategy has from the
vault will be automatically harvested.

This may only be called by governance or management.

#### Parameters

NameTypeDescription`_creditThreshold`uint256The number of want tokens that willautomatically trigger a harvest.

### setForceHarvestTriggerOnce

```
function setForceHarvestTriggerOnce( bool _forceHarvestTriggerOnce ) external
```

Used to automatically trigger a harvest by our keepers. Can be
useful if gas prices are too high now, and we want to harvest
later once prices have lowered.

This may only be called by governance or management.

#### Parameters

NameTypeDescription`_forceHarvestTriggerOnce`boolValue of true tells keepers to harvestour strategy

### setBaseFeeOracle

```
function setBaseFeeOracle( address _baseFeeOracle ) external
```

Used to set our baseFeeOracle, which checks the network's current base
fee price to determine whether it is an optimal time to harvest or tend.

This may only be called by governance or management.

#### Parameters

NameTypeDescription`_baseFeeOracle`addressAddress of our baseFeeOracle

### setMetadataURI

```
function setMetadataURI( string _metadataURI ) external
```

Used to change `metadataURI`. `metadataURI` is used to store the URI
of the file describing the strategy.

This may only be called by governance or the strategist.

#### Parameters

NameTypeDescription`_metadataURI`stringThe URI that describe the strategy.

### governance

```
function governance( ) internal returns (address)
```

Resolve governance address from Vault contract, used to make assertions
on protected functions in the Strategy.

### ethToWant

```
function ethToWant( uint256 _amtInWei ) public returns (uint256)
```

Provide an accurate conversion from `_amtInWei` (denominated in wei)
to `want` (using the native decimal characteristics of `want`).

@dev
Care must be taken when working with decimals to assure that the conversion
is compatible. As an example:

given 1e17 wei (0.1 ETH) as input, and want is USDC (6 decimals),
with USDC/ETH = 1800, this should give back 1800000000 (180 USDC)

#### Parameters

NameTypeDescription`_amtInWei`uint256The amount (in wei/1e-18 ETH) to convert to `want`

#### Return Values

NameTypeDescription`The`uint256amount in `want` of `_amtInEth` converted to `want`

### estimatedTotalAssets

```
function estimatedTotalAssets( ) public returns (uint256)
```

Provide an accurate estimate for the total amount of assets
(principle + return) that this Strategy is currently managing,
denominated in terms of `want` tokens.

This total should be "realizable" e.g. the total value that could
actually be obtained from this Strategy if it were to divest its
entire position based on current on-chain conditions.

@dev
Care must be taken in using this function, since it relies on external
systems, which could be manipulated by the attacker to give an inflated
(or reduced) value produced by this function, based on current on-chain
conditions (e.g. this function is possible to influence through
flashloan attacks, oracle manipulations, or other DeFi attack
mechanisms).

It is up to governance to use this function to correctly order this
Strategy relative to its peers in the withdrawal queue to minimize
losses for the Vault based on sudden withdrawals. This value should be
higher than the total debt of the Strategy and higher than its expected
value to be "safe".

#### Return Values

NameTypeDescription`The`estimated total assets in this Strategy.

### isActive

```
function isActive( ) public returns (bool)
```

### prepareReturn

```
function prepareReturn( ) internal returns (uint256 _profit, uint256 _loss, uint256 _debtPayment)
```

Perform any Strategy unwinding or other calls necessary to capture the
"free return" this Strategy has generated since the last time its core
position(s) were adjusted. Examples include unwrapping extra rewards.
This call is only used during "normal operation" of a Strategy, and
should be optimized to minimize losses as much as possible.

This method returns any realized profits and/or realized losses
incurred, and should return the total amounts of profits/losses/debt
payments (in `want` tokens) for the Vault's accounting (e.g.
`want.balanceOf(this) >= _debtPayment + _profit`).

`_debtOutstanding` will be 0 if the Strategy is not past the configured
debt limit, otherwise its value will be how far past the debt limit
the Strategy is. The Strategy's debt limit is configured in the Vault.

NOTE: `_debtPayment` should be less than or equal to `_debtOutstanding`.
It is okay for it to be less than `_debtOutstanding`, as that
should only used as a guide for how much is left to pay back.
Payments should be made to minimize loss from slippage, debt,
withdrawal fees, etc.

See `vault.debtOutstanding()`.

### adjustPosition

```
function adjustPosition( ) internal
```

Perform any adjustments to the core position(s) of this Strategy given
what change the Vault made in the "investable capital" available to the
Strategy. Note that all "free capital" in the Strategy after the report
was made is available for reinvestment. Also note that this number
could be 0, and you should handle that scenario accordingly.

See comments regarding `_debtOutstanding` on `prepareReturn()`.

### liquidatePosition

```
function liquidatePosition( ) internal returns (uint256 _liquidatedAmount, uint256 _loss)
```

Liquidate up to `_amountNeeded` of `want` of this strategy's positions,
irregardless of slippage. Any excess will be re-invested with `adjustPosition()`.
This function should return the amount of `want` tokens made available by the
liquidation. If there is a difference between them, `_loss` indicates whether the
difference is due to a realized loss, or if there is some other sitution at play
(e.g. locked funds) where the amount made available is less than what is needed.

NOTE: The invariant `_liquidatedAmount + _loss NameTypeDescription`callCostInWei`uint256The keeper's estimated gas cost to call `tend()` (in wei).

#### Return Values

NameTypeDescription`if`uint256`tend()` should be called, `false` otherwise.

### tend

```
function tend( ) external
```

Adjust the Strategy's position. The purpose of tending isn't to
realize gains, but to maximize yield by reinvesting any returns.

See comments on `adjustPosition()`.

This may only be called by governance, the strategist, or the keeper.

### harvestTrigger

```
function harvestTrigger( uint256 callCostInWei ) public returns (bool)
```

Provide a signal to the keeper that `harvest()` should be called. The
keeper will provide the estimated gas cost that they would pay to call
`harvest()`, and this function should use that estimate to make a
determination if calling it is "worth it" for the keeper. This is not
the only consideration into issuing this trigger, for example if the
position would be negatively affected if `harvest()` is not called
shortly, then this can return `true` even if the keeper might be "at a
loss" (keepers are always reimbursed by Yearn).

@dev
`callCostInWei` must be priced in terms of `wei` (1e-18 ETH).

This call and `tendTrigger` should never return `true` at the
same time.

See `maxReportDelay`, `creditThreshold` to adjust the
strategist-controlled parameters that will influence whether this call
returns `true` or not. These parameters will be used in conjunction
with the parameters reported to the Vault (see `params`) to determine
if calling `harvest()` is merited.

This trigger also checks the network's base fee to avoid harvesting during
times of high network congestion.

Consider use of super.harvestTrigger() in any override to build on top
of this logic instead of replacing it. For example, if using `minReportDelay`.

It is expected that an external system will check `harvestTrigger()`.
This could be a script run off a desktop or cloud bot (e.g.
https://github.com/iearn-finance/yearn-vaults/blob/main/scripts/keep.py),
or via an integration with the Keep3r network (e.g.
https://github.com/Macarse/GenericKeep3rV2/blob/master/contracts/keep3r/GenericKeep3rV2.sol).

#### Parameters

NameTypeDescription`callCostInWei`uint256The keeper's estimated gas cost to call `harvest()` (in wei).

#### Return Values

NameTypeDescription`if`uint256`harvest()` should be called, `false` otherwise.

### isBaseFeeAcceptable

```
function isBaseFeeAcceptable( ) public returns (bool)
```

Check if the current network base fee is below our external target. If
not, then harvestTrigger will return false.

#### Return Values

NameTypeDescription`if``harvest()` should be allowed, `false` otherwise.

### harvest

```
function harvest( ) external
```

Harvests the Strategy, recognizing any profits or losses and adjusting
the Strategy's position.

In the rare case the Strategy is in emergency shutdown, this will exit
the Strategy's position.

This may only be called by governance, the strategist, or the keeper.

@dev
When `harvest()` is called, the Strategy reports to the Vault (via
`vault.report()`), so in some cases `harvest()` must be called in order
to take in profits, to borrow newly available funds from the Vault, or
otherwise adjust its position. In other cases `harvest()` must be
called to report to the Vault on the Strategy's position, especially if
any losses have occurred.

### withdraw

```
function withdraw( uint256 _amountNeeded ) external returns (uint256 _loss)
```

Withdraws `_amountNeeded` to `vault`.

This may only be called by the Vault.

#### Parameters

NameTypeDescription`_amountNeeded`uint256How much `want` to withdraw.

#### Return Values

NameTypeDescription`_loss`uint256Any realized losses

### prepareMigration

```
function prepareMigration( ) internal
```

Do anything necessary to prepare this Strategy for migration, such as
transferring any reserve or LP tokens, CDPs, or other tokens or stores of
value.

### migrate

```
function migrate( address _newStrategy ) external
```

Transfers all `want` from this Strategy to `_newStrategy`.

This may only be called by the Vault.

@dev
The new Strategy's Vault must be the same as this Strategy's Vault.
The migration process should be carefully performed to make sure all
the assets are migrated to the new address, which should have never
interacted with the vault before.

#### Parameters

NameTypeDescription`_newStrategy`addressThe Strategy to migrate to.

### setEmergencyExit

```
function setEmergencyExit( ) external
```

Activates emergency exit. Once activated, the Strategy will exit its
position upon the next harvest, depositing all funds into the Vault as
quickly as is reasonable given on-chain conditions.

This may only be called by governance or the strategist.

@dev
See `vault.setEmergencyShutdown()` and `harvest()` for further details.

### protectedTokens

```
function protectedTokens( ) internal returns (address[])
```

Override this to add all tokens/tokenized positions this contract
manages on a persistent basis (e.g. not just for swapping back to
want ephemerally).

NOTE: Do not include `want`, already included in `sweep` below.

Example:

```
function protectedTokens() internal override view returns (address[] memory) { address[] memory protected = new address[](3); protected[0] = tokenA; protected[1] = tokenB; protected[2] = tokenC; return protected; }
```

### sweep

```
function sweep( address _token ) external
```

Removes tokens from this Strategy that are not the type of tokens
managed by this Strategy. This may be used in case of accidentally
sending the wrong kind of token to this Strategy.

Tokens will be sent to `governance()`.

This will fail if an attempt is made to sweep `want`, or any tokens
that are protected by this Strategy.

This may only be called by governance.

@dev
Implement `protectedTokens()` to specify any additional tokens that
should be protected from sweeping in addition to `want`.

#### Parameters

NameTypeDescription`_token`addressThe token to transfer out of this vault.

## Events

### Harvested

```
event Harvested( )
```

### UpdatedStrategist

```
event UpdatedStrategist( )
```

### UpdatedKeeper

```
event UpdatedKeeper( )
```

### UpdatedRewards

```
event UpdatedRewards( )
```

### UpdatedMinReportDelay

```
event UpdatedMinReportDelay( )
```

### UpdatedMaxReportDelay

```
event UpdatedMaxReportDelay( )
```

### UpdatedBaseFeeOracle

```
event UpdatedBaseFeeOracle( )
```

### UpdatedCreditThreshold

```
event UpdatedCreditThreshold( )
```

### ForcedHarvestTrigger

```
event ForcedHarvestTrigger( )
```

### EmergencyExitEnabled

```
event EmergencyExitEnabled( )
```

### UpdatedMetadataURI

```
event UpdatedMetadataURI( )
```

### SetHealthCheck

```
event SetHealthCheck( )
```

### SetDoHealthCheck

```
event SetDoHealthCheck( )
```


BaseFeeOracle.sol

BaseFeeOracle.sol

Functions

constructor

isCurrentBaseFeeAcceptable

setMaxAcceptableBaseFee

Parameters

setManualBaseFeeBool

Parameters

setAuthorized

Parameters

setPendingGovernance

Parameters

acceptGovernance

setBaseFeeProvider

Parameters

Events

NewGovernance

NewProvider

UpdatedMaxBaseFee

UpdatedManualBaseFee

UpdatedAuthorization

# BaseFeeOracle.sol

Interprets the base fee from our base fee provider contract to determine if a harvest is permissable.

Version 0.1.0

## Functions

### constructor

```
function constructor( ) public
```

Use this if our network hasn't implemented the base fee method yet

### isCurrentBaseFeeAcceptable

```
function isCurrentBaseFeeAcceptable( ) public returns (bool)
```

Returns whether we should allow harvests based on current base fee.

### setMaxAcceptableBaseFee

```
function setMaxAcceptableBaseFee( uint256 _maxAcceptableBaseFee ) external
```

Set the maximum base fee we want for our keepers to accept.
Gwei is 1e9.

Throws if the caller is not authorized or gov.

#### Parameters

NameTypeDescription`_maxAcceptableBaseFee`uint256The acceptable maximum price to pay in wei.

### setManualBaseFeeBool

```
function setManualBaseFeeBool( bool _manualBaseFeeBool ) external
```

If we don't have a provider, then manually determine if true or not.
Useful in testing as well.

Throws if the caller is not authorized or gov.

#### Parameters

NameTypeDescription`_manualBaseFeeBool`boolBoolean to allow/block harvests if we don't have a provider set up.

### setAuthorized

```
function setAuthorized( address _target, bool _value ) external
```

Controls whether a non-gov address can adjust certain params.

Throws if the caller is not current governance.

#### Parameters

NameTypeDescription`_target`addressThe address to add/remove authorization for.`_value`boolBoolean to grant or revoke access.

### setPendingGovernance

```
function setPendingGovernance( address _governance ) external
```

Starts the 1st phase of the governance transfer.

Throws if the caller is not current governance.

#### Parameters

NameTypeDescription`_governance`addressThe next governance address

### acceptGovernance

```
function acceptGovernance( ) external
```

Completes the 2nd phase of the governance transfer.

Throws if the caller is not the pending caller.
Emits a `NewGovernance` event.

### setBaseFeeProvider

```
function setBaseFeeProvider( address _baseFeeProvider ) external
```

Sets the address used to pull the current network base fee.

Throws if the caller is not current governance.

#### Parameters

NameTypeDescription`_baseFeeProvider`addressThe network's baseFeeProvider address

### _onlyAuthorized

```
function _onlyAuthorized( ) internal
```

### _onlyGovernance

```
function _onlyGovernance( ) internal
```

## Events

### NewGovernance

```
event NewGovernance( )
```

### NewProvider

```
event NewProvider( )
```

### UpdatedMaxBaseFee

```
event UpdatedMaxBaseFee( )
```

### UpdatedManualBaseFee

```
event UpdatedManualBaseFee( )
```

### UpdatedAuthorization

```
event UpdatedAuthorization( )
```


Deprecated Smart Contracts

Deprecated Smart Contracts

🗃 yVaults V3

🗃 yVaults V2

🗃 yVaults V1

# Deprecated Smart Contracts

info

These are Yearn legacy contracts. Vaults may not be updated after being deployed so live yVaults may use these contracts. If you are creating new yVaults, we highly recommend using the most recent version of the contracts.

## 🗃 yVaults V3

2 items

## 🗃 yVaults V2

8 items

## 🗃 yVaults V1

2 items


VaultV3.vy

Yearn V3 Vault**

Functions

initialize

Parameters

setName

Parameters

setSymbol

Parameters

Parameters

Parameters

Parameters

Parameters

Parameters

Parameters

Parameters

Parameters

Parameters

Parameters

setProfitMaxUnlockTime

Parameters

Parameters

Parameters

Parameters

Parameters

isShutdown

Return Values

unlockedShares

Return Values

pricePerShare

Return Values

Return Values

Parameters

Return Values

Parameters

Parameters

Parameters

Parameters

Parameters

Parameters

Parameters

Return Values

Parameters

Return Values

deposit

Parameters

Return Values

mint

Parameters

Return Values

withdraw

Parameters

Return Values

withdraw

Parameters

Return Values

withdraw

Parameters

Return Values

redeem

Parameters

Return Values

redeem

Parameters

Return Values

redeem

Parameters

Return Values

approve

Parameters

Return Values

transfer

Parameters

Return Values

transferFrom

Parameters

Return Values

permit

Parameters

Return Values

balanceOf

Parameters

Return Values

totalSupply

Return Values

totalAssets

Return Values

totalIdle

Return Values

totalDebt

Return Values

convertToShares

Parameters

Return Values

previewDeposit

Parameters

Return Values

previewMint

Parameters

Return Values

convertToAssets

Parameters

Return Values

maxDeposit

Parameters

Return Values

maxMint

Parameters

Return Values

maxWithdraw

Parameters

Return Values

maxWithdraw

Parameters

Return Values

maxWithdraw

Parameters

Return Values

maxRedeem

Parameters

Return Values

maxRedeem

Parameters

Return Values

maxRedeem

Parameters

Return Values

previewWithdraw

Parameters

Return Values

previewRedeem

Parameters

Return Values

FACTORY

Return Values

apiVersion

Return Values

Parameters

Return Values

profitMaxUnlockTime

Return Values

fullProfitUnlockDate

Return Values

profitUnlockingRate

Return Values

lastProfitUpdate

Return Values

Return Values

Events

Deposit

Withdraw

Transfer

Approval

StrategyChanged

StrategyReported

DebtUpdated

RoleSet

UpdateRoleManager

UpdateAccountant

UpdateDepositLimitModule

UpdateWithdrawLimitModule

UpdateDefaultQueue

UpdateUseDefaultQueue

UpdateAutoAllocate

UpdatedMaxDebtForStrategy

UpdateDepositLimit

UpdateMinimumTotalIdle

UpdateProfitMaxUnlockTime

DebtPurchased

Shutdown

# VaultV3.vy

Git Source (https://github.com/yearn/yearn-vaults-v3/blob/92716ed7298b2f3e5c1afc339dfe7c85868c747e/contracts/VaultV3.vy)

vyper: `0.3.7`
author: `yearn.finance`
license: `GNU AGPLv3`

## Yearn V3 Vault**

The Yearn VaultV3 is designed as a non-opinionated system to distribute funds of depositors for a specific `asset` into different opportunities (aka Strategies) and manage accounting in a robust way. Depositors receive shares (aka vaults tokens) proportional to their deposit amount. Vault tokens are yield-bearing and can be redeemed at any time to get back deposit plus any yield generated. Addresses that are given different permissioned roles by the `role_manager` are then able to allocate funds as they best see fit to different strategies and adjust the strategies and allocations as needed, as well as reporting realized profits or losses. Strategies are any ERC-4626 compliant contracts that use the same underlying `asset` as the vault. The vault provides no assurances as to the safety of any strategy and it is the responsibility of those that hold the corresponding roles to choose and fund strategies that best fit their desired specifications. Those holding vault tokens are able to redeem the tokens for the corresponding amount of underlying asset based on any reported profits or losses since their initial deposit. The vault is built to be customized by the management to be able to fit their specific desired needs. Including the customization of strategies, accountants, ownership etc.

## Functions

### initialize

Initialize a new vault. Sets the asset, name, symbol, and role manager.

```
function initialize(address,string,string,address,uint256)
```

#### Parameters

NameTypeDescriptionassetaddressThe address of the asset that the vault will accept.namestringThe name of the vault token.symbolstringThe symbol of the vault token.role_manageraddressThe address that can add and remove roles to addressesprofit_max_unlock_timeuint256The amount of time that the profit will be locked for

### setName

Change the vault name.

Can only be called by the Role Manager.

```
function setName(string)
```

#### Parameters

NameTypeDescriptionnamestringThe new name for the vault.

### setSymbol

Change the vault symbol.

Can only be called by the Role Manager.

```
function setSymbol(string)
```

#### Parameters

NameTypeDescriptionsymbolstringThe new name for the vault.

### set_accountant

Set the new accountant address.

```
function set_accountant(address)
```

#### Parameters

NameTypeDescriptionnew_accountantaddressThe new accountant address.

### set_default_queue

Set the new default queue array.

Will check each strategy to make sure it is active. But will not check that the same strategy is not added twice. maxRedeem and maxWithdraw return values may be inaccurate if a strategy is added twice.

```
function set_default_queue(address[])
```

#### Parameters

NameTypeDescriptionnew_default_queueaddress[]The new default queue array.

### set_use_default_queue

Set a new value for `use_default_queue`.

If set `True` the default queue will always be used no matter whats passed in.

```
function set_use_default_queue(bool)
```

#### Parameters

NameTypeDescriptionuse_default_queueboolnew value.

### set_auto_allocate

Set new value for `auto_allocate`

If `True` every `deposit` and `mint` call will try and allocate the deposited amount to the strategy at position 0 of the `default_queue` atomically. NOTE: An empty `default_queue` will cause deposits to fail.

```
function set_auto_allocate(bool)
```

#### Parameters

NameTypeDescriptionauto_allocateboolnew value.

### set_deposit_limit

Set the new deposit limit.

Can not be changed if a deposit_limit_module is set unless the override flag is true or if shutdown.

```
function set_deposit_limit(uint256)
```

#### Parameters

NameTypeDescriptiondeposit_limituint256The new deposit limit.overrideunknownIf a `deposit_limit_module` already set should be overridden.

### set_deposit_limit

Can not be changed if a deposit_limit_module is set unless the override flag is true or if shutdown.

```
function set_deposit_limit(uint256,bool)
```

#### Parameters

NameTypeDescriptiondeposit_limituint256The new deposit limit.overrideboolIf a `deposit_limit_module` already set should be overridden.

### set_deposit_limit_module

Set a contract to handle the deposit limit.

The default `deposit_limit` will need to be set to max uint256 since the module will override it or the override flag must be set to true to set it to max in 1 tx..

```
function set_deposit_limit_module(address)
```

#### Parameters

NameTypeDescriptiondeposit_limit_moduleaddressAddress of the module.overrideunknownIf a `deposit_limit` already set should be overridden.

### set_deposit_limit_module

The default `deposit_limit` will need to be set to max uint256 since the module will override it or the override flag must be set to true to set it to max in 1 tx..

```
function set_deposit_limit_module(address,bool)
```

#### Parameters

NameTypeDescriptiondeposit_limit_moduleaddressAddress of the module.overrideboolIf a `deposit_limit` already set should be overridden.

### set_withdraw_limit_module

Set a contract to handle the withdraw limit.

This will override the default `max_withdraw`.

```
function set_withdraw_limit_module(address)
```

#### Parameters

NameTypeDescriptionwithdraw_limit_moduleaddressAddress of the module.

### set_minimum_total_idle

Set the new minimum total idle.

```
function set_minimum_total_idle(uint256)
```

#### Parameters

NameTypeDescriptionminimum_total_idleuint256The new minimum total idle.

### setProfitMaxUnlockTime

Set the new profit max unlock time.

The time is denominated in seconds and must be less than 1 year. We only need to update locking period if setting to 0, since the current period will use the old rate and on the next report it will be reset with the new unlocking time. Setting to 0 will cause any currently locked profit to instantly unlock and an immediate increase in the vaults Price Per Share.

```
function setProfitMaxUnlockTime(uint256)
```

#### Parameters

NameTypeDescriptionnew_profit_max_unlock_timeuint256The new profit max unlock time.

### set_role

Set the roles for an account.

This will fully override an accounts current roles so it should include all roles the account should hold.

```
function set_role(address,uint256)
```

#### Parameters

NameTypeDescriptionaccountaddressThe account to set the role for.roleuint256The roles the account should hold.

### add_role

Add a new role to an address.

This will add a new role to the account without effecting any of the previously held roles.

```
function add_role(address,uint256)
```

#### Parameters

NameTypeDescriptionaccountaddressThe account to add a role to.roleuint256The new role to add to account.

### remove_role

Remove a single role from an account.

This will leave all other roles for the account unchanged.

```
function remove_role(address,uint256)
```

#### Parameters

NameTypeDescriptionaccountaddressThe account to remove a Role from.roleuint256The Role to remove.

### transfer_role_manager

Step 1 of 2 in order to transfer the role manager to a new address. This will set the future_role_manager. Which will then need to be accepted by the new manager.

```
function transfer_role_manager(address)
```

#### Parameters

NameTypeDescriptionrole_manageraddressThe new role manager address.

### isShutdown

Get if the vault is shutdown.

```
function isShutdown()
```

#### Return Values

NameTypeDescription_output0boolBool representing the shutdown status

### unlockedShares

Get the amount of shares that have been unlocked.

```
function unlockedShares()
```

#### Return Values

NameTypeDescription_output0uint256The amount of shares that are have been unlocked.

### pricePerShare

Get the price per share (pps) of the vault.

This value offers limited precision. Integrations that require exact precision should use convertToAssets or convertToShares instead.

```
function pricePerShare()
```

#### Return Values

NameTypeDescription_output0uint256The price per share.

### get_default_queue

Get the full default queue currently set.

```
function get_default_queue()
```

#### Return Values

NameTypeDescription_output0address[]The current default withdrawal queue.

### process_report

Process the report of a strategy.

```
function process_report(address)
```

#### Parameters

NameTypeDescriptionstrategyaddressThe strategy to process the report for.

#### Return Values

NameTypeDescription_output0uint256The gain and loss of the strategy.

| _output1 | uint256 | |

### buy_debt

Used for governance to buy bad debt from the vault.

This should only ever be used in an emergency in place of force revoking a strategy in order to not report a loss. It allows the DEBT_PURCHASER role to buy the strategies debt for an equal amount of `asset`.

```
function buy_debt(address,uint256)
```

#### Parameters

NameTypeDescriptionstrategyaddressThe strategy to buy the debt foramountuint256The amount of debt to buy from the vault.

### add_strategy

Add a new strategy.

```
function add_strategy(address)
```

#### Parameters

NameTypeDescriptionnew_strategyaddressThe new strategy to add.

### add_strategy

```
function add_strategy(address,bool)
```

#### Parameters

NameTypeDescriptionnew_strategyaddressThe new strategy to add.

### revoke_strategy

Revoke a strategy.

```
function revoke_strategy(address)
```

#### Parameters

NameTypeDescriptionstrategyaddressThe strategy to revoke.

### force_revoke_strategy

Force revoke a strategy.

The vault will remove the strategy and write off any debt left in it as a loss. This function is a dangerous function as it can force a strategy to take a loss. All possible assets should be removed from the strategy first via update_debt. If a strategy is removed erroneously it can be re-added and the loss will be credited as profit. Fees will apply.

```
function force_revoke_strategy(address)
```

#### Parameters

NameTypeDescriptionstrategyaddressThe strategy to force revoke.

### update_max_debt_for_strategy

Update the max debt for a strategy.

```
function update_max_debt_for_strategy(address,uint256)
```

#### Parameters

NameTypeDescriptionstrategyaddressThe strategy to update the max debt for.new_max_debtuint256The new max debt for the strategy.

### update_debt

Update the debt for a strategy.

Pass max uint256 to allocate as much idle as possible.

```
function update_debt(address,uint256)
```

#### Parameters

NameTypeDescriptionstrategyaddressThe strategy to update the debt for.target_debtuint256The target debt for the strategy.max_lossunknownOptional to check realized losses on debt decreases.

#### Return Values

NameTypeDescription_output0uint256The amount of debt added or removed.

### update_debt

Pass max uint256 to allocate as much idle as possible.

```
function update_debt(address,uint256,uint256)
```

#### Parameters

NameTypeDescriptionstrategyaddressThe strategy to update the debt for.target_debtuint256The target debt for the strategy.max_lossuint256Optional to check realized losses on debt decreases.

#### Return Values

NameTypeDescription_output0uint256The amount of debt added or removed.

### deposit

Deposit assets into the vault.

Pass max uint256 to deposit full asset balance.

```
function deposit(uint256,address)
```

#### Parameters

NameTypeDescriptionassetsuint256The amount of assets to deposit.receiveraddressThe address to receive the shares.

#### Return Values

NameTypeDescription_output0uint256The amount of shares minted.

### mint

Mint shares for the receiver.

```
function mint(uint256,address)
```

#### Parameters

NameTypeDescriptionsharesuint256The amount of shares to mint.receiveraddressThe address to receive the shares.

#### Return Values

NameTypeDescription_output0uint256The amount of assets deposited.

### withdraw

Withdraw an amount of asset to `receiver` burning `owner`s shares.

The default behavior is to not allow any loss.

```
function withdraw(uint256,address,address)
```

#### Parameters

NameTypeDescriptionassetsuint256The amount of asset to withdraw.receiveraddressThe address to receive the assets.owneraddressThe address who's shares are being burnt.max_lossunknownOptional amount of acceptable loss in Basis Points.strategiesunknownOptional array of strategies to withdraw from.

#### Return Values

NameTypeDescription_output0uint256The amount of shares actually burnt.

### withdraw

The default behavior is to not allow any loss.

```
function withdraw(uint256,address,address,uint256)
```

#### Parameters

NameTypeDescriptionassetsuint256The amount of asset to withdraw.receiveraddressThe address to receive the assets.owneraddressThe address who's shares are being burnt.max_lossuint256Optional amount of acceptable loss in Basis Points.strategiesunknownOptional array of strategies to withdraw from.

#### Return Values

NameTypeDescription_output0uint256The amount of shares actually burnt.

### withdraw

The default behavior is to not allow any loss.

```
function withdraw(uint256,address,address,uint256,address[])
```

#### Parameters

NameTypeDescriptionassetsuint256The amount of asset to withdraw.receiveraddressThe address to receive the assets.owneraddressThe address who's shares are being burnt.max_lossuint256Optional amount of acceptable loss in Basis Points.strategiesaddress[]Optional array of strategies to withdraw from.

#### Return Values

NameTypeDescription_output0uint256The amount of shares actually burnt.

### redeem

Redeems an amount of shares of `owners` shares sending funds to `receiver`.

The default behavior is to allow losses to be realized.

```
function redeem(uint256,address,address)
```

#### Parameters

NameTypeDescriptionsharesuint256The amount of shares to burn.receiveraddressThe address to receive the assets.owneraddressThe address who's shares are being burnt.max_lossunknownOptional amount of acceptable loss in Basis Points.strategiesunknownOptional array of strategies to withdraw from.

#### Return Values

NameTypeDescription_output0uint256The amount of assets actually withdrawn.

### redeem

The default behavior is to allow losses to be realized.

```
function redeem(uint256,address,address,uint256)
```

#### Parameters

NameTypeDescriptionsharesuint256The amount of shares to burn.receiveraddressThe address to receive the assets.owneraddressThe address who's shares are being burnt.max_lossuint256Optional amount of acceptable loss in Basis Points.strategiesunknownOptional array of strategies to withdraw from.

#### Return Values

NameTypeDescription_output0uint256The amount of assets actually withdrawn.

### redeem

The default behavior is to allow losses to be realized.

```
function redeem(uint256,address,address,uint256,address[])
```

#### Parameters

NameTypeDescriptionsharesuint256The amount of shares to burn.receiveraddressThe address to receive the assets.owneraddressThe address who's shares are being burnt.max_lossuint256Optional amount of acceptable loss in Basis Points.strategiesaddress[]Optional array of strategies to withdraw from.

#### Return Values

NameTypeDescription_output0uint256The amount of assets actually withdrawn.

### approve

Approve an address to spend the vault's shares.

```
function approve(address,uint256)
```

#### Parameters

NameTypeDescriptionspenderaddressThe address to approve.amountuint256The amount of shares to approve.

#### Return Values

NameTypeDescription_output0boolTrue if the approval was successful.

### transfer

Transfer shares to a receiver.

```
function transfer(address,uint256)
```

#### Parameters

NameTypeDescriptionreceiveraddressThe address to transfer shares to.amountuint256The amount of shares to transfer.

#### Return Values

NameTypeDescription_output0boolTrue if the transfer was successful.

### transferFrom

Transfer shares from a sender to a receiver.

```
function transferFrom(address,address,uint256)
```

#### Parameters

NameTypeDescriptionsenderaddressThe address to transfer shares from.receiveraddressThe address to transfer shares to.amountuint256The amount of shares to transfer.

#### Return Values

NameTypeDescription_output0boolTrue if the transfer was successful.

### permit

Approve an address to spend the vault's shares.

```
function permit(address,address,uint256,uint256,uint8,bytes32,bytes32)
```

#### Parameters

NameTypeDescriptionowneraddressThe address to approve.spenderaddressThe address to approve.amountuint256The amount of shares to approve.deadlineuint256The deadline for the permit.vuint8The v component of the signature.rbytes32The r component of the signature.sbytes32The s component of the signature.

#### Return Values

NameTypeDescription_output0boolTrue if the approval was successful.

### balanceOf

Get the balance of a user.

```
function balanceOf(address)
```

#### Parameters

NameTypeDescriptionaddraddressThe address to get the balance of.

#### Return Values

NameTypeDescription_output0uint256The balance of the user.

### totalSupply

Get the total supply of shares.

```
function totalSupply()
```

#### Return Values

NameTypeDescription_output0uint256The total supply of shares.

### totalAssets

Get the total assets held by the vault.

```
function totalAssets()
```

#### Return Values

NameTypeDescription_output0uint256The total assets held by the vault.

### totalIdle

Get the amount of loose `asset` the vault holds.

```
function totalIdle()
```

#### Return Values

NameTypeDescription_output0uint256The current total idle.

### totalDebt

Get the total amount of funds invested across all strategies.

```
function totalDebt()
```

#### Return Values

NameTypeDescription_output0uint256The current total debt.

### convertToShares

Convert an amount of assets to shares.

```
function convertToShares(uint256)
```

#### Parameters

NameTypeDescriptionassetsuint256The amount of assets to convert.

#### Return Values

NameTypeDescription_output0uint256The amount of shares.

### previewDeposit

Preview the amount of shares that would be minted for a deposit.

```
function previewDeposit(uint256)
```

#### Parameters

NameTypeDescriptionassetsuint256The amount of assets to deposit.

#### Return Values

NameTypeDescription_output0uint256The amount of shares that would be minted.

### previewMint

Preview the amount of assets that would be deposited for a mint.

```
function previewMint(uint256)
```

#### Parameters

NameTypeDescriptionsharesuint256The amount of shares to mint.

#### Return Values

NameTypeDescription_output0uint256The amount of assets that would be deposited.

### convertToAssets

Convert an amount of shares to assets.

```
function convertToAssets(uint256)
```

#### Parameters

NameTypeDescriptionsharesuint256The amount of shares to convert.

#### Return Values

NameTypeDescription_output0uint256The amount of assets.

### maxDeposit

Get the maximum amount of assets that can be deposited.

```
function maxDeposit(address)
```

#### Parameters

NameTypeDescriptionreceiveraddressThe address that will receive the shares.

#### Return Values

NameTypeDescription_output0uint256The maximum amount of assets that can be deposited.

### maxMint

Get the maximum amount of shares that can be minted.

```
function maxMint(address)
```

#### Parameters

NameTypeDescriptionreceiveraddressThe address that will receive the shares.

#### Return Values

NameTypeDescription_output0uint256The maximum amount of shares that can be minted.

### maxWithdraw

Get the maximum amount of assets that can be withdrawn.

Complies to normal 4626 interface and takes custom params. NOTE: Passing in a incorrectly ordered queue may result in incorrect returns values.

```
function maxWithdraw(address)
```

#### Parameters

NameTypeDescriptionowneraddressThe address that owns the shares.max_lossunknownCustom max_loss if any.strategiesunknownCustom strategies queue if any.

#### Return Values

NameTypeDescription_output0uint256The maximum amount of assets that can be withdrawn.

### maxWithdraw

Complies to normal 4626 interface and takes custom params. NOTE: Passing in a incorrectly ordered queue may result in incorrect returns values.

```
function maxWithdraw(address,uint256)
```

#### Parameters

NameTypeDescriptionowneraddressThe address that owns the shares.max_lossuint256Custom max_loss if any.strategiesunknownCustom strategies queue if any.

#### Return Values

NameTypeDescription_output0uint256The maximum amount of assets that can be withdrawn.

### maxWithdraw

Complies to normal 4626 interface and takes custom params. NOTE: Passing in a incorrectly ordered queue may result in incorrect returns values.

```
function maxWithdraw(address,uint256,address[])
```

#### Parameters

NameTypeDescriptionowneraddressThe address that owns the shares.max_lossuint256Custom max_loss if any.strategiesaddress[]Custom strategies queue if any.

#### Return Values

NameTypeDescription_output0uint256The maximum amount of assets that can be withdrawn.

### maxRedeem

Get the maximum amount of shares that can be redeemed.

Complies to normal 4626 interface and takes custom params. NOTE: Passing in a incorrectly ordered queue may result in incorrect returns values.

```
function maxRedeem(address)
```

#### Parameters

NameTypeDescriptionowneraddressThe address that owns the shares.max_lossunknownCustom max_loss if any.strategiesunknownCustom strategies queue if any.

#### Return Values

NameTypeDescription_output0uint256The maximum amount of shares that can be redeemed.

### maxRedeem

Complies to normal 4626 interface and takes custom params. NOTE: Passing in a incorrectly ordered queue may result in incorrect returns values.

```
function maxRedeem(address,uint256)
```

#### Parameters

NameTypeDescriptionowneraddressThe address that owns the shares.max_lossuint256Custom max_loss if any.strategiesunknownCustom strategies queue if any.

#### Return Values

NameTypeDescription_output0uint256The maximum amount of shares that can be redeemed.

### maxRedeem

Complies to normal 4626 interface and takes custom params. NOTE: Passing in a incorrectly ordered queue may result in incorrect returns values.

```
function maxRedeem(address,uint256,address[])
```

#### Parameters

NameTypeDescriptionowneraddressThe address that owns the shares.max_lossuint256Custom max_loss if any.strategiesaddress[]Custom strategies queue if any.

#### Return Values

NameTypeDescription_output0uint256The maximum amount of shares that can be redeemed.

### previewWithdraw

Preview the amount of shares that would be redeemed for a withdraw.

```
function previewWithdraw(uint256)
```

#### Parameters

NameTypeDescriptionassetsuint256The amount of assets to withdraw.

#### Return Values

NameTypeDescription_output0uint256The amount of shares that would be redeemed.

### previewRedeem

Preview the amount of assets that would be withdrawn for a redeem.

```
function previewRedeem(uint256)
```

#### Parameters

NameTypeDescriptionsharesuint256The amount of shares to redeem.

#### Return Values

NameTypeDescription_output0uint256The amount of assets that would be withdrawn.

### FACTORY

Address of the factory that deployed the vault.

Is used to retrieve the protocol fees.

```
function FACTORY()
```

#### Return Values

NameTypeDescription_output0addressAddress of the vault factory.

### apiVersion

Get the API version of the vault.

```
function apiVersion()
```

#### Return Values

NameTypeDescription_output0stringThe API version of the vault.

### assess_share_of_unrealised_losses

Assess the share of unrealised losses that a strategy has.

```
function assess_share_of_unrealised_losses(address,uint256)
```

#### Parameters

NameTypeDescriptionstrategyaddressThe address of the strategy.assets_neededuint256The amount of assets needed to be withdrawn.

#### Return Values

NameTypeDescription_output0uint256The share of unrealised losses that the strategy has.

### profitMaxUnlockTime

Gets the current time profits are set to unlock over.

```
function profitMaxUnlockTime()
```

#### Return Values

NameTypeDescription_output0uint256The current profit max unlock time.

### fullProfitUnlockDate

Gets the timestamp at which all profits will be unlocked.

```
function fullProfitUnlockDate()
```

#### Return Values

NameTypeDescription_output0uint256The full profit unlocking timestamp

### profitUnlockingRate

The per second rate at which profits are unlocking.

This is denominated in EXTENDED_BPS decimals.

```
function profitUnlockingRate()
```

#### Return Values

NameTypeDescription_output0uint256The current profit unlocking rate.

### lastProfitUpdate

The timestamp of the last time shares were locked.

```
function lastProfitUpdate()
```

#### Return Values

NameTypeDescription_output0uint256The last profit update.

### DOMAIN_SEPARATOR

Get the domain separator.

```
function DOMAIN_SEPARATOR()
```

#### Return Values

NameTypeDescription_output0bytes32The domain separator.

### accept_role_manager

Accept the role manager transfer.

```
function accept_role_manager()
```

### shutdown_vault

Shutdown the vault.

```
function shutdown_vault()
```

## Events

### Deposit

NameTypeIndexed?senderaddressYesowneraddressYesassetsuint256Nosharesuint256No

### Withdraw

NameTypeIndexed?senderaddressYesreceiveraddressYesowneraddressYesassetsuint256Nosharesuint256No

### Transfer

NameTypeIndexed?senderaddressYesreceiveraddressYesvalueuint256No

### Approval

NameTypeIndexed?owneraddressYesspenderaddressYesvalueuint256No

### StrategyChanged

NameTypeIndexed?strategyaddressYeschange_typeuint256Yes

### StrategyReported

NameTypeIndexed?strategyaddressYesgainuint256Nolossuint256Nocurrent_debtuint256Noprotocol_feesuint256Nototal_feesuint256Nototal_refundsuint256No

### DebtUpdated

NameTypeIndexed?strategyaddressYescurrent_debtuint256Nonew_debtuint256No

### RoleSet

NameTypeIndexed?accountaddressYesroleuint256Yes

### UpdateRoleManager

NameTypeIndexed?role_manageraddressYes

### UpdateAccountant

NameTypeIndexed?accountantaddressYes

### UpdateDepositLimitModule

NameTypeIndexed?deposit_limit_moduleaddressYes

### UpdateWithdrawLimitModule

NameTypeIndexed?withdraw_limit_moduleaddressYes

### UpdateDefaultQueue

NameTypeIndexed?new_default_queueaddress[]No

### UpdateUseDefaultQueue

NameTypeIndexed?use_default_queueboolNo

### UpdateAutoAllocate

NameTypeIndexed?auto_allocateboolNo

### UpdatedMaxDebtForStrategy

NameTypeIndexed?senderaddressYesstrategyaddressYesnew_debtuint256No

### UpdateDepositLimit

NameTypeIndexed?deposit_limituint256No

### UpdateMinimumTotalIdle

NameTypeIndexed?minimum_total_idleuint256No

### UpdateProfitMaxUnlockTime

NameTypeIndexed?profit_max_unlock_timeuint256No

### DebtPurchased

NameTypeIndexed?strategyaddressYesamountuint256No

### Shutdown

NameTypeIndexed?