ODCdataManagersomnichainERC20extensions

OmnichainERC20Transfers

Abstract contract that provides the transfer operations of the Omnichain ERC20 Data Manager

transfer

function transfer(OmnichainAddress to, uint256 amount) public payable virtual returns (bool)

Transfers amount tokens from the caller's account to to

If the chain ID of to is the same as the current chain ID, the transfer is done on the single chain otherwise, the transfer is done via Omnichain Caller may receive native coin refund, so if it's a contract it MUST have receive() or payable fallback()

Parameters

NameTypeDescription
toOmnichainAddressOmnichain address to transfer tokens to
amountuint256Amount of tokens to transfer

Return Values

NameTypeDescription
[0]boolTrue if the transfer was successful, reverts otherwise

transfer

function transfer(OmnichainAddress to, uint256 amount, address payable refundAddress) public payable virtual returns (bool)

Transfers amount tokens from the caller's account to to

If the chain ID of to is the same as the current chain ID, the transfer is done on the single chain otherwise, the transfer is done via Omnichain

Parameters

NameTypeDescription
toOmnichainAddressOmnichain address to transfer tokens to
amountuint256Amount of tokens to transfer
refundAddressaddress payableAddress to send native coin refund to

Return Values

NameTypeDescription
[0]boolTrue if the transfer was successful, reverts otherwise

transfer

function transfer(address to, uint256 amount) public virtual returns (bool)

Transfers amount tokens from the caller's account to to

The transfer is done on the local chain

Parameters

NameTypeDescription
toaddressAddress to transfer tokens to
amountuint256Amount of tokens to transfer

Return Values

NameTypeDescription
[0]boolTrue if the transfer was successful, reverts otherwise

transferFrom

function transferFrom(address from, address to, uint256 amount) public virtual returns (bool)

Transfers amount tokens from from to to

The caller must have allowance for from's tokens of at least amount The transfer is done on the local chain

Parameters

NameTypeDescription
fromaddressAddress to transfer tokens from
toaddressAddress to transfer tokens to
amountuint256Amount of tokens to transfer

Return Values

NameTypeDescription
[0]boolTrue if the transfer was successful, reverts otherwise

transferFrom

function transferFrom(address from, OmnichainAddress to, uint256 amount) public payable virtual returns (bool)

Transfers amount tokens from from to to

The caller must have allowance for from's tokens of at least amount If the chain ID of to is the same as the current chain ID, the transfer is done on the single chain otherwise, the transfer is done via Omnichain Caller may receive native coin refund, so if it's a contract it MUST have receive() or payable fallback()

Parameters

NameTypeDescription
fromaddressAddress to transfer tokens from
toOmnichainAddressAddress to transfer tokens to
amountuint256Amount of tokens to transfer

Return Values

NameTypeDescription
[0]boolTrue if the transfer was successful, reverts otherwise

transferFrom

function transferFrom(address from, OmnichainAddress to, uint256 amount, address payable refundAddress) public payable virtual returns (bool)

Transfers amount tokens from from to to

The caller must have allowance for from's tokens of at least amount If the chain ID of to is the same as the current chain ID, the transfer is done on the single chain otherwise, the transfer is done via Omnichain

Parameters

NameTypeDescription
fromaddressAddress to transfer tokens from
toOmnichainAddressAddress to transfer tokens to
amountuint256Amount of tokens to transfer
refundAddressaddress payableAddress to send native coin refund to

Return Values

NameTypeDescription
[0]boolTrue if the transfer was successful, reverts otherwise

_transferFromSingleChainSkipAllowance

function _transferFromSingleChainSkipAllowance(address from, address to, uint256 amount) internal returns (bool)

_writeSingleChainTransfer

function _writeSingleChainTransfer(address from, address to, uint256 amount) internal virtual

_writeOmnichainTransfer

function _writeOmnichainTransfer(address from, OmnichainAddress to, uint256 amount, address payable refundAddress) internal virtual

_beforeSingleChainTransfer

function _beforeSingleChainTransfer(address from, address to, uint256 amount) internal virtual

_beforeOmnichainTokenTransfer

function _beforeOmnichainTokenTransfer(address from, OmnichainAddress to, uint256 amount) internal virtual