Assignment2 Ethereum Smart Contract
Assignment2 Ethereum Smart Contract
Date: 04/11/23
Team members:
Monish Kumar A (2020506055)
Sanjay T (2020506081)
Bala Natesh R M (2020506018)
An Ethereum smart contract is a self-executing contract with the terms of the agreement
directly written into code. These contracts run on the Ethereum blockchain, which is a
decentralized, distributed ledger that allows for the execution of code when certain conditions
are met. Ethereum smart contracts are written in a programming language called Solidity.
Here, we have made a bug bounty smart contract. A user can report a bug along with its
description. The owner of the program checks and fixes the bug. Once the bug is fixed, the
reporter is granted a reward.
Code:
bugBounty.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract BugBounty {
address public owner; // Owner of the bug bounty program
uint256 public reward; // Reward assigned for each bug fixed
// Contains values for bug status
enum BugStatus { Reported, Fixed, Verified }
constructor() {
owner = msg.sender;
reward = 1 wei;
}
modifier onlyOwner() {
require(msg.sender == owner, "Only the owner can call this function");
_;
}
8- The bug is verified for "Fixed" status and the reward is transacted
Result:
Hence, an Ethereum smart contract has been developed and tested successfully