Skip to content

Instantly share code, notes, and snippets.

@marlomajor
Created November 15, 2021 05:05
Show Gist options
  • Save marlomajor/00ef05b585b0fddec06d3329e13bda58 to your computer and use it in GitHub Desktop.
Save marlomajor/00ef05b585b0fddec06d3329e13bda58 to your computer and use it in GitHub Desktop.
Encode Homework_4
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.7;
contract VolcanoCoin {
uint public totalSupply = 10000;
address owner;
mapping(address => uint) public balances;
error Unauthorized();
constructor() {
owner=msg.sender;
balances[owner] = totalSupply;
}
modifier onlyOwner {
if (msg.sender==owner) {
_;
}
}
struct Payments {
uint transferAmount;
address recipientAddr;
}
mapping (address => Payments) transactions;
event TransferComplete(uint, address);
function transfer(uint _amount, address _recipientAddr) public {
if (msg.sender != owner) {
revert Unauthorized();
}
payable(_recipientAddr).transfer(_amount);
emit TransferComplete(_amount, _recipientAddr);
}
function getTotalSupply() public view returns(uint) {
return totalSupply;
}
event TotalSupplyUpdated(uint);
function increaseSupply(uint _totalSupply) public onlyOwner {
_totalSupply = _totalSupply + 1000;
emit TotalSupplyUpdated(_totalSupply);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment