// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IERC20 {
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}
contract TokenToBlackholeRecorder {
address public constant BLACKHOLE_ADDRESS = 0x000000000000000000000000000000000000dEaD;
IERC20 public token;
uint256 public totalSent;
event TokenSentToBlackhole(address indexed sender, uint256 indexed amount, string solanaAddress);
constructor(address _tokenAddress) {
token = IERC20(_tokenAddress);
}
function sendToBlackhole(uint256 amount, string calldata solanaAddress) external {
require(token.transferFrom(msg.sender, BLACKHOLE_ADDRESS, amount), "Transfer failed");
totalSent += amount;
emit TokenSentToBlackhole(msg.sender, amount, solanaAddress);
}
}
{
"compilationTarget": {
"TokenToBlackholeRecorder.sol": "TokenToBlackholeRecorder"
},
"evmVersion": "istanbul",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": []
}
[{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"string","name":"solanaAddress","type":"string"}],"name":"TokenSentToBlackhole","type":"event"},{"inputs":[],"name":"BLACKHOLE_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"string","name":"solanaAddress","type":"string"}],"name":"sendToBlackhole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]