ERC1363
Inherits: IERC1363
Title: ERC1363
Author: Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/extensions/ERC1363.sol)
Stateless Diamond facet adding ERC-1363 transferAndCall, transferFromAndCall and approveAndCall to
ERC-20. Pure delegator to ERC1363Lib.
Additive: cut it next to the base ERC20 facet. It replaces no selector and shares none.
Mutually exclusive with the ERC-20 movement overrides (decision D25 on #234): ERC20Pausable, ERC20Votes and
GovernedVault Replace transfer/transferFrom, and the *AndCall paths move tokens through ERC20Lib
without them, so a pause would not stop them and votes would not follow them. No selector clash catches
this at cut time; CompositionHazardsTest pins it. ERC1363Lib lists every difference from OpenZeppelin.
Notes:
- lattice-version: 0.5.0
- lattice-source: OpenZeppelin v5.6.1
Functions
transferAndCall
Moves value tokens from the caller to to, then calls IERC1363Receiver.onTransferReceived on to.
function transferAndCall(address to, uint256 value) public virtual returns (bool);Parameters
| Name | Type | Description |
|---|---|---|
| to | address | |
| value | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bool | True unless it reverts. |
transferAndCall
Variant of transferAndCall that forwards data to the receiver.
function transferAndCall(address to, uint256 value, bytes memory data) public virtual returns (bool);Parameters
| Name | Type | Description |
|---|---|---|
| to | address | |
| value | uint256 | |
| data | bytes |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bool |
transferFromAndCall
Moves value tokens from from to to using the caller's allowance, then calls
IERC1363Receiver.onTransferReceived on to.
function transferFromAndCall(address from, address to, uint256 value) public virtual returns (bool);Parameters
| Name | Type | Description |
|---|---|---|
| from | address | |
| to | address | |
| value | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bool | True unless it reverts. |
transferFromAndCall
Variant of transferFromAndCall that forwards data to the receiver.
function transferFromAndCall(address from, address to, uint256 value, bytes memory data)
public
virtual
returns (bool);Parameters
| Name | Type | Description |
|---|---|---|
| from | address | |
| to | address | |
| value | uint256 | |
| data | bytes |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bool |
approveAndCall
Sets value as spender's allowance over the caller's tokens, then calls
IERC1363Spender.onApprovalReceived on spender.
function approveAndCall(address spender, uint256 value) public virtual returns (bool);Parameters
| Name | Type | Description |
|---|---|---|
| spender | address | |
| value | uint256 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bool | True unless it reverts. |
approveAndCall
Variant of approveAndCall that forwards data to the spender.
function approveAndCall(address spender, uint256 value, bytes memory data) public virtual returns (bool);Parameters
| Name | Type | Description |
|---|---|---|
| spender | address | |
| value | uint256 | |
| data | bytes |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bool |
exportSelectors
ERC-8153 selector export: this facet's cuttable selectors, tightly packed (4 bytes each).
Excludes exportSelectors() itself (0x0ef22643) - it is never cut into a diamond. Order matches
forge inspect ERC1363 methodIdentifiers (alphabetical by signature); kept in exact parity by
ExportSelectorsParityTest. Chunks:
approveAndCall(address,uint256) 0x3177029f
approveAndCall(address,uint256,bytes) 0xcae9ca51
transferAndCall(address,uint256) 0x1296ee62
transferAndCall(address,uint256,bytes) 0x4000aea0
transferFromAndCall(address,address,uint256) 0xd8fbe994
transferFromAndCall(address,address,uint256,bytes) 0xc1d34b89
function exportSelectors() external pure virtual returns (bytes memory selectors);Returns
| Name | Type | Description |
|---|---|---|
| selectors | bytes |