{% hint style="warning" %}
Note that this page has not been updated to reflect the current state of Beanstalk, but is left here as a reference.
{% endhint %}
The Token Facet handles the transfers of assets outside the Silo.
function transferToken(
IERC20 token,
address recipient,
uint256 amount,
LibTransfer.From fromMode,
LibTransfer.To toMode
) external payable;
Transfers an asset from a Farmer's Internal and/or External Balance to a Farmer's Internal or External Balance.
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). |
function transferInternalTokenFrom(
IERC20 token,
address sender,
address recipient,
uint256 amount,
LibTransfer.To toMode
) external payable nonReentrant;
WIP
Parameter |
Type |
Description |
token |
IERC20 |
WIP |
sender |
address |
WIP |
recipient |
address |
WIP |
amount |
uint256 |
WIP |
toMode |
To |
WIP |
function approveToken(
address spender,
IERC20 token,
uint256 amount
) external payable nonReentrant;
Wraps Ether into WETH.
Parameter |
Type |
Description |
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). |
function increaseTokenAllowance(
address spender,
IERC20 token,
uint256 addedValue
) public virtual nonReentrant returns (bool);
Wraps Ether into WETH.
Parameter |
Type |
Description |
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). |
function decreaseTokenAllowance(
address spender,
IERC20 token,
uint256 subtractedValue
) public virtual nonReentrant returns (bool);
Wraps Ether into WETH.
Parameter |
Type |
Description |
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). |
function tokenAllowance(
address account,
address spender,
IERC20 token
) public view virtual returns (uint256);
Wraps Ether into WETH.
Parameter |
Type |
Description |
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). |
function permitToken(
address owner,
address spender,
address token,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external payable nonReentrant;
Wraps Ether into WETH.
Parameter |
Type |
Description |
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). |
function tokenPermitNonces(address owner)
public
view
virtual
returns (uint256);
Wraps Ether into WETH.
Parameter |
Type |
Description |
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). |
function tokenPermitDomainSeparator() external view returns (bytes32);
Wraps Ether into WETH.
Parameter |
Type |
Description |
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). |
function onERC1155Received(
address,
address,
uint256,
uint256,
bytes calldata
) external pure override returns (bytes4);
Wraps Ether into WETH.
Parameter |
Type |
Description |
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). |
function onERC1155BatchReceived(
address,
address,
uint256[] calldata,
uint256[] calldata,
bytes calldata
) external pure override returns (bytes4);
Wraps Ether into WETH.
Parameter |
Type |
Description |
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). |
function wrapEth(uint256 amount, LibTransfer.To mode) external payable;
Wraps Ether into WETH.
Parameter |
Type |
Description |
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). |
function unwrapEth(uint256 amount, LibTransfer.From mode) external payable;
Unwraps WETH into Ether.
Parameter |
Type |
Description |
amount |
uint256 |
The amount of WETH to unwrap into Ether. |
fromMode |
From |
Specifies what balance to receive the WETH from (see Internal Balances). |
function getInternalBalance(address account, IERC20 token)
public
view
returns (uint256 balance);
Parameter |
Type |
Description |
account |
address |
WIP |
token |
IERC20 |
WIP |
Return Value |
Type |
Description |
balance |
uint256 |
WIP |
function getInternalBalances(address account, IERC20[] memory tokens)
external
view
returns (uint256[] memory balances);
Parameter |
Type |
Description |
account |
address |
WIP |
tokens |
IERC20[] |
WIP |
Return Value |
Type |
Description |
balances |
uint256[] |
WIP |
function getExternalBalance(address account, IERC20 token)
public
view
returns (uint256 balance);
Parameter |
Type |
Description |
account |
address |
WIP |
token |
IERC20 |
WIP |
Return Value |
Type |
Description |
balance |
uint256 |
WIP |
function getExternalBalances(address account, IERC20[] memory tokens)
external
view
returns (uint256[] memory balances);
Parameter |
Type |
Description |
account |
address |
WIP |
tokens |
IERC20[] |
WIP |
Return Value |
Type |
Description |
balances |
uint256[] |
WIP |
function getBalance(address account, IERC20 token)
public
view
returns (uint256 balance);
Parameter |
Type |
Description |
account |
address |
WIP |
token |
IERC20 |
WIP |
Return Value |
Type |
Description |
balance |
uint256 |
WIP |
function getBalances(address account, IERC20[] memory tokens)
external
view
returns (uint256[] memory balances);
Parameter |
Type |
Description |
account |
address |
WIP |
tokens |
IERC20[] |
WIP |
Return Value |
Type |
Description |
balances |
uint256[] |
WIP |
function getAllBalance(address account, IERC20 token)
public
view
returns (Balance memory b);
Parameter |
Type |
Description |
account |
address |
WIP |
token |
IERC20 |
WIP |
Return Value |
Type |
Description |
b |
Balance |
WIP |
function getAllBalances(address account, IERC20[] memory tokens)
external
view
returns (Balance[] memory balances);
Parameter |
Type |
Description |
account |
address |
WIP |
tokens |
IERC20[] |
WIP |
Return Value |
Type |
Description |
balances |
Balance[] |
WIP |
event InternalBalanceChanged(
address indexed account,
IERC20 indexed token,
int256 delta
);
Parameter |
Type |
Description |
account |
address |
WIP |
token |
IERC20 |
WIP |
delta |
int256 |
WIP |
event TokenApproval(
address indexed owner,
address indexed spender,
IERC20 token,
uint256 amount
);
Parameter |
Type |
Description |
owner |
address |
WIP |
spender |
address |
WIP |
token |
IERC20 |
WIP |
amount |
uint256 |
WIP |