Source Chain Smart Contracts
An overview of source chain smart contracts and the best practice pattern to securely query their data on Creditcoin using Attestcoin Protocol Readability.
Last updated
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract TestERC20 is ERC20 {
address public constant BURN_ADDRESS = address(1); // 0x...01
/// @notice Emitted when tokens are burned (sent to the burn address).
/// @param from The address burning their tokens
/// @param value The amount of tokens burned
event TokensBurnedForBridging(address indexed from, uint256 value);
constructor() ERC20("Burn Test", "TEST") {
// Mint sender initial supply
_mint(msg.sender, 1_000_000 ether);
}
/// @notice "Burn" by transferring tokens to the 0x...01 sink address.
/// @dev This does NOT reduce totalSupply; it only makes tokens inaccessible.
/// @param amount The amount of tokens to burn
/// @return success Whether the transfer succeeded
function burn(uint256 amount) external returns (bool) {
_transfer(msg.sender, BURN_ADDRESS, amount);
emit TokensBurnedForBridging(msg.sender, amount);
return true;
}
}