Skip to content

Latest commit

 

History

History
81 lines (60 loc) · 3.04 KB

File metadata and controls

81 lines (60 loc) · 3.04 KB

_transferFrom

import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';

Contract: JBPayoutRedemptionPaymentTerminal​‌

Transfers tokens.

Definition

function _transferFrom(
  address _from,
  address payable _to,
  uint256 _amount
) internal override { ...}
  • Arguments:
    • _from is the address from which the transfer should originate.
    • _to is the address to which the transfer should go.
    • _amount is the amount of the transfer, as a fixed point number with the same number of decimals as this terminal.
  • The resulting function is internal to this contract and its inheriters.
  • The resulting function overrides a function definition from the IJBPayoutRedemptionPaymentTerminal interface.

Body

  1. Send the ERC20. If the specified sender is this contract, use the transfer transaction that doesn't require pre-approval. Otherwise, transfer from the specified address.

     _from == address(this)
      ? IERC20(token).safeTransfer(_to, _amount)
      : IERC20(token).safeTransferFrom(_from, _to, _amount);
    

    External references:

/**
  @notice
  Transfers tokens.

  @param _from The address from which the transfer should originate.
  @param _to The address to which the transfer should go.
  @param _amount The amount of the transfer, as a fixed point number with the same number of decimals as this terminal.
*/
function _transferFrom(
  address _from,
  address payable _to,
  uint256 _amount
) internal override {
  _from == address(this)
    ? IERC20(token).safeTransfer(_to, _amount)
    : IERC20(token).safeTransferFrom(_from, _to, _amount);
}
Category Description Reward
Optimization Help make this operation more efficient. 0.5ETH
Low severity Identify a vulnerability in this operation that could lead to an inconvenience for a user of the protocol or for a protocol developer. 1ETH
High severity Identify a vulnerability in this operation that could lead to data corruption or loss of funds. 5+ETH