GPT Smart Contract

GPT Smart Contract

Inheritance of Contracts

The GPT smart contract inherits properties from ERC-20 and Ownable contracts. The first is a standard for fungible tokens on the Ethereum blockchain, while the second provides functionalities that allow for the management of contract ownership.
solidityCopy codecontract GPT is ERC20, Ownable {
address _admin;
bytes32 generatedHash;
mapping(bytes32 => string[]) public compensatedData;
mapping(address => bool) public approvedBurners;
// ... rest of the contract
The GPT contract has variables to store the contract's admin (owner), the hash generated with compensation, and two mappings. The first mapping relates compensation hashes to specific data, while the second is used to approve addresses authorized to burn tokens.
The GPT contract constructor is used to initialize the contract when it is deployed on the blockchain.
solidityCopy codeconstructor(
string memory name,
string memory symbol,
uint256 initialSupply,
address admin
) ERC20(name, symbol) {
_admin = admin;
_mint(msg.sender, initialSupply);
The constructor receives the token's name and symbol, the initial token supply, and the admin's address.

Main Functions


The mint function allows for the creation of new tokens and can only be called by the contract's owner.
solidityCopy codefunction mint(address to, uint256 amount) public onlyOwner {
_mint(to, amount);


The decimals function adjusts the token's decimal places to 6.
solidityCopy codefunction decimals() public view virtual override returns (uint8) {
return 6;

Approve Burner

The approveBurner function allows the admin to approve an address as authorized to burn tokens.
solidityCopy codefunction approveBurner() public {
require(msg.sender != _admin, "admin can't self approve");
approvedBurners[address(_admin)] = true;

Revoke Burner Approval

The revokeBurnerApproval function revokes the admin's approval to burn tokens.
solidityCopy codefunction revokeBurnerApproval() internal {
approvedBurners[address(_admin)] = false;


The compensate function generates a hash, burns the tokens, and returns the hash for consultation.
solidityCopy codefunction compensate(
address from,
uint256 amount,
string[] memory data
) public onlyOwner returns (bytes32) {
require(burnFrom(from, amount), "Burn didn't work");
return (generatedHash);

Burn Tokens

The burn function allows the owner to burn tokens.
solidityCopy codefunction burn(address from, uint256 amount) public onlyOwner returns (bool) {
_burn(from, amount);
return true;

Ownable Contract

The Ownable contract manages the ownership of the contract, allowing for the addition and removal of owners.
solidityCopy codeabstract contract Ownable is Context {
mapping(address => bool) private _owner;
event OwnershipAdded(address indexed newOwner);
event OwnershipRemoved(address indexed removedOwner);
// ... rest of the contract

Main Functions

Add Owner

The addOwnership function adds a new owner to the contract.
solidityCopy codefunction addOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");

Renounce Ownership

The renounceOwnership function allows an owner to renounce their position.
solidityCopy codefunction renounceOwnership(address removedOwner) public virtual onlyOwner {
_owner[removedOwner] = false;
emit OwnershipRemoved(removedOwner);

Verify Owner

The readOwner function returns whether an address is an owner or not.
solidityCopy codefunction readOwner(address owner) public view returns (bool) {
return _owner[owner];