-
Notifications
You must be signed in to change notification settings - Fork 561
Stateless airdrops #432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stateless airdrops #432
Conversation
Re: this native token amount check: https://github.com/thirdweb-dev/contracts/blob/yash/stateless-airdrops/contracts/airdrop/AirdropERC20.sol#L119C9-L119C82 This check happens outside the for loop, however we should try to revert as early as possible, since the for loop is likely to have many runs (due to many recipients). What about this pattern: uint256 msgValue = msg.value;
uint256 nativeTokenAmount = 0;
bool insufficientValue = false;
for(uint256 i = 0; i < len; ) {
// .. whatever logic
if (_tokenAddress == CurrencyTransferLib.NATIVE_TOKEN) {
nativeTokenAmount += _contents[i].amount;
if(nativeTokenAmount > msgValue) {
insufficientValue = true;
break;
}
}
}
require(!insufficientValue && msgValue == nativeTokenAmount);
|
To clarify, the This is because if the |
Let's not inherit |
No description provided.