The Token Facet handles the transfers of assets outside the Silo.
Transfers an asset from a Farmer's Internal and/or External Balance to a Farmer's Internal or External Balance.
WIP
Wraps Ether into WETH.
Wraps Ether into WETH.
Wraps Ether into WETH.
Wraps Ether into WETH.
Wraps Ether into WETH.
Wraps Ether into WETH.
Wraps Ether into WETH.
Wraps Ether into WETH.
Wraps Ether into WETH.
Wraps Ether into WETH.
Unwraps WETH into Ether.
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Return Value | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Return Value | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Return Value | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Return Value | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Return Value | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Return Value | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Return Value | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Return Value | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
token
IERC20
The token to be transferred.
recipient
address
The recipient of the transferred tokens (can be msg.sender
).
amount
uint256
The amount of tokens to be transferred.
fromMode
From
Specifies what balance to receive the tokens from (see Internal Balances).
toMode
To
Specifies what balance to send the tokens to (see Internal Balances).
token
IERC20
WIP
sender
address
WIP
recipient
address
WIP
amount
uint256
WIP
toMode
To
WIP
amount
uint256
The amount of Ether to wrap into WETH. Must be <= msg.value
.
toMode
To
Specifies what balance to send the WETH to (see Internal Balances).
amount
uint256
The amount of Ether to wrap into WETH. Must be <= msg.value
.
toMode
To
Specifies what balance to send the WETH to (see Internal Balances).
amount
uint256
The amount of Ether to wrap into WETH. Must be <= msg.value
.
toMode
To
Specifies what balance to send the WETH to (see Internal Balances).
amount
uint256
The amount of Ether to wrap into WETH. Must be <= msg.value
.
toMode
To
Specifies what balance to send the WETH to (see Internal Balances).
amount
uint256
The amount of Ether to wrap into WETH. Must be <= msg.value
.
toMode
To
Specifies what balance to send the WETH to (see Internal Balances).
amount
uint256
The amount of Ether to wrap into WETH. Must be <= msg.value
.
toMode
To
Specifies what balance to send the WETH to (see Internal Balances).
amount
uint256
The amount of Ether to wrap into WETH. Must be <= msg.value
.
toMode
To
Specifies what balance to send the WETH to (see Internal Balances).
amount
uint256
The amount of Ether to wrap into WETH. Must be <= msg.value
.
toMode
To
Specifies what balance to send the WETH to (see Internal Balances).
amount
uint256
The amount of Ether to wrap into WETH. Must be <= msg.value
.
toMode
To
Specifies what balance to send the WETH to (see Internal Balances).
amount
uint256
The amount of Ether to wrap into WETH. Must be <= msg.value
.
toMode
To
Specifies what balance to send the WETH to (see Internal Balances).
amount
uint256
The amount of WETH to unwrap into Ether.
fromMode
From
Specifies what balance to receive the WETH from (see Internal Balances).
account
address
WIP
token
IERC20
WIP
balance
uint256
WIP
account
address
WIP
tokens
IERC20[]
WIP
balances
uint256[]
WIP
account
address
WIP
token
IERC20
WIP
balance
uint256
WIP
account
address
WIP
tokens
IERC20[]
WIP
balances
uint256[]
WIP
account
address
WIP
token
IERC20
WIP
balance
uint256
WIP
account
address
WIP
tokens
IERC20[]
WIP
balances
uint256[]
WIP
account
address
WIP
token
IERC20
WIP
b
Balance
WIP
account
address
WIP
tokens
IERC20[]
WIP
balances
Balance[]
WIP
account
address
WIP
token
IERC20
WIP
delta
int256
WIP
owner
address
WIP
spender
address
WIP
token
IERC20
WIP
amount
uint256
WIP
The Farm allows Farmers to call multiple functions in a single transaction and use assets between different functions in a composable manner, without those assets every leaving Beanstalk (thanks to Internal Balances). Internal Balances allow the farm
function to use the output of a function in the next function call.
The Farm also provides composable Beanstalk-native interfaces for other DeFi protocols. This allows Farmers to call supported external protocols through the farm
function and leverage Internal Balances. The current protocols that the Farm supports are:
WETH -> wrapping and unwrapping; and
Curve -> swapping and adding/removing liquidity.
Pipeline -> performing an arbitrary series of actions in the EVM in a single transaction.
The Farm creates an interface to transfer ERC-20 tokens between Internal and External Balances, as well as between Farmers through the transferToken
function.
The Farm consists of 5 facets:
The Depot Facet wraps Pipeline's pipe
functions to facilitate the loading of non-Ether assets in Pipeline.
Pipe a PipeCall
through Pipeline.
Pipe multiple PipeCalls
through Pipeline. Does not support sending Ether in the call.
Pipe multiple AdvancedPipeCalls
through Pipeline.
Pipe a PipeCall
through Pipeline with an Ether value.
Return the return value of a PipeCall
without executing it.
None.
The Curve Facet handles swapping in, adding liquidity to, and removing liquidity from Curve pools without assets leaving Beanstalk.
Swaps a token for another token in a Curve base, meta, plain or crypto pool. Slippage is tolerated on the amount out. It also verifies that the pool exists in the Curve Factory. This function does not support underlying tokens.
The stable pair Curve Factory can be found at: 0xB9fC157394Af804a3578134A6585C0dc9cc990d4
The non-stable Curve factory can be found at: 0x0959158b6040D32d04c301A72CBFD6b39E21c9AE
Swaps an underlying token for another underlying token in a Curve metapool. In a Curve metapool, one of the tokens is an LP token of another pool. Underlying tokens include the non-LP token in the pool as well as the tokens in the pool that the LP token belongs to. For example, in the BEAN:3CRV metapool, the underlying tokens are Bean, USDC, Tether and Dai.
Slippage is tolerated on the amount out. This function verifies that the pool exists in the Curve Factory.
Adds tokens into a liquidity pool on Curve in exchange for LP tokens.
Removes liquidity from a pool on Curve in exchange for equal amounts of all tokens in the liquidity pool. The Farmer burns their LP tokens in the process.
Removes liquidity from a pool on Curve in exchange for an unequal amounts of tokens in the liquidity pool. The Farmer burns LP tokens in the process.
Removes liquidity from a pool on Curve in exchange for an amount of one token in the liquidity pool. The Farmer burns LP tokens in the process.
None.
None.
The Token Support Facet handles permits for ERC-20 and ERC-721 tokens and transfers for ERC-721 and ERC-1155 tokens.
Execute an ERC-721 token transfer.
Execute a permit for an ERC-721 token.
Execute an ERC-1155 token transfer of a single ID.
Execute an ERC-1155 token transfer of multiple IDs.
None.
None.
Parameter | Type | Description |
---|---|---|
Return Value | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Return Value | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Return Value | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Return Value | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Return Value | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
permitERC20
is a wrapper function for permit of token.
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|
Return Value | Type | Description |
---|
Parameter | Type | Description |
---|
Return Value | Type | Description |
---|
p
PipeCall
PipeCall
to pipe through Pipeline.
result
bytes
PipeCall
return value.
pipes
PipeCall[]
List of PipeCalls
to pipe through Pipeline.
results
bytes[]
List of return values from each PipeCall
.
pipes
AdvancedPipeCall[]
List of AdvancedPipeCalls
to pipe through Pipeline.
value
uint256
results
bytes[]
List of return values from each AdvancedPipeCall
.
p
PipeCall
PipeCall
to pipe through Pipeline.
value
uint256
Ether value to send in Pipecall
.
result
bytes
PipeCall
return value.
p
PipeCall
PipeCall
to execute with a staticcall.
result
bytes
PipeCall
return value.
pool
address
The address of the pool to exchange in. The pool must be registered in one of the Curve Factories.
registry
address
The Curve Registry to query pool
data from.
fromToken
address
The token to swap from.
toToken
address
The token to swap to.
amountIn
uint256
The amount to swap from.
minAmountOut
uint256
The minimum amount to receive from the swap.
fromMode
From
Specifies what balance to receive the tokens from (see Internal Balances).
toMode
To
Specifies what balance to send the tokens to (see Internal Balances).
pool
address
The address of the pool to exchange in. The pool must be registered in one of the Curve Factories.
fromToken
address
The underlying token to swap from.
toToken
address
The underlying token to swap to.
amountIn
uint256
The amount to swap from.
minAmountOut
uint256
The minimum amount to receive from the swap.
fromMode
From
Specifies what balance to receive the tokens from (see Internal Balances).
toMode
To
Specifies what balance to send the tokens to (see Internal Balances).
pool
address
The address of the pool to exchange in. The pool must be registered in one of the Curve Factories.
registry
address
The Curve Registry to query pool
data from.
amounts
uint256[]
The amount of each token to add.
minAmountOut
uint256
The minimum amount to receive from the swap.
fromMode
From
Specifies what balance to receive the tokens from (see Internal Balances).
toMode
To
Specifies what balance to send the tokens to (see Internal Balances).
pool
address
The address of the pool to exchange in. The pool must be registered in one of the Curve Factories.
registry
address
The Curve Registry to query pool
data from.
amountIn
uint256
The amount of LP to remove.
minAmountsOut
uint256[]
The minimum amount to receive in each of the tokens.
fromMode
From
Specifies what balance to receive the tokens from (see Internal Balances).
toMode
To
Specifies what balance to sent the tokens to (see Internal Balances).
pool
address
The address of the pool to exchange in. The pool must be registered in one of the Curve Factories.
registry
address
The Curve Registry to query pool
data from.
amountsOut
uint256[]
The amount of each token to receive.
maxAmountIn
uint256
The max amount of LP tokens to burn.
fromMode
From
Specifies what balance to receive the tokens from (see Internal Balances).
toMode
To
Specifies what balance to send the tokens to (see Internal Balances).
pool
address
The address of the pool to exchange in. The pool must be registered in one of the Curve Factories.
registry
address
The Curve Registry to query pool
data from.
toToken
address
The token to receive in exchange for burning LP tokens.
amountIn
uint256
The amount of LP tokens to burn.
minAmountOut
uint256
The minimum amount of the token to receive.
fromMode
From
Specifies what balance to receive the tokens from (see Internal Balances).
toMode
To
Specifies what balance to send the tokens to (see Internal Balances).
|
| Token to permit. |
|
| Owner of the token. |
|
| Address to permit to spend the token. |
|
| Token amount to permit. |
|
| Expiration of signature (Unix time) |
|
| Recovery ID. |
|
| ECDSA signature output. |
|
| ECDSA signature output. |
|
| Token address of the ERC-721. |
|
| Address being transferred to. |
|
| ID of ERC-721 token to transfer. |
|
| Token address of the ERC-1155. |
|
| Address being transferred to. |
|
| ID of the ERC-1155 token. |
|
| Number of the ERC-1155 tokens at |
|
| Token address of the ERC-1155. |
|
| Address being transferred to. |
|
| Array of IDs of the ERC-155 token. |
|
| Array of amounts of ERC-1155s at |
|
| The encoded function data for each of the calls. |
|
| The return data from each of the calls. |
|
| The encoded function data for each of the calls to make to this contract. |
|
| The results from each of the calls passed in via |
|
| Token address to permit. |
|
| Address to permit to spend the token. |
|
| ID of |
|
| Expiration of signature (Unix time). |
|
|
A valid secp256k1
or signature from owner of the tokenId
.