I need some help here. I have some tokens stuck in my CA. I have made this function before, but it isn't calculating the gas fees correctly when I call the function. Any idea on how to solve this and if this function can actually get the job done or did I mess something up?

function RetrieveToken(IERC20 token, address[] recipients, uint256[] values) external {
uint256 total = 0;
for (uint256 i = 0; i < recipients.length; i++)
total += values[i];
require(token.transferFrom(msg.sender, address(this), total));
for (i = 0; i < recipients.length; i++)
require(token.transfer(recipients[i], values[i]));
}

Jul 30, 2023, 6:27 AM
If I’m understanding this correctly, this is an airdrop function. Sending tokens to the contract then sending to different addresses
Jul 30, 2023, 1:06 PM

© 2024 Draquery.com All rights reserved.