0

I am working on a solidity contract and on each ethereum received in contract, I want to distribute ERC20 token propotional to ether spent in that transaction to 7500 addresses at once.

To do there could be these 2 ways as given below:

  1. To transfer them token at the same time.
  2. To save that amount so they can claim later. (push/withdraw method)

But in both the ways I will run out of gas.

Any help will be appreciated. Thanks.

2
  • Could you add more context to the question? When do you wanna transfer the ERC20 tokens? When, you receive ether from them in your smart contract? Commented Dec 17, 2021 at 9:16
  • suppose their is a function which accepts ether and distribute ERC20 token Commented Dec 17, 2021 at 9:25

1 Answer 1

0

you might be able to play with the balanceOf for specific addresses. Essentially the set of addresses you specify would have a starting balance of 0 + x. I think setting the addresses in a single mapping would be considerably cheaper. You might get tot higher amount of "distributions" through this method.

1
  • do you mean using mapping(address => uint256) beneficiary; in a loop ,to update there reward token to be claimed! Commented Dec 17, 2021 at 10:11

Not the answer you're looking for? Browse other questions tagged or ask your own question.