npm install @yfi/interface-contracts
Source code: yearn-protocol/develop/interfaces/yearn/IStrategy.sol
Returns the address of the unwrapped token that the Strategy takes as deposit.
{% tabs %} {% tab title="Solidity" %}
function want() external view returns (address);
{% endtab %} {% endtabs %}
type | desc | ||
---|---|---|---|
Output | 0 | address | Address of the token the Strategy takes as deposit |
Deposits token (same as want()
returns) into a smart contact specified by the Strategy.
{% tabs %} {% tab title="Solidity" %}
function deposit() external;
{% endtab %} {% endtabs %}
Dust collecting function to create additional rewards out of tokens that were incorrectly sent to the Strategy.
Takes an ERC20 token address and should send the full amount of any such tokens in the Strategy to the Controller.
This function should have access control enforcing the Controller only to be its allowed caller, and checks in place to ensure that the token types to withdraw are not those used by the Strategy.
{% tabs %} {% tab title="Solidity" %}
function withdraw(address) external;
{% endtab %} {% endtabs %}
type | desc | ||
---|---|---|---|
Input | 0 | address | ERC-20 token to be drained |
Partially withdraws funds (denominated in want()
token) from the Strategy, and should always only be sending these to the Vault. In case the Strategy implements harvest()
, a withdrawal fee may be applied. This function should have access control enforcing the Controller only to be its allowed caller.
{% tabs %} {% tab title="Solidity" %}
function withdraw(uint256) external;
{% endtab %} {% endtabs %}
type | desc | ||
---|---|---|---|
Input | 0 | uint | Amount to be withdrawn |
Used to obtain the remaining amount that can be borrowed from the lending platform. Relevant when the Strategy implements a lending platform, such as Aave.
{% tabs %} {% tab title="Solidity" %}
function skim() external;
{% endtab %} {% endtabs %}
Withdraws the entire amount of want()
tokens available, and should always only be sending these to the Vault. This function should have access control enforcing the Controller only to be its allowed caller. Typically used when migrating strategies.
The function typically uses withdraw()
and performs a set of sequential function calls depending on the Strategy.
If the Strategy implements liquidity pools or lending platforms, then withdrawal from these platforms should be performed until the Vault’s unwrapped token is delivered back to the vault.
Returns a uint256
of the total amount withdrawn.
{% tabs %} {% tab title="Solidity" %}
function withdrawAll() external returns (uint256);
{% endtab %} {% endtabs %}
type | desc | ||
---|---|---|---|
Output | 0 | uint256 | The amount withdrawn |
Returns the Strategy's current want()
token balance.
{% tabs %} {% tab title="Solidity" %}
function balanceOf() external view returns (uint256);
{% endtab %} {% endtabs %}
type | desc | ||
---|---|---|---|
Output | 0 | uint256 | Strategy's want() token balance |
Source code: yearn-protocol/develop/interfaces/yearn/IVault.sol
Returns the unwrapped native token address that the Vault takes as deposit.
{% tabs %} {% tab title="Solidity" %}
function token() external view returns (address);
{% endtab %} {% endtabs %}
type | desc | ||
---|---|---|---|
Output | 0 | address | Vault’s unwrapped native token address |
Returns the native underlying token address in Delegated Vaults. For example, in case of aLINK delegated vault, underlying()
returns the address of the LINK token.
{% tabs %} {% tab title="Solidity" %}
// This is only implemented in Delegated Vaults.
function underlying() external view returns (address);
{% endtab %} {% endtabs %}
type | desc | ||
---|---|---|---|
Output | 0 | address | Delegated Vault’s underlying native token address |
Returns the vault’s wrapped token name as a string, e.g. “yearn Dai Stablecoin".
{% tabs %} {% tab title="Solidity" %}
function name() external view returns (string memory);
{% endtab %} {% endtabs %}
type | desc | ||
---|---|---|---|
Output | 0 | string | Vault’s wrapped token name |
Returns the vault’s wrapped token symbol as a string, e.g. “yDai”.
{% tabs %} {% tab title="Solidity" %}
function symbol() external view returns (string memory);
{% endtab %} {% endtabs %}
type | desc | ||
---|---|---|---|
Output | 0 | string | Vault’s wrapped token symbol |
Returns the amount of decimals for this vault’s wrapped token as a uint8
.
{% tabs %} {% tab title="Solidity" %}
function decimals() external view returns (uint8);
{% endtab %} {% endtabs %}
type | desc | ||
---|---|---|---|
Output | 0 | uint8 | No of decimals of the vault's wrapped token. |
Returns the address of the Vault's Controller.
{% tabs %} {% tab title="Solidity" %}
function controller() external view returns (address);
{% endtab %} {% endtabs %}
type | desc | ||
---|---|---|---|
Output | 0 | address | Vault’s Controller contract |
Returns the address of the Vault’s governance contract.
{% tabs %} {% tab title="Solidity" %}
function governance() external view returns (address);
{% endtab %} {% endtabs %}
type | desc | ||
---|---|---|---|
Output | 0 | address | Vault’s Governance contract |
Returns the price of the Vault’s wrapped token, denominated in the unwrapped native token.
The calculation is:
Where nativeTokenBalance
is the current balance of native token (e.g. DAI) in the Vault, Controller and Strategy contracts. And yTokenTotalSupply
is the total supply of the Vault's wrapped Token (e.g. yDAI).
{% tabs %} {% tab title="Solidity" %}
function getPricePerFullShare() external view returns (uint256);
{% endtab %} {% endtabs %}
type | desc | ||
---|---|---|---|
Output | 0 | uint256 | Price of the Vault’s wrapped token denominated in the unwrapped native token |
Deposits the specified amount of the native unwrapped token (same as token()
returns) into the Vault.
{% tabs %} {% tab title="Solidity" %}
function deposit(uint256) external;
{% endtab %} {% endtabs %}
type | desc | ||
---|---|---|---|
Input | 0 | uint256 | Amount to deposit into the Vault. |
Deposits the maximum available amount of the native unwrapped token (same as token()
returns) into the Vault.
{% tabs %} {% tab title="Solidity" %}
function depositAll() external;
{% endtab %} {% endtabs %}
Withdraws the specified amount of the native unwrapped token (same as token()
returns) from the Vault.
{% tabs %} {% tab title="Solidity" %}
function withdraw(uint256) external;
{% endtab %} {% endtabs %}
type | desc | ||
---|---|---|---|
Input | 0 | uint256 | Amount to withdraw from the Vault. |
Withdraws the maximum available amount of the native unwrapped token (same as token()
returns) from the Vault.
{% tabs %} {% tab title="Solidity" %}
function withdrawAll() external;
{% endtab %} {% endtabs %}
Source code: yearn-protocol/develop/interfaces/yearn/IController.sol
Calls Strategy.withdraw()
function for the amount defined in unit256
in the Strategy of the specified address. This function should have access control enforcing the Vault to be its only allowed caller.
{% tabs %} {% tab title="Solidity" %}
function withdraw(address, uint256) external;
{% endtab %} {% endtabs %}
type | desc | ||
---|---|---|---|
Input | 0 | address | Address of the Strategy to withdraw from |
Input | 1 | uint256 | Amount to withdraw |
Returns the Strategy's balance of the specified token.
{% tabs %} {% tab title="Solidity" %}
function balanceOf(address) external view returns (uint256);
{% endtab %} {% endtabs %}
type | desc | ||
---|---|---|---|
Input | 0 | address | Token that is used in the Strategy |
Output | 0 | uint256 | Balance of the specified token |
Transfers the profits earned from the yield generating activities of the Strategy to the Vault. Takes an address of a token to withdraw and an amount.
{% tabs %} {% tab title="Solidity" %}
function earn(address, uint256) external;
{% endtab %} {% endtabs %}
type | desc | ||
---|---|---|---|
Input | 0 | address | Token to be withdrawn to the Vault from the Strategy |
Input | 1 | uint256 | Amount to be withdrawn |
{% hint style="info" %}
Not used by the currently deployed controller. Please refer to Strategy.want()
instead.
{% endhint %}
{% tabs %} {% tab title="Solidity" %}
function want(address) external view returns (address);
{% endtab %} {% endtabs %}
Returns the address of the Treasury which is where the system reward fees go.
{% tabs %} {% tab title="Solidity" %}
function rewards() external view returns (address);
{% endtab %} {% endtabs %}
type | desc | ||
---|---|---|---|
Output | 0 | address | Treasury contract |
Takes a token address and returns the corresponding Vault address.
{% tabs %} {% tab title="Solidity" %}
function vaults(address) external view returns (address);
{% endtab %} {% endtabs %}
type | desc | ||
---|---|---|---|
Input | 0 | address | Token to find a Vault address for |
Output | 0 | address | Vault address that is associated with the specified token |
Takes a token address and returns the corresponding Strategy address.
{% tabs %} {% tab title="Solidity" %}
function strategies(address) external view returns (address);
{% endtab %} {% endtabs %}
type | desc | ||
---|---|---|---|
Input | 0 | address | Token to find a Strategy address for |
Output | 0 | address | Strategy address that is associated with the specified token |
Version | Build | Date |
---|---|---|
Version 0.5.17 | MDc6UmVsZWFzZTI0NjAzMTk5 | Thu Oct 22 01:52:40 UTC 2020 |
Version 0.6.0 | MDc6UmVsZWFzZTIwMzg2Njkz | Thu Oct 22 01:58:22 UTC 2020 |
- Converter.sol
- IController.sol
- Mintr.sol
- OneSplitAudit.sol
- Strategy.sol
- Token.sol
- Vault.sol
name: @yfi/interface-contracts
version: 0.1.0
package size: 13.3 kB
unpacked size: 165.8 kB
shasum: 85be0cafad7ecd37cd6b2a0fc8ecb6eaf9eca73d
integrity: sha512-qnHSQSDZql8U3[...]jurEOQMRqqdtQ==
total files: 17
Point of contact | Method |
---|---|
GitHub | issues |
milkyklim | @milkyklim |
banteg | @banteg |
lehnberg | @lehnberg |
- Review YIP-0.
- Fork the repository by clicking "Fork" in the top right.
- Add your YIP to your fork of the repository. There is a template YIP here.
- Submit a Pull Request to yEarn's YIPs repository.
Your first PR should be a first draft of the final YIP. It must meet the
formatting criteria enforced by the build (largely, correct metadata in the
header). An editor will manually review the first PR for a new YIP and assign
it a number before merging it. Make sure you include a discussions-to
header
with the URL to a new thread on
gov.yearn.finance where people can discuss the YIP as a whole.
SPDX-License-Identifier: MIT
SPDX-FileCopyrightText: Copyright 2020 yearn.finance