Skip to content

Commit

Permalink
no sig airdrop for eth
Browse files Browse the repository at this point in the history
  • Loading branch information
kumaryash90 committed Mar 21, 2024
1 parent 65dd7cf commit 14553e2
Showing 1 changed file with 2 additions and 43 deletions.
45 changes: 2 additions & 43 deletions contracts/prebuilts/unaudited/airdrop/Airdrop.sol
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,10 @@ contract Airdrop is EIP712, Initializable, Ownable {
revert AirdropVerificationFailed();

Check warning on line 208 in contracts/prebuilts/unaudited/airdrop/Airdrop.sol

View check run for this annotation

Codecov / codecov/patch

contracts/prebuilts/unaudited/airdrop/Airdrop.sol#L208

Added line #L208 was not covered by tests
}

address _from = owner();
uint256 len = req.contents.length;

address _from = owner();

for (uint256 i = 0; i < len; ) {
CurrencyTransferLib.transferCurrency(
req.tokenAddress,
Expand All @@ -225,48 +226,6 @@ contract Airdrop is EIP712, Initializable, Ownable {
}
}

function airdropNativeTokenWithSignature(AirdropRequest20 calldata req, bytes calldata signature) external payable {
// verify expiration timestamp
if (req.expirationTimestamp < block.timestamp) {
revert AirdropRequestExpired(req.expirationTimestamp);
}

if (req.tokenAddress != address(0)) {
revert AirdropInvalidTokenAddress();
}

// verify data
if (!_verifyReqERC20(req, signature)) {
revert AirdropVerificationFailed();
}

uint256 len = req.contents.length;

uint256 nativeTokenAmount;

for (uint256 i = 0; i < len; ) {
nativeTokenAmount += req.contents[i].amount;

if (nativeTokenAmount > msg.value) {
revert AirdropValueMismatch();
}

(bool success, ) = req.contents[i].recipient.call{ value: req.contents[i].amount }("");

if (!success) {
revert AirdropFailed();
}

unchecked {
i += 1;
}
}

if (nativeTokenAmount != msg.value) {
revert AirdropValueMismatch();
}
}

function airdrop721WithSignature(AirdropRequest721 calldata req, bytes calldata signature) external {
// verify expiration timestamp
if (req.expirationTimestamp < block.timestamp) {
Expand Down

0 comments on commit 14553e2

Please sign in to comment.