0

I've been attempting some form of solidity code to automate the airdropping of Token B to the holders of Token A almost all day, but I still couldn't find much that works. How could I do this?

  • What is it you really want ? Stack exchange is not here to code for you, but instead we are here to provide a solution to a specific problem. So what have you tried, what is the problem with what you tried ? – Florian Castelain Apr 2 at 11:06
0

Two obvious approaches spring to mind.

PUSH

An off-chain process would listen to Token A's event log to compile a list of holders and then proactively send Token B. Since Token A is constantly in motion, either a cut-off time or a continuous process and the requirement should be clarified. A notable disadvantage of this approach is the centralized gas payer bearing all the costs of transactions and infrastructure as well as the responsibility.

PULL

This has the same requirement to resolve the question of the cut-off time. I do not see an obvious way to do this on a continuous basis, but it might be possible. It's about ensuring the accounting works.

Users who are entitled to get some Token B send a transaction to a claims window contract which computes their entitlement from their Token A balance (at a point in time) and sends them their allotted Token B. This would be an on-chain solution with no transaction cost or infrastructure cost for the operator.

It should be much easier to define what the contract is supposed to do in this scenario. And, it should be trivial to ensure that transactions can complete at a known fixed gas cost that would be paid by the beneficiary who is incentivized to pay it.

A slight-of-hand method could be considered

ERC20 is about the interface and the result - not about the method.

Nothing is stopping one from computing supply and account balances using information that is available in another contract.

Consider:

Your Token B balance is your Token A balance (at a cut-off time) plus or minus everything that happened here, after that.

If you wrote your ERC20 contract that way, then the airdrop would be complete at initialization.

Hope it helps.

| improve this answer | |
  • 1
    Unfortunately it seems like what I need won't work with either of these options. Thank you for the prompt response, but I'll have to mark this closed. Have a great day! – N T Apr 1 at 18:31
  • Thanks for accepting my answer. Consider elaborating on what you need in another question. We don't have enough information to suggest a departure from a typical approach. – Rob Hitchens Apr 1 at 22:14

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