mlabs-haskell/CardStarter-bulk-airdrop-script

Do a token sum check

Opened this issue · 2 comments

Essentially prepare a tx with all inputs, and an additional output to cover the expected fees, ensure its balanced

@samuelWilliams99 Could you elaborate on this issue? I'm having trouble deciphering exactly what is required here.

Is the goal to create a transaction which consumes enough tokens to satisfy the required amount for the airdrop, and then create 1 UTxO containing all the tokens? And the purpose is to check if there is enough available in the wallet? Would it not be possible that the 'sum' UTxO may get consumed by some other transaction while the airdrop is running, making the check less useful?

Essentially we want to ensure that - before we try running any of the drop transactions - that we have the funds to cover it all.
Theres a few ways to do this, you could manually sum up everything over the beneficiaries, then check the inputs and do all that jazz. Or, the easier way, is to create some dummy transaction which has all the outputs (this will be a massive transaction, and would never fit on chain, but thats fine as we don't plan to actually submit it), then we try balannce that transaction. If the balancing fails, we know we don't have enough funds to cover it.
You can handle this however you want, we just need to ensure that the inputs we have covers all the outputs, which includes the tokens to be dropped, the minLovelaces amount in the params per person (each output must have this amount of Ada), and finally, about 2Ada per transaction that would be needed to cover all the recipients