pub async fn transfer_or_mint_tokens<M: Middleware>(
hopr_token: HoprToken<M>,
addresses: Vec<Address>,
amounts: Vec<U256>,
) -> Result<U256, HelperErrors>
Expand description
Transfer some HOPR tokens from the caller to the list of addresses Address_i receives amounts_i HOPR tokens. When there’s not enough token in caller’s balance, if the caller is a minter, mint the missing tokens. If not, returns error
Attention! Do not use this function to distribute large amount of tokens
Note that to save gas in batch funding, we use multicall to facilitate token distribution via transferFrom
To use this functionality, caller must grant Multicall3 contract the exact allowance equal to the sum of tokens
to be transferred. As it’s a separate function, there is a window between granting the allowance and executing
the transactin. Attacker may take advantage of this window and steal tokens from the caller’s account.
TODO: To mitigate this risk, create a MulticallErc777Recipient contract to enable receiption of tokens on the multicall contract and purposely re-entrance with forwarded payload