IErc20Portal
Inherits: IPortal
Title: ERC-20 Portal interface
Functions
depositErc20Tokens
Transfer ERC-20 tokens to an application contract
and add an input to the application's input box to signal such operation.
The caller must allow the portal to withdraw at least value tokens
from their account beforehand, by calling the approve function in the
token contract.
Only ERC-20 compliant tokens are supported. The portal rejects deposits
of fee-on-transfer ERC-20 tokens: It computes the difference between
balances before and after the transfer. If the difference is not equal
to the transfer amount, it reverts with an appropriate custom error.
The portal also ensures the return value of transferFrom is true,
as specified in the ERC-20 standard. Empty or ill-formed return values
are not accepted and a low-level generic error is raised in those cases.
May raise Erc20TransferFailed, Erc20TransferDecreasedApplicationBalance, or Erc20TransferValueIsNotBalanceDelta.
function depositErc20Tokens(
IERC20 token,
address appContract,
uint256 value,
bytes calldata execLayerData
) external;
Parameters
| Name | Type | Description |
|---|---|---|
token | IERC20 | The ERC-20 token contract |
appContract | address | The application contract address |
value | uint256 | The amount of tokens to be transferred |
execLayerData | bytes | Additional data to be interpreted by the execution layer |
Errors
Erc20TransferFailed
Failed to transfer ERC-20 tokens to application
error Erc20TransferFailed();
Erc20TransferDecreasedApplicationBalance
ERC-20 transfer decreased application balance
error Erc20TransferDecreasedApplicationBalance(
uint256 balanceBefore, uint256 balanceAfter
);
Parameters
| Name | Type | Description |
|---|---|---|
balanceBefore | uint256 | The application balance before the transfer |
balanceAfter | uint256 | The application balance after the transfer |
Erc20TransferValueIsNotBalanceDelta
ERC-20 transfer value is different from application balance delta
error Erc20TransferValueIsNotBalanceDelta(uint256 value, uint256 balanceDelta);
Parameters
| Name | Type | Description |
|---|---|---|
value | uint256 | The transfer value |
balanceDelta | uint256 | The application balance delta (after - before) |