The contract abstraction API is something that makes truffle-contract very special compared to web3.js. Here is why it's special:
- It will automatically fetch default values, such as library addresses, contract addresses, and so on, depending on which network it's connected to; therefore, you don't have to edit the source code every time you change the network.
- You may choose to listen to certain events in certain networks only.
- It makes it easy to link libraries to contract's byte code at runtime. There are several other benefits you will find out once you have explored how to use the API.
Before we get into how to create a contract abstraction and its methods, let's write a sample contract, which the contract ...