Source Code
Overview
APE Balance
APE Value
$0.00Multichain Info
N/A
Cross-Chain Transactions
Loading...
Loading
Contract Name:
Forge
Compiler Version
v0.8.23+commit.f704f362
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
// File: @openzeppelin/contracts/utils/Context.sol
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
// File: @openzeppelin/contracts/access/Ownable.sol
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
// File: @openzeppelin/contracts/utils/introspection/IERC165.sol
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
// File: @openzeppelin/contracts/token/ERC721/IERC721.sol
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
* or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
* understand this adds an external call which potentially creates a reentrancy vulnerability.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
}
// File: contracts/old.sol
pragma solidity ^0.8.20;
contract Forge is Ownable {
mapping(address => uint256) public forgeCount;
address[] public forgers;
mapping(address => bool) private hasForged;
address public burnaddress = 0x000000000000000000000000000000000000dEaD;
event Forged(address nftContract, uint256 tokenId, address burner);
function igniteFlameProtocol(address nftContract, uint256 tokenId) external payable {
require(msg.value == 0.05 ether, "You must send exactly 0.05 ETH");
IERC721 nft = IERC721(nftContract);
require(nft.ownerOf(tokenId) == msg.sender, "You don't own this NFT");
if (!hasForged[msg.sender]) {
forgers.push(msg.sender);
hasForged[msg.sender] = true;
}
forgeCount[msg.sender]++;
nft.transferFrom(msg.sender, burnaddress, tokenId);
emit Forged(nftContract, tokenId, msg.sender);
}
function getForgerCount() external view returns (uint256) {
return forgers.length;
}
function getForgerAtIndex(uint256 index) external view returns (address, uint256) {
require(index < forgers.length, "Index out of bounds");
address forger = forgers[index];
return (forger, forgeCount[forger]);
}
function getMyForges() external view returns (uint256){
return forgeCount[msg.sender];
}
function numberOfForgesFrom(address forger) external view returns (uint256){
return forgeCount[forger];
}
function rescueETH(address payable recipient, uint256 amount) external onlyOwner {
require(recipient != address(0), "Invalid recipient address");
require(address(this).balance >= amount, "Insufficient balance");
(bool success,) = recipient.call{value: amount}("");
require(success, "Transfer failed");
}
function getContractBalance() external view returns (uint256) {
return address(this).balance;
}
receive() external payable {}
}{
"optimizer": {
"enabled": true,
"runs": 200
},
"evmVersion": "paris",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"nftContract","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"burner","type":"address"}],"name":"Forged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"burnaddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"forgeCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"forgers","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getContractBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getForgerAtIndex","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getForgerCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMyForges","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"igniteFlameProtocol","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"forger","type":"address"}],"name":"numberOfForgesFrom","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"rescueETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
6080604052600480546001600160a01b03191661dead17905534801561002457600080fd5b5061002e33610033565b610083565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610951806100926000396000f3fe6080604052600436106100c65760003560e01c80638da5cb5b1161007f578063b925d9fd11610059578063b925d9fd146101f8578063e5c5f1d51461022e578063ee6b64f01461024e578063f2fde38b1461028d57600080fd5b80638da5cb5b146101b2578063ac92a9f4146101d0578063b4efc4da146101e357600080fd5b8063099a04e5146100d25780631d53ccd1146100f45780634b61a3f9146101255780636f9fb98a14610152578063715018a6146101655780638907c89a1461017a57600080fd5b366100cd57005b600080fd5b3480156100de57600080fd5b506100f26100ed366004610858565b6102ad565b005b34801561010057600080fd5b50336000908152600160205260409020545b6040519081526020015b60405180910390f35b34801561013157600080fd5b50610112610140366004610884565b60016020526000908152604090205481565b34801561015e57600080fd5b5047610112565b34801561017157600080fd5b506100f26103f1565b34801561018657600080fd5b5061019a6101953660046108a8565b610405565b6040516001600160a01b03909116815260200161011c565b3480156101be57600080fd5b506000546001600160a01b031661019a565b6100f26101de366004610858565b61042f565b3480156101ef57600080fd5b50600254610112565b34801561020457600080fd5b50610112610213366004610884565b6001600160a01b031660009081526001602052604090205490565b34801561023a57600080fd5b5060045461019a906001600160a01b031681565b34801561025a57600080fd5b5061026e6102693660046108a8565b61068f565b604080516001600160a01b03909316835260208301919091520161011c565b34801561029957600080fd5b506100f26102a8366004610884565b610720565b6102b5610799565b6001600160a01b0382166103105760405162461bcd60e51b815260206004820152601960248201527f496e76616c696420726563697069656e7420616464726573730000000000000060448201526064015b60405180910390fd5b804710156103575760405162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b6044820152606401610307565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146103a4576040519150601f19603f3d011682016040523d82523d6000602084013e6103a9565b606091505b50509050806103ec5760405162461bcd60e51b815260206004820152600f60248201526e151c985b9cd9995c8819985a5b1959608a1b6044820152606401610307565b505050565b6103f9610799565b61040360006107f3565b565b6002818154811061041557600080fd5b6000918252602090912001546001600160a01b0316905081565b3466b1a2bc2ec50000146104855760405162461bcd60e51b815260206004820152601e60248201527f596f75206d7573742073656e642065786163746c7920302e30352045544800006044820152606401610307565b6040516331a9108f60e11b815260048101829052829033906001600160a01b03831690636352211e90602401602060405180830381865afa1580156104ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104f291906108c1565b6001600160a01b0316146105415760405162461bcd60e51b8152602060048201526016602482015275165bdd48191bdb89dd081bdddb881d1a1a5cc813919560521b6044820152606401610307565b3360009081526003602052604090205460ff166105b3576002805460018181019092557f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0180546001600160a01b031916339081179091556000908152600360205260409020805460ff191690911790555b3360009081526001602052604081208054916105ce836108de565b9091555050600480546040516323b872dd60e01b815233928101929092526001600160a01b039081166024830152604482018490528216906323b872dd90606401600060405180830381600087803b15801561062957600080fd5b505af115801561063d573d6000803e3d6000fd5b5050604080516001600160a01b038716815260208101869052338183015290517f98f13e667ce55611c8fa11a4f21a2a0bbe5c4beac19cae004f72b930a0d1e5fa9350908190036060019150a1505050565b600254600090819083106106db5760405162461bcd60e51b8152602060048201526013602482015272496e646578206f7574206f6620626f756e647360681b6044820152606401610307565b6000600284815481106106f0576106f0610905565b60009182526020808320909101546001600160a01b03168083526001909152604090912054909590945092505050565b610728610799565b6001600160a01b03811661078d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610307565b610796816107f3565b50565b6000546001600160a01b031633146104035760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610307565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038116811461079657600080fd5b6000806040838503121561086b57600080fd5b823561087681610843565b946020939093013593505050565b60006020828403121561089657600080fd5b81356108a181610843565b9392505050565b6000602082840312156108ba57600080fd5b5035919050565b6000602082840312156108d357600080fd5b81516108a181610843565b6000600182016108fe57634e487b7160e01b600052601160045260246000fd5b5060010190565b634e487b7160e01b600052603260045260246000fdfea26469706673582212209f0f1a09a583683010855e0f8070b2ce168c5da3054469955401369dbccde60564736f6c63430008170033
Deployed Bytecode
0x6080604052600436106100c65760003560e01c80638da5cb5b1161007f578063b925d9fd11610059578063b925d9fd146101f8578063e5c5f1d51461022e578063ee6b64f01461024e578063f2fde38b1461028d57600080fd5b80638da5cb5b146101b2578063ac92a9f4146101d0578063b4efc4da146101e357600080fd5b8063099a04e5146100d25780631d53ccd1146100f45780634b61a3f9146101255780636f9fb98a14610152578063715018a6146101655780638907c89a1461017a57600080fd5b366100cd57005b600080fd5b3480156100de57600080fd5b506100f26100ed366004610858565b6102ad565b005b34801561010057600080fd5b50336000908152600160205260409020545b6040519081526020015b60405180910390f35b34801561013157600080fd5b50610112610140366004610884565b60016020526000908152604090205481565b34801561015e57600080fd5b5047610112565b34801561017157600080fd5b506100f26103f1565b34801561018657600080fd5b5061019a6101953660046108a8565b610405565b6040516001600160a01b03909116815260200161011c565b3480156101be57600080fd5b506000546001600160a01b031661019a565b6100f26101de366004610858565b61042f565b3480156101ef57600080fd5b50600254610112565b34801561020457600080fd5b50610112610213366004610884565b6001600160a01b031660009081526001602052604090205490565b34801561023a57600080fd5b5060045461019a906001600160a01b031681565b34801561025a57600080fd5b5061026e6102693660046108a8565b61068f565b604080516001600160a01b03909316835260208301919091520161011c565b34801561029957600080fd5b506100f26102a8366004610884565b610720565b6102b5610799565b6001600160a01b0382166103105760405162461bcd60e51b815260206004820152601960248201527f496e76616c696420726563697069656e7420616464726573730000000000000060448201526064015b60405180910390fd5b804710156103575760405162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b6044820152606401610307565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146103a4576040519150601f19603f3d011682016040523d82523d6000602084013e6103a9565b606091505b50509050806103ec5760405162461bcd60e51b815260206004820152600f60248201526e151c985b9cd9995c8819985a5b1959608a1b6044820152606401610307565b505050565b6103f9610799565b61040360006107f3565b565b6002818154811061041557600080fd5b6000918252602090912001546001600160a01b0316905081565b3466b1a2bc2ec50000146104855760405162461bcd60e51b815260206004820152601e60248201527f596f75206d7573742073656e642065786163746c7920302e30352045544800006044820152606401610307565b6040516331a9108f60e11b815260048101829052829033906001600160a01b03831690636352211e90602401602060405180830381865afa1580156104ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104f291906108c1565b6001600160a01b0316146105415760405162461bcd60e51b8152602060048201526016602482015275165bdd48191bdb89dd081bdddb881d1a1a5cc813919560521b6044820152606401610307565b3360009081526003602052604090205460ff166105b3576002805460018181019092557f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0180546001600160a01b031916339081179091556000908152600360205260409020805460ff191690911790555b3360009081526001602052604081208054916105ce836108de565b9091555050600480546040516323b872dd60e01b815233928101929092526001600160a01b039081166024830152604482018490528216906323b872dd90606401600060405180830381600087803b15801561062957600080fd5b505af115801561063d573d6000803e3d6000fd5b5050604080516001600160a01b038716815260208101869052338183015290517f98f13e667ce55611c8fa11a4f21a2a0bbe5c4beac19cae004f72b930a0d1e5fa9350908190036060019150a1505050565b600254600090819083106106db5760405162461bcd60e51b8152602060048201526013602482015272496e646578206f7574206f6620626f756e647360681b6044820152606401610307565b6000600284815481106106f0576106f0610905565b60009182526020808320909101546001600160a01b03168083526001909152604090912054909590945092505050565b610728610799565b6001600160a01b03811661078d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610307565b610796816107f3565b50565b6000546001600160a01b031633146104035760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610307565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038116811461079657600080fd5b6000806040838503121561086b57600080fd5b823561087681610843565b946020939093013593505050565b60006020828403121561089657600080fd5b81356108a181610843565b9392505050565b6000602082840312156108ba57600080fd5b5035919050565b6000602082840312156108d357600080fd5b81516108a181610843565b6000600182016108fe57634e487b7160e01b600052601160045260246000fd5b5060010190565b634e487b7160e01b600052603260045260246000fdfea26469706673582212209f0f1a09a583683010855e0f8070b2ce168c5da3054469955401369dbccde60564736f6c63430008170033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.