-
Notifications
You must be signed in to change notification settings - Fork 532
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
Airdrop #628
Airdrop #628
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #628 +/- ##
==========================================
+ Coverage 64.72% 65.26% +0.54%
==========================================
Files 216 217 +1
Lines 6702 6847 +145
==========================================
+ Hits 4338 4469 +131
- Misses 2364 2378 +14 ☔ View full report in Codecov by Sentry. |
function airdropERC721(address _tokenAddress, AirdropContentERC721[] calldata _contents) external onlyOwner { | ||
uint256 len = _contents.length; | ||
|
||
for (uint256 i = 0; i < len; i++) { | ||
IERC721(_tokenAddress).safeTransferFrom(msg.sender, _contents[i].recipient, _contents[i].tokenId); | ||
} | ||
|
||
emit Airdrop(_tokenAddress); | ||
} |
Check notice
Code scanning / Slither
Calls inside a loop Low
function airdropERC1155WithSignature(AirdropRequestERC1155 calldata req, bytes calldata signature) external { | ||
// verify expiration timestamp | ||
if (req.expirationTimestamp < block.timestamp) { | ||
revert AirdropRequestExpired(req.expirationTimestamp); | ||
} | ||
|
||
if (processed[req.uid]) { | ||
revert AirdropRequestAlreadyProcessed(); | ||
} | ||
|
||
// verify data | ||
if (!_verifyRequestSignerERC1155(req, signature)) { | ||
revert AirdropRequestInvalidSigner(); | ||
} | ||
|
||
processed[req.uid] = true; | ||
|
||
address _from = owner(); | ||
uint256 len = req.contents.length; | ||
|
||
for (uint256 i = 0; i < len; i++) { | ||
IERC1155(req.tokenAddress).safeTransferFrom( | ||
_from, | ||
req.contents[i].recipient, | ||
req.contents[i].tokenId, | ||
req.contents[i].amount, | ||
"" | ||
); | ||
} | ||
|
||
emit Airdrop(req.tokenAddress); | ||
} |
Check notice
Code scanning / Slither
Calls inside a loop Low
function airdropERC1155(address _tokenAddress, AirdropContentERC1155[] calldata _contents) external onlyOwner { | ||
uint256 len = _contents.length; | ||
|
||
for (uint256 i = 0; i < len; i++) { | ||
IERC1155(_tokenAddress).safeTransferFrom( | ||
msg.sender, | ||
_contents[i].recipient, | ||
_contents[i].tokenId, | ||
_contents[i].amount, | ||
"" | ||
); | ||
} | ||
|
||
emit Airdrop(_tokenAddress); | ||
} |
Check notice
Code scanning / Slither
Calls inside a loop Low
function airdropERC721WithSignature(AirdropRequestERC721 calldata req, bytes calldata signature) external { | ||
// verify expiration timestamp | ||
if (req.expirationTimestamp < block.timestamp) { | ||
revert AirdropRequestExpired(req.expirationTimestamp); | ||
} | ||
|
||
if (processed[req.uid]) { | ||
revert AirdropRequestAlreadyProcessed(); | ||
} | ||
|
||
// verify data | ||
if (!_verifyRequestSignerERC721(req, signature)) { | ||
revert AirdropRequestInvalidSigner(); | ||
} | ||
|
||
processed[req.uid] = true; | ||
|
||
address _from = owner(); | ||
uint256 len = req.contents.length; | ||
|
||
for (uint256 i = 0; i < len; i++) { | ||
IERC721(req.tokenAddress).safeTransferFrom(_from, req.contents[i].recipient, req.contents[i].tokenId); | ||
} | ||
|
||
emit Airdrop(req.tokenAddress); | ||
} |
Check notice
Code scanning / Slither
Reentrancy vulnerabilities Low
External calls:
- IERC721(req.tokenAddress).safeTransferFrom(_from,req.contents[i].recipient,req.contents[i].tokenId)
Event emitted after the call(s):
- AirdropWithSignature(req.tokenAddress)
function airdropERC1155(address _tokenAddress, AirdropContentERC1155[] calldata _contents) external onlyOwner { | ||
uint256 len = _contents.length; | ||
|
||
for (uint256 i = 0; i < len; i++) { | ||
IERC1155(_tokenAddress).safeTransferFrom( | ||
msg.sender, | ||
_contents[i].recipient, | ||
_contents[i].tokenId, | ||
_contents[i].amount, | ||
"" | ||
); | ||
} | ||
|
||
emit Airdrop(_tokenAddress); | ||
} |
Check notice
Code scanning / Slither
Reentrancy vulnerabilities Low
External calls:
- IERC1155(_tokenAddress).safeTransferFrom(msg.sender,_contents[i].recipient,_contents[i].tokenId,_contents[i].amount,)
Event emitted after the call(s):
- Airdrop(_tokenAddress)
function claimERC1155( | ||
address _token, | ||
address _receiver, | ||
uint256 _tokenId, | ||
uint256 _quantity, | ||
bytes32[] calldata _proofs | ||
) external { | ||
bytes32 claimHash = _getClaimHashERC1155(_receiver, _token, _tokenId); | ||
uint256 conditionId = tokenConditionId[_token]; | ||
|
||
if (claimed[conditionId][claimHash]) { | ||
revert AirdropAlreadyClaimed(); | ||
} | ||
|
||
bytes32 _tokenMerkleRoot = tokenMerkleRoot[_token]; | ||
if (_tokenMerkleRoot == bytes32(0)) { | ||
revert AirdropNoMerkleRoot(); | ||
} | ||
|
||
bool valid = MerkleProofLib.verify( | ||
_proofs, | ||
_tokenMerkleRoot, | ||
keccak256(abi.encodePacked(_receiver, _tokenId, _quantity)) | ||
); | ||
if (!valid) { | ||
revert AirdropInvalidProof(); | ||
} | ||
|
||
claimed[conditionId][claimHash] = true; | ||
|
||
IERC1155(_token).safeTransferFrom(owner(), _receiver, _tokenId, _quantity, ""); | ||
|
||
emit AirdropClaimed(_token, _receiver); | ||
} |
Check notice
Code scanning / Slither
Reentrancy vulnerabilities Low
External calls:
- IERC1155(_token).safeTransferFrom(owner(),_receiver,_tokenId,_quantity,)
Event emitted after the call(s):
- AirdropClaimed(_token,_receiver)
function airdropERC721(address _tokenAddress, AirdropContentERC721[] calldata _contents) external onlyOwner { | ||
uint256 len = _contents.length; | ||
|
||
for (uint256 i = 0; i < len; i++) { | ||
IERC721(_tokenAddress).safeTransferFrom(msg.sender, _contents[i].recipient, _contents[i].tokenId); | ||
} | ||
|
||
emit Airdrop(_tokenAddress); | ||
} |
Check notice
Code scanning / Slither
Reentrancy vulnerabilities Low
External calls:
- IERC721(_tokenAddress).safeTransferFrom(msg.sender,_contents[i].recipient,_contents[i].tokenId)
Event emitted after the call(s):
- Airdrop(_tokenAddress)
No description provided.