Skip to content

Latest commit

 

History

History
325 lines (290 loc) · 11 KB

GenericTokenSender.md

File metadata and controls

325 lines (290 loc) · 11 KB

Token sender contract.

  • (GenericTokenSender.sol)

View Source: contracts/governance/Vesting/GenericTokenSender.sol

↗ Extends: AdminRole

GenericTokenSender contract

This contract includes functions to transfer tokens to a recipient or to several recipients in a list. There is an ACL control check by modifier.

Events

event TokensTransferred(address indexed token, address indexed receiver, uint256  amount);

Functions


transferTokensUsingList

Transfer given amounts of tokens to the given addresses.

function transferTokensUsingList(address _token, address[] _receivers, uint256[] _amounts) external nonpayable onlyAuthorized 

Arguments

Name Type Description
_token address The address of the token.
_receivers address[] The addresses of the receivers.
_amounts uint256[] The amounts to be transferred.
Source Code
function transferTokensUsingList(
        address _token,
        address[] calldata _receivers,
        uint256[] calldata _amounts
    ) external onlyAuthorized {
        require(_receivers.length == _amounts.length, "arrays mismatch");

        for (uint256 i = 0; i < _receivers.length; i++) {
            _transferTokens(_token, _receivers[i], _amounts[i]);
        }
    }

transferTokens

Transfer tokens to given address.

function transferTokens(address _token, address _receiver, uint256 _amount) external nonpayable onlyAuthorized 

Arguments

Name Type Description
_token address The address of the token.
_receiver address The address of the token receiver.
_amount uint256 The amount to be transferred.
Source Code
function transferTokens(
        address _token,
        address _receiver,
        uint256 _amount
    ) external onlyAuthorized {
        _transferTokens(_token, _receiver, _amount);
    }

_transferTokens

function _transferTokens(address _token, address _receiver, uint256 _amount) internal nonpayable

Arguments

Name Type Description
_token address
_receiver address
_amount uint256
Source Code
function _transferTokens(
        address _token,
        address _receiver,
        uint256 _amount
    ) internal {
        require(_token != address(0), "token address invalid");
        require(_receiver != address(0), "receiver address invalid");
        require(_amount != 0, "amount invalid");

        require(IERC20(_token).transfer(_receiver, _amount), "transfer failed");
        emit TokensTransferred(_token, _receiver, _amount);
    }

Contracts