Beanstalk
  • Agronomics Handbook
  • Farmers' Almanac
  • Whitepaper
  • Contract Addresses
  • 🌱Overview
    • Introduction
    • Development Ethos
    • EIP-2535 Diamond
    • App Storage
    • Internal Balances
  • 🌾Protocol
    • Overview
    • Louper
    • Sun
      • Season Facet
    • Silo
      • Silo Facet
      • BDV Facet
      • Whitelist Facet
      • Convert Facet
      • Convert Getters Facet
      • Enroot Facet
      • Approval Facet
      • Metadata Facet
      • Migration Facet
      • Legacy Claim Withdrawal Facet
    • Field
      • Field Facet
      • Fundraiser Facet
    • Barn
      • Fertilizer Facet
      • Unripe Facet
    • Market
      • Marketplace Facet
    • Farm
      • Farm Facet
      • Depot Facet
      • Token Facet
      • Token Support Facet
      • Curve Facet
    • Diamond
      • Diamond Cut Facet
      • Diamond Loupe Facet
      • Ownership Facet
      • Pause Facet
  • 📜Misc.
    • Technical Recordings
    • Upgrade History
    • FAQ
    • Terminology Discrepancies
Powered by GitBook
On this page
  • Call Functions
  • Permit ERC-20
  • Transfer ERC-721
  • Permit ERC-721
  • Transfer ERC-1155
  • Batch Transfer ERC-1155
  • View Functions
  • Events
Edit on GitHub
Export as PDF
  1. Protocol
  2. Farm

Token Support Facet

PreviousToken FacetNextCurve Facet

Last updated 6 months ago

Note that this page has not been updated to reflect the current state of Beanstalk, but is left here as a reference.

The Token Support Facet handles permits for ERC-20 and ERC-721 tokens and transfers for ERC-721 and ERC-1155 tokens.

Call Functions

function permitERC20(
    IERC20Permit token,
    address owner,
    address spender,
    uint256 value,
    uint256 deadline,
    uint8 v,
    bytes32 r,
    bytes32 s
) public payable;

permitERC20 is a wrapper function for permit of token.

Parameter
Type
Description

token

IERC20Permit

Token to permit.

owner

address

Owner of the token.

spender

address

Address to permit to spend the token.

value

uint256

Token amount to permit.

deadline

uint256

Expiration of signature (Unix time)

v

uint8

Recovery ID.

r

bytes32

ECDSA signature output.

s

bytes32

ECDSA signature output.

function transferERC721(
    IERC721 token,
    address to,
    uint256 id
) external payable;

Execute an ERC-721 token transfer.

Parameter
Type
Description

token

IERC721

Token address of the ERC-721.

to

address

Address being transferred to.

id

uint256

ID of ERC-721 token to transfer.

function permitERC721(
    IERC4494 token,
    address spender,
    uint256 tokenId,
    uint256 deadline,
    bytes memory sig
) external payable;

Execute a permit for an ERC-721 token.

Parameter
Type
Description

token

IERC4494

Token address to permit.

spender

address

Address to permit to spend the token.

tokenId

uint256

ID of token to permit.

deadline

uint256

Expiration of signature (Unix time).

sig

bytes

function transferERC1155(
    IERC1155 token,
    address to,
    uint256 id,
    uint256 value
) external payable;

Execute an ERC-1155 token transfer of a single ID.

Parameter
Type
Description

token

IERC1155

Token address of the ERC-1155.

to

address

Address being transferred to.

id

uint256

ID of the ERC-1155 token.

value

uint256

Number of the ERC-1155 tokens at id to transfer.

function batchTransferERC1155(
    IERC1155 token,
    address to,
    uint256[] calldata ids,
    uint256[] calldata values
) external payable;

Execute an ERC-1155 token transfer of multiple IDs.

Parameter
Type
Description

token

IERC1155

Token address of the ERC-1155.

to

address

Address being transferred to.

ids

uint256[]

Array of IDs of the ERC-155 token.

values

uint256[]

Array of amounts of ERC-1155s at id to transfer.

View Functions

None.

Events

None.

A valid secp256k1 or signature from owner of the tokenId.

🌾
Permit ERC-20
ERC20Permit
Transfer ERC-721
Permit ERC-721
Transfer ERC-1155
Batch Transfer ERC-1155
EIP-2098