Verified contractPartialMIT
GasBurner
Address0x0adbc3922f80ecb0e95292ea1f6273360c2f4e6f
- Balance
0 ETH
- Transactions
3,775
- Compiler
solc 0.8.16
- Same code
Only this contract
Details
- Compiler
- solc 0.8.16+commit.07a7930e
- Language
- solidity
- Optimization
- Yes, 200 runs
- License
- MIT
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 15,783,046
- Creation transaction
- 0x907e7ff875…f7a5548bd9
GasBurner.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IERC721 {
function ownerOf(uint256 tokenId_) external view returns (address);
function transferFrom(address from_, address to_, uint256 tokenId_) external;
}
interface IGasGangsters {
function mintAsController(address to_, uint256 tokenId_) external;
}
abstract contract Ownable {
event OwnershipTransferred(address indexed oldOwner, address indexed newOwner);
address public owner;
constructor() { owner = msg.sender; }
modifier onlyOwner { require(owner == msg.sender, "Not Owner!"); _; }
function transferOwnership(address new_) external {
address _oldOwner = owner;
require(_oldOwner == msg.sender, "Not Owner!");
owner = new_;
emit OwnershipTransferred(_oldOwner, new_);
}
}
contract GasBurner is Ownable {
// GasBurner is simple.
// Step 1: Burn the existing ERC721
// Step 2: Mint the cooresponding ERC721
// Interfaces
IERC721 public GasBox;
IGasGangsters public GasGangsters;
// Constants
address public constant burnAddress = 0x000000000000000000000000000000000000dEaD;
// Constructor
constructor(address gasBox_, address gasGangsters_) {
GasBox = IERC721(gasBox_);
GasGangsters = IGasGangsters(gasGangsters_);
}
// Setters
function setGasBox(address gasBox_) external onlyOwner {
GasBox = IERC721(gasBox_);
}
function setGasGangsters(address gasGangsters_) external onlyOwner {
GasGangsters = IGasGangsters(gasGangsters_);
}
// We use the name initiateGangsters because it's on-lore
function initiateGangsters(uint256[] calldata tokenIds_) external {
uint256 l = tokenIds_.length;
uint256 i; unchecked { do {
// This will "burn" the token. Reverts on non-ownership as default behavior
GasBox.transferFrom(msg.sender, burnAddress, tokenIds_[i]);
// This will "mint" the token using tokenId and SM version of ERC721G
GasGangsters.mintAsController(msg.sender, tokenIds_[i]);
} while (++i < l); }
}
}Compiler settingsShow
{
"optimizer": {
"runs": 200,
"enabled": true
}
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.