Token Facet

The Token Facet handles the transfers of assets outside the Silo.

Call Functions

Transfers

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.

function transferInternalTokenFrom(
    IERC20 token,
    address sender,
    address recipient,
    uint256 amount,
    LibTransfer.To toMode
) external payable nonReentrant;

WIP

Approvals

function approveToken(
    address spender,
    IERC20 token,
    uint256 amount
) external payable nonReentrant;

Wraps Ether into WETH.

function increaseTokenAllowance(
    address spender,
    IERC20 token,
    uint256 addedValue
) public virtual nonReentrant returns (bool);

Wraps Ether into WETH.

function decreaseTokenAllowance(
    address spender,
    IERC20 token,
    uint256 subtractedValue
) public virtual nonReentrant returns (bool);

Wraps Ether into WETH.

function tokenAllowance(
    address account,
    address spender,
    IERC20 token
) public view virtual returns (uint256);

Wraps Ether into WETH.

Permits

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.

function tokenPermitNonces(address owner)
    public
    view
    virtual
    returns (uint256);

Wraps Ether into WETH.

function tokenPermitDomainSeparator() external view returns (bytes32);

Wraps Ether into WETH.

ERC-1155

function onERC1155Received(
    address,
    address,
    uint256,
    uint256,
    bytes calldata
) external pure override returns (bytes4);

Wraps Ether into WETH.

function onERC1155BatchReceived(
    address,
    address,
    uint256[] calldata,
    uint256[] calldata,
    bytes calldata
) external pure override returns (bytes4);

Wraps Ether into WETH.

WETH

function wrapEth(uint256 amount, LibTransfer.To mode) external payable;

Wraps Ether into WETH.

function unwrapEth(uint256 amount, LibTransfer.From mode) external payable;

Unwraps WETH into Ether.

View Functions

function getInternalBalance(address account, IERC20 token)
    public
    view
    returns (uint256 balance);

function getInternalBalances(address account, IERC20[] memory tokens)
    external
    view
    returns (uint256[] memory balances);

function getExternalBalance(address account, IERC20 token)
    public
    view
    returns (uint256 balance);

function getExternalBalances(address account, IERC20[] memory tokens)
    external
    view
    returns (uint256[] memory balances);

function getBalance(address account, IERC20 token)
    public
    view
    returns (uint256 balance);

function getBalances(address account, IERC20[] memory tokens)
    external
    view
    returns (uint256[] memory balances);

function getAllBalance(address account, IERC20 token)
    public
    view
    returns (Balance memory b);

function getAllBalances(address account, IERC20[] memory tokens)
    external
    view
    returns (Balance[] memory balances);

Events

event InternalBalanceChanged(
    address indexed account,
    IERC20 indexed token,
    int256 delta
);

event TokenApproval(
    address indexed owner,
    address indexed spender,
    IERC20 token,
    uint256 amount
);

Last updated