Event and Emit in Solidity

Hope all doing well.
I want to do the following TWO activities in the SOLIDITY code written below:-
An ASAP help will be highly appreciable.
Thanks with regards


Emit an event ScoreChanged with two arguments: int amount (equal to the value that was sent) and bool direction (true for up function and false for down).

Emit an event GameEnded after gameOver is switched to true

Solidity code:-

pragma solidity ^0.4.17;

contract TugOfWar {

int public score = 0;
int constant endAt = 1 ether;
bool public gameOver = false;

function up() external payable {
    require(msg.value > 0);

    int value = int(msg.value);
    score += value;


function down() external payable {
    require(msg.value > 0);

    int value = int(msg.value);
    score -= value;



function checkIfGameOver() internal {
    if(score >= endAt || score <= endAt * -1) {
        gameOver = true;



Blockchain – I'm trying to call a method in Solidity Smart Contract via Angle App. but I can't call the method. This is the error I get in the console

I am trying to call a method in solidity smart contract via Angle app. but I can't call the method. can someone help me please This is the error i get in the console

TypeError: this.contract.methods.hello is not a function
at CertificateContractService. (certificate-contract.service.ts:32)
at Generator.next ()
at fulfilled (tslib.es6.js:70)
at ZoneDelegate.invoke (zone-evergreen.js:359)
at Object.onInvoke (core.js:39699)
at ZoneDelegate.invoke (zone-evergreen.js:358)
at Zone.run (zone-evergreen.js:124)
at zone-evergreen.js:855
at ZoneDelegate.invokeTask (zone-evergreen.js:391)
at Object.onInvokeTask (core.js:39680)

Clever contract

contract CertificateList {

    function hello() external pure returns (string memory )  {
        return "Hello";


Angular service

import Web3 from 'web3';
import {WEB3} from './WEB3';

declare let require: any;
declare let window: any;

  providedIn: 'root'
export class CertificateContractService {
  private abi: any;
  private address = '0xb0fFD3498B219ad2A62Eb98fEDE591265b3C3B67';
  private contract;
  private accounts: string();

  constructor(@Inject(WEB3) private web3: Web3) {
    this.init().then(res => {
    }).catch(err => {

  private async init() {
    this.abi = require('../assets/abi/CertificateList.json');
    // await this.web3.currentProvider.enable();
    this.accounts = await this.web3.eth.getAccounts();

    this.contract = new this.web3.eth.Contract(this.abi, this.address, {gas: 1000000, gasPrice: '10000000000000'});

      .then(receipt => {
      }).catch(err => {


import { InjectionToken } from '@angular/core';
import Web3 from 'web3';

export const WEB3 = new InjectionToken('web3', {
  providedIn: 'root',
  factory: () => {
    try {
      window('ethereum').autoRefreshOnNetworkChange = false;
      const provider = ('ethereum' in window) ? window('ethereum') : Web3('givenProvider');
      return new Web3(provider);
    } catch (err) {
      throw new Error('Non-Ethereum browser detected. You should consider trying Mist or MetaMask!');

How to Write Upgradable Smart Contracts in Solidity – Cryptocurrencies Corner

Smart contracts determine how a blockchain works. The immutability of the blockchain also extends to intelligent contracts – a once encoded intelligent contract can not be changed. This is one of the main reasons for the high security of the blockchain and the data in the blockchain. There is no way to edit the data in the blockchain, and there is no way to work around the conditions specified in the smart contract.

This advantage makes Blockchain extremely reliable for financial transactions, maximizes security and minimizes effort and costs. Sometimes, however, the greatest blessing becomes the biggest curse. Every software should have some development latitude, and intelligent contracts do not have this attribute because of their immutability. Anything that does not change according to changing times can not be praised with the prefix "smart", and smart contracts should not be an exception.

Read more at https://www.blockchainappfactory.com/blog/how-to-write-upgradable-smart-contracts-in-solidity/