In our JavaScript script, we define the following functions previously called in the HTML file:
- init(): Serves to read contract states and display auction details such as the current highest bid and bidder, the auction status and more
- bid(): Enables participants to make a bid
- cancel_auction(): Enables the owner to cancel the auction
- destruct_auction(): Destroys the contract
Each of these functions invokes methods defined in your contract. In Ethereum, there are two ways to invoke a method present in a smart contract, whether by addressing a function call or by sending a transaction.