My apologies, thank you for letting me know the proper format. Here is the entire code.
Bank.sol
pragma solidity 0.7.5;
import "./Destroyable.sol";
interface GovernmentInterface{
function addTransaction(address _from, address _to, uint _amount) external payable;
}
contract Bank is Destroyable {
GovernmentInterface governmentTxReport = GovernmentInterface(0xd9145CCE52D386f254917e481eB44e9943F39138);
mapping (address => uint) balance;
event balanceAdded(uint amount, address depositedTo);
function deposit() public payable returns (uint){
balance[msg.sender] += msg.value;
emit balanceAdded(msg.value, msg.sender);
return balance[msg.sender];
}
function withdraw(uint amount) public returns (uint){
require(amount <= balance[msg.sender]);
balance[msg.sender] -= amount;
msg.sender.transfer(amount);
return balance[msg.sender];
}
function getBalance() public view returns (uint){
return balance[msg.sender];
}
function transfer(address recipient, uint amount) public payable {
require(balance[msg.sender] >= amount, "Balance not sufficient.");
require(msg.sender != recipient, "You can't transfer money to yourself.");
uint previousSenderBalance = balance[msg.sender];
_transfer(msg.sender, recipient, amount);
governmentTxReport.addTransaction{value: 1 ether}(msg.sender, recipient, amount);
assert(balance[msg.sender] == previousSenderBalance - amount);
}
function _transfer(address from, address to, uint amount) private {
balance[from] -= amount;
balance[to] += amount;
}
function getContractBalance() public view returns(uint){
return address(this).balance;
}
}
Government.sol
pragma solidity 0.7.5;
contract Government {
struct transaction {
address from;
address to;
uint amount;
uint TxId;
}
transaction[] transactionLog;
function addTransaction(address _from, address _to, uint _amount) external payable {
transactionLog.push(transaction(_from, _to, _amount, transactionLog.length));
}
function getTransaction(uint _index) public view returns(address, address, uint){
return (transactionLog[_index].from, transactionLog[_index].to, transactionLog[_index].amount);
}
function getBalance() public view returns(uint){
return address(this).balance;
}
}
Ownable_1.sol
pragma solidity 0.7.5;
contract Ownable_1 {
address payable internal owner;
constructor(){
owner = msg.sender;
}
modifier onlyOwner{
require(msg.sender == owner, "Only the Owner can Terminate this Contract.");
_; // run the function.
}
}
Destroyable.sol
pragma solidity 0.7.5;
import "./Ownable_1.sol";
contract Destroyable is Ownable_1 {
function close() public onlyOwner {
selfdestruct(owner);
}
}