// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import "@openzeppelin/contracts/interfaces/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import re | |
import csv | |
# Sanctuary link : https://github.com/tintinweb/smart-contract-sanctuary-ethereum/tree/015d0105102504dc8733a18c3543f87f1829a5e8 | |
# Patterns | |
erc2771_pattern = re.compile(r".*import.*ERC2771.*") |
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import "./crossChainWarriors.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
contract Attacker is IERC721Receiver {
// Used to avoid an infinite loop
bool public _hasReentered;
function crossChainTransfer(
uint256 crossChainId,
address to,
uint256 tokenId
) external {
if (!_isValidChainId(crossChainId)) revert InvalidDestinationChainId();
if (!_isApprovedOrOwner(_msgSender(), tokenId)) revert InvalidTransferCaller();
_burnWarrior(tokenId);
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract simpleReceiver{
function onERC721Received(
address,
address,
uint256,
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory data
) private returns (bool) {
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {
return retval == IERC721Receiver.onERC721Received.selector;
function _safeMint(
address to,
uint256 tokenId,
bytes memory data
) internal virtual {
_mint(to, tokenId);
require(
_checkOnERC721Received(address(0), to, tokenId, data),
"ERC721: transfer to non ERC721Receiver implementer"
function mint(address to) public returns (uint256) {
uint256 newWarriorId = tokenIds.current();
_safeMint(to, newWarriorId);
tokenIds.increment();
return newWarriorId;
}