Yearn Finance V2

Supported Chains

Available on Ethereum, Arbitrum, Base and Optimism

Available Endpoints:

Click on the endpoint to jump to the section with full details

  • /getbalanceGET -Get balance of the user in a given Vault.

  • /getvaultsGET - Get the number of the vaults along with the respective vault APY.

  • /depositvault GET - Trigger the deposit transaction for the given vault.

  • /withdrawvault POST - Trigger the withdraw transaction for the given vault.

Yield Aggregator IDs

Many endpoints have a parameter where you can provide a lendborrow ID.

Below is a list of lendborrow IDs related to Yearn Finance V2. Please see the Yield Aggregator ID for a complete Yield Aggregator ID list and more information.

Yield Aggregator Name
Chain
Yield Aggregator ID

Yearn Finance V2

Ethereum

5000

Yearn Finance V2

Arbitrum

5001

Yearn Finance V2

Base

5002

Yearn Finance V2

Optimism

5003

Endpoint Details

/getbalance

For /getbalance, the user can either pass the vaultAddress or the tokenAddress and the vaultNumber along with the required parameters.

Get balance of the user in a given Vault.

GET https://api.expand.network/yieldaggregator/getbalance

Query Parameters

Name
Type
Description

rpc

String

Remote procedural call URL.

address*

String

Public Address of the owner.

tokenAddress

String

The address of token.

vaultNumber

String

The number of the vault, incase there are multiple vaults.

yieldAggregatorId*

String

Refer to the Yield Aggregator ID page for details.

vaultAddress

String

The address of the vault.

With tokenAddress:

https://api.expand.network/yieldaggregator/getbalance?address=0xC7565379C190014449eE83CF9FD7475206E59f9e&tokenAddress=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&yieldAggregatorId=5000

With VaultAddress:

https://api.expand.network/yieldaggregator/getbalance?address=0x6Fb447Ae94F5180254D436A693907a1f57696900&yieldAggregatorId=5000&vaultAddress=0xa9fE4601811213c340e850ea305481afF02f5b28

/getvaults

Get the number of the vaults along with the respective vault APY.

GET https://api.expand.network/yieldaggregator/getvaults

Query Parameters

Name
Type
Description

rpc

String

Remote procedural call URL

yieldAggregatorId*

String

Refer to the Yield Aggregator ID page for details.

tokenAddress

String

The address of token.

https://api.expand.network/yieldaggregator/getvaults?tokenAddress=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&yieldAggregatorId=5000

/depositvault

For /depositvault, the user can either pass the tokenAddress or the vaultAddress along with the required parameters.

Trigger the deposit transaction for the given vault.

POST https://api.expand.network/yieldaggregator/depositvault

Request Body

Name
Type
Description

amount*

String

The amount of token to deposit.

tokenAddress

String

The address of the token.

from*

String

Address of the sender of the token.

gas*

String

Maximum gas limit provided by the sender, for the transaction.

vaultNumber

String

The number of the vault, in case there are multiple vaults.

vaultAddress

String

The address of the vault.

yieldAggregatorId*

String

Refer to the Yield Aggregator ID page for details.

gasPriority

String

low, medium, or high.

With tokenAddress:

{
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "tokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
    "amount": "500000",
    "vaultNumber": "1",
    "yieldAggregatorId": "5000",
    "gas": "2307200" 
}

With VaultAddress:

{
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "vaultAddress":"0xa258C4606Ca8206D8aA700cE2143D7db854D168c",
    "amount": "500000",
    "yieldAggregatorId": "5000",
    "gas": "2307200"
}

With gasPriority (medium)-

1. With tokenAddress:

{
    "from": "0xfAE7D9854995E28BEB1B1da864ee2A1E2EC17f07",
    "tokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
    "amount": "10000000000",
    "vaultNumber": "1",
    "yieldAggregatorId": "5000",
    "gas": "2307200",
    "gasPriority":"medium"
}

2. With VaultAddress:

{
    "from": "0xfAE7D9854995E28BEB1B1da864ee2A1E2EC17f07",
    "vaultAddress":"0xa258C4606Ca8206D8aA700cE2143D7db854D168c",
    "amount": "500000",
    "yieldAggregatorId": "5000",
    "gas": "2307200",
    "gasPriority":"medium"
}

/withdrawvault

For /withdrawvault, the user can either pass the tokenAddress or the vaultAddress along with the required parameters.

Trigger the withdraw transaction for the given vault.

POST https://api.expand.network/yieldaggregator/withdrawvault

Request Body

Name
Type
Description

amount*

String

Amount to be withdrawn.

from*

String

Address of the withdrawer of the token.

gas*

String

Maximum gas limit provided by the sender, for the transaction.

tokenAddress

String

Address of the token.

vaultNumber

String

The number of the vault, in case there are multiple vaults.

vaultAddress

String

Address of the vault.

yieldAggregatorId*

String

Refer to the Yield Aggregator ID page for details.

gasPriority

String

low, medium, or high.

With tokenAddress:

{
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "tokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
    "amount": "4881310",
    "gas": "2307200",
    "vaultNumber": "1",
    "yieldAggregatorId": "5000"
}

With vaultAddress:

{
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "vaultAddress": "0xa258C4606Ca8206D8aA700cE2143D7db854D168c",
    "amount": "4881310",
    "gas": "2307200",
    "yieldAggregatorId": "5000" 
}

With gasPriority (high)-

1. With tokenAddress:

{
    "from": "0xfAE7D9854995E28BEB1B1da864ee2A1E2EC17f07",
    "tokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
    "amount": "10000000",
    "gas": "2307200",
    "gasPriority":"high",
    "vaultNumber": "1",
    "yieldAggregatorId": "5000"
}

2. With VaultAddress:

{
    "from": "0xfAE7D9854995E28BEB1B1da864ee2A1E2EC17f07",
    "vaultAddress": "0xa258C4606Ca8206D8aA700cE2143D7db854D168c",
    "amount": "4881310",
    "gas": "2307200",
    "gasPriority":"high",
    "yieldAggregatorId": "5000"
}

Last updated